Skip to content

Fix compilation on TruffleRuby [if libnlutils is installed into /usr/local/lib?] #1

@mike-bourgeous

Description

@mike-bourgeous

TruffleRuby's extension build process doesn't seem to check /etc/ld.so.conf, or for some other reason is not finding libraries in /usr/local/lib. Or, it could be that Mkmf's library search is generating code that fails to compile with TruffleRuby.

Errors building the gem in TruffleRuby:

conftest.c:14:57: error: use of undeclared identifier 'nl_unescape_string'
int t(void) { void ((*volatile p)()); p = (void ((*)()))nl_unescape_string; return !p; }
                                                        ^
1 error generated.
Process failed: #<Process::Status: pid 47735 exit 1>
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     int (* volatile tp)(void)=(int (*)(void))&t;
 9:     printf("%d", (*tp)());
10:   }
11: 
12:   return !!argv[argc];
13: }
14: int t(void) { void ((*volatile p)()); p = (void ((*)()))nl_unescape_string; return !p; }
/* end */
ld.lld: error: unable to find library -lnlutils
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
Process failed: #<Process::Status: pid 47739 exit 1>
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     int (* volatile tp)(void)=(int (*)(void))&t;
 9:     printf("%d", (*tp)());
10:   }
11: 
12:   return !!argv[argc];
13: }
14: extern void nl_unescape_string();
15: int t(void) { nl_unescape_string(); return 0; }
/* end */

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions