Unresolved symbols dlclose, dlopen, dlerror, dlsym

M

me2faster

I'm getting unresolved symbols from the linker related to the dl
(dynamic loading ??) module:

ld -L . -L ../.. -o dl.so dl.o handle.o ptr.o sym.o
-llibruby-static.a

**** ERROR **** [1210]:
handle.o: In function `dlhandle_free':
handle.o(.text._145914312+0x192): unresolved reference to dlclose.
**** ERROR **** [1210]:
handle.o: In function `rb_dlhandle_initialize':
handle.o(.text._145919112+0x5d2): unresolved reference to dlopen.
**** ERROR **** [1210]:
handle.o(.text._145919112+0x652): unresolved reference to dlerror.
**** ERROR **** [1210]:
handle.o: In function `rb_dlhandle_sym':
handle.o(.text._145946776+0x642): unresolved reference to dlsym.

I'm trying to build on a Tandem (now HP) NonStop server, under a POSIX
environment. c89 is the C compiler that conforms to the 1989 C standard

(not c99). Here's my 'config.h':


#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define STDC_HEADERS 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STRINGS_H 1
#define HAVE_STDINT_H 1
#define HAVE_UNISTD_H 1
#define HAVE_LONG_LONG 1
#define HAVE_OFF_T 1
#define SIZEOF_INT 4
#define SIZEOF_SHORT 2
#define SIZEOF_LONG 4
#define SIZEOF_LONG_LONG 8
#define SIZEOF___INT64 0
#define SIZEOF_OFF_T 4
#define SIZEOF_VOIDP 4
#define SIZEOF_FLOAT 4
#define SIZEOF_DOUBLE 8
#define SIZEOF_TIME_T 4
#define HAVE_PROTOTYPES 1
#define TOKEN_PASTE(x,y) x##y
#define HAVE_STDARG_PROTOTYPES 1
#define NORETURN(x) x
#define HAVE_DECL_SYS_NERR 0
#define HAVE_DIRENT_H 1
#define STDC_HEADERS 1
#define HAVE_SYS_WAIT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_UNISTD_H 1
#define HAVE_LIMITS_H 1
#define HAVE_SYS_IOCTL_H 1
#define HAVE_FCNTL_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TIMES_H 1
#define HAVE_SYS_PARAM_H 1
#define HAVE_PWD_H 1
#define HAVE_GRP_H 1
#define HAVE_UTIME_H 1
#define HAVE_MEMORY_H 1
#define HAVE_SYS_RESOURCE_H 1
#define HAVE_NETINET_IN_SYSTM_H 1
#define HAVE_FLOAT_H 1
#define HAVE_IEEEFP_H 1
#define HAVE_STRUCT_STAT_ST_RDEV 1
#define HAVE_ST_RDEV 1
#define GETGROUPS_T gid_t
#define RETSIGTYPE void
#define C_ALLOCA 1
#define STACK_DIRECTION -1
#define HAVE_DUP2 1
#define HAVE_MEMMOVE 1
#define HAVE_MKDIR 1
#define HAVE_STRCASECMP 1
#define HAVE_STRNCASECMP 1
#define HAVE_STRERROR 1
#define HAVE_STRFTIME 1
#define HAVE_STRCHR 1
#define HAVE_STRSTR 1
#define HAVE_STRTOUL 1
#define HAVE_CRYPT 1
#define HAVE_VSNPRINTF 1
#define HAVE_ISNAN 1
#define HAVE_FINITE 1
#define HAVE_HYPOT 1
#define HAVE_ACOSH 1
#define HAVE_ERF 1
#define HAVE_FMOD 1
#define HAVE_WAITPID 1
#define HAVE_CHROOT 1
#define HAVE_FSYNC 1
#define HAVE_GETCWD 1
#define HAVE_TIMES 1
#define HAVE_FCNTL 1
#define HAVE_LSTAT 1
#define HAVE_SYMLINK 1
#define HAVE_READLINK 1
#define HAVE_PAUSE 1
#define HAVE_GETPGRP 1
#define HAVE_GETPGID 1
#define HAVE_SETPGID 1
#define HAVE_GETGROUPS 1
#undef HAVE_GETPRIORITY
#define HAVE_SIGPROCMASK 1
#define HAVE_SIGACTION 1
#define HAVE__SETJMP 1
#define HAVE_SETSID 1
#define HAVE_TELLDIR 1
#define HAVE_SEEKDIR 1
#define HAVE_MKTIME 1
#define HAVE_COSH 1
#define HAVE_SINH 1
#define HAVE_TANH 1
#define HAVE_SETUID 1
#define HAVE_SETGID 1
#define HAVE_TZNAME 1
#define HAVE_DAYLIGHT 1
#define NEGATIVE_TIME_T 1
#define POSIX_SIGNAL 1
#define GETPGRP_VOID 1
#define SETPGRP_VOID 1
#define WORDS_BIGENDIAN 1
#define __CHAR_UNSIGNED__ 1
#ifndef __cplusplus
#define inline
#endif
#define RSHIFT(x,y) ((x)>>(int)y)
#define FILE_COUNT _cnt
#define FILE_READPTR _ptr
#define NEED_IO_SEEK_BETWEEN_RW 1
#define STACK_GROW_DIRECTION -1
#define DEFAULT_KCODE KCODE_NONE
#define USE_ELF 1
#define DLEXT ".so"
#define RUBY_LIB "/usr/local/lib/ruby/1.8"
#define RUBY_SITE_LIB "/usr/local/lib/ruby/site_ruby"
#define RUBY_SITE_LIB2 "/usr/local/lib/ruby/site_ruby/1.8"
#define RUBY_PLATFORM "nsr-nsk"
#define RUBY_ARCHLIB "/usr/local/lib/ruby/1.8/nsr-nsk"
#define RUBY_SITE_ARCHLIB "/usr/local/lib/ruby/site_ruby/1.8/nsr-nsk"


(e-mail address removed)
 
N

nobu.nokada

Hi,

At Thu, 12 May 2005 09:45:28 +0900,
I'm getting unresolved symbols from the linker related to the dl
(dynamic loading ??) module:

ld -L . -L ../.. -o dl.so dl.o handle.o ptr.o sym.o
-llibruby-static.a

Does NonStop server support dynamic loading? Anyway, show the
mkmf.log too.
 
M

me2faster

Hi,

Yes it does, and I can build those load files appropriately, but I need
to first get access to the source that has the definitions of the dl*
functions. Here's the 'mkmf.log':

"/usr/bin/c89 -E -I/home/ruby-1.8.2 -I../../. -I. -g conftest.c -o
conftest.i"
../lib/mkmf.rb:187: warning: Insecure world writable dir /home, mode
040777

#error int not needed
^
"/home/ruby-1.8.2/ext/dl/conftest.c", line 3: error(1007): #error
directive: int not needed


1 error detected in the compilation of "conftest.c".
c89: exited, returning 2.
checked program was:
/* begin */
#include "config.h"
#if SIZEOF_INT == SIZEOF_LONG
#error int not needed
#endif
/* end */

"/usr/bin/c89 -E -I/home/ruby-1.8.2 -I../../. -I. -g conftest.c -o
conftest.i"
../lib/mkmf.rb:187: warning: Insecure world writable dir /home, mode
040777

checked program was:
/* begin */
#include "config.h"
#if SIZEOF_FLOAT == SIZEOF_DOUBLE
#error float not needed
#endif
/* end */

"/usr/bin/c89 -E -I/home/ruby-1.8.2 -I../../. -I. -g conftest.c -o
conftest.i"
../lib/mkmf.rb:187: warning: Insecure world writable dir /home, mode
040777

#error void* not needed
^
"/home/ruby-1.8.2/ext/dl/conftest.c", line 3: error(1007): #error
directive: void* not needed


1 error detected in the compilation of "conftest.c".
c89: exited, returning 2.
checked program was:
/* begin */
#include "config.h"
#if SIZEOF_VOIDP == SIZEOF_INT || SIZEOF_VOIDP == SIZEOF_LONG
#error void* not needed
#endif
/* end */

have_header: checking for windows.h... -------------------- no

"/usr/bin/c89 -E -I/home/ruby-1.8.2 -I../../. -I. -g conftest.c -o
conftest.i"
../lib/mkmf.rb:187: warning: Insecure world writable dir /home, mode
040777

#include <windows.h>
^
"/home/ruby-1.8.2/ext/dl/conftest.c", line 1: error(1003): could not
open source file "windows.h"


1 catastrophic error detected in the compilation of "conftest.c".
Compilation terminated.
c89: exited, returning 4.
checked program was:
/* begin */
#include <windows.h>
/* end */

--------------------

have_header: checking for dlfcn.h... -------------------- yes

"/usr/bin/c89 -E -I/home/ruby-1.8.2 -I../../. -I. -g conftest.c -o
conftest.i"
../lib/mkmf.rb:187: warning: Insecure world writable dir /home, mode
040777

checked program was:
/* begin */
#include <dlfcn.h>
/* end */

--------------------

have_library: checking for main() in -ldl... -------------------- no

"/usr/bin/c89 -o conftest -I/home/ruby-1.8.2 -I../../. -I. -g
conftest.c -L'/home/ruby-1.8.2' -lruby-static -ldl "


**** FATAL ERROR **** [1083] - linker halting:
Cannot find dl, given in -l option.

No output file created.

1 error reported.
No warnings reported.
No informational messages reported.
1 informational message suppressed.
Elapsed Time: 00:00:00
c89: exited, returning 1.
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { main(); return 0; }
/* end */

"/usr/bin/c89 -o conftest -I/home/ruby-1.8.2 -I../../. -I. -g
conftest.c -L'/home/ruby-1.8.2' -lruby-static -ldl "


**** FATAL ERROR **** [1083] - linker halting:
Cannot find dl, given in -l option.

No output file created.

1 error reported.
No warnings reported.
No informational messages reported.
1 informational message suppressed.
Elapsed Time: 00:00:00
c89: exited, returning 1.
checked program was:
/* begin */


/*top*/
int main() { return 0; }
int t() { void ((*volatile p)()); p = (void ((*)()))main; return 0; }
/* end */

--------------------

have_func: checking for dlopen()... -------------------- no

"/usr/bin/c89 -o conftest -I/home/ruby-1.8.2 -I../../. -I. -g
conftest.c -L'/home/ruby-1.8.2' -lruby-static "
int t() { dlopen(); return 0; }
^
"/home/ruby-1.8.2/ext/dl/conftest.c", line 4: warning(304): function "
dlopen" declared implicitly




**** ERROR **** [1210]:
conftest.o: In function `t':
conftest.o(.text._142747656+0x12): unresolved reference to dlopen.

No output file created.

1 error reported.
No warnings reported.
No informational messages reported.
12 informational messages suppressed.
Elapsed Time: 00:00:00
c89: exited, returning 1.
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { dlopen(); return 0; }
/* end */

"/usr/bin/c89 -o conftest -I/home/ruby-1.8.2 -I../../. -I. -g
conftest.c -L'/home/ruby-1.8.2' -lruby-static "
int t() { void ((*volatile p)()); p = (void ((*)()))dlopen; return 0;
}
^
"/home/ruby-1.8.2/ext/dl/conftest.c", line 5: error(114): identifier
"dlopen" is undefined


1 error detected in the compilation of "conftest.c".
c89: exited, returning 2.
checked program was:
/* begin */


/*top*/
int main() { return 0; }
int t() { void ((*volatile p)()); p = (void ((*)()))dlopen; return 0; }
/* end */

--------------------

have_func: checking for dlclose()... -------------------- no

"/usr/bin/c89 -o conftest -I/home/ruby-1.8.2 -I../../. -I. -g
conftest.c -L'/home/ruby-1.8.2' -lruby-static "
int t() { dlclose(); return 0; }
^
"/home/ruby-1.8.2/ext/dl/conftest.c", line 4: warning(304): function "
dlclose" declared implicitly




**** ERROR **** [1210]:
conftest.o: In function `t':
conftest.o(.text._142747656+0x12): unresolved reference to dlclose.

No output file created.

1 error reported.
No warnings reported.
No informational messages reported.
12 informational messages suppressed.
Elapsed Time: 00:00:01
c89: exited, returning 1.
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { dlclose(); return 0; }
/* end */

"/usr/bin/c89 -o conftest -I/home/ruby-1.8.2 -I../../. -I. -g
conftest.c -L'/home/ruby-1.8.2' -lruby-static "
int t() { void ((*volatile p)()); p = (void ((*)()))dlclose; return
0; }
^
"/home/ruby-1.8.2/ext/dl/conftest.c", line 5: error(114): identifier
"dlclose" is undefined


1 error detected in the compilation of "conftest.c".
c89: exited, returning 2.
checked program was:
/* begin */


/*top*/
int main() { return 0; }
int t() { void ((*volatile p)()); p = (void ((*)()))dlclose; return 0;
}
/* end */

--------------------

have_func: checking for dlsym()... -------------------- no

"/usr/bin/c89 -o conftest -I/home/ruby-1.8.2 -I../../. -I. -g
conftest.c -L'/home/ruby-1.8.2' -lruby-static "
int t() { dlsym(); return 0; }
^
"/home/ruby-1.8.2/ext/dl/conftest.c", line 4: warning(304): function "
dlsym" declared implicitly




**** ERROR **** [1210]:
conftest.o: In function `t':
conftest.o(.text._142747656+0x12): unresolved reference to dlsym.

No output file created.

1 error reported.
No warnings reported.
No informational messages reported.
12 informational messages suppressed.
Elapsed Time: 00:00:01
c89: exited, returning 1.
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { dlsym(); return 0; }
/* end */

"/usr/bin/c89 -o conftest -I/home/ruby-1.8.2 -I../../. -I. -g
conftest.c -L'/home/ruby-1.8.2' -lruby-static "
int t() { void ((*volatile p)()); p = (void ((*)()))dlsym; return 0;
}
^
"/home/ruby-1.8.2/ext/dl/conftest.c", line 5: error(114): identifier
"dlsym" is undefined


1 error detected in the compilation of "conftest.c".
c89: exited, returning 2.
checked program was:
/* begin */


/*top*/
int main() { return 0; }
int t() { void ((*volatile p)()); p = (void ((*)()))dlsym; return 0; }
/* end */

--------------------

have_func: checking for dlerror()... -------------------- no

"/usr/bin/c89 -o conftest -I/home/ruby-1.8.2 -I../../. -I. -g
conftest.c -L'/home/ruby-1.8.2' -lruby-static "
int t() { dlerror(); return 0; }
^
"/home/ruby-1.8.2/ext/dl/conftest.c", line 4: warning(304): function "
dlerror" declared implicitly




**** ERROR **** [1210]:
conftest.o: In function `t':
conftest.o(.text._142747656+0x12): unresolved reference to dlerror.

No output file created.

1 error reported.
No warnings reported.
No informational messages reported.
12 informational messages suppressed.
Elapsed Time: 00:00:01
c89: exited, returning 1.
checked program was:
/* begin */

/*top*/
int main() { return 0; }
int t() { dlerror(); return 0; }
/* end */

"/usr/bin/c89 -o conftest -I/home/ruby-1.8.2 -I../../. -I. -g
conftest.c -L'/home/ruby-1.8.2' -lruby-static "
int t() { void ((*volatile p)()); p = (void ((*)()))dlerror; return
0; }
^
"/home/ruby-1.8.2/ext/dl/conftest.c", line 5: error(114): identifier
"dlerror" is undefined


1 error detected in the compilation of "conftest.c".
c89: exited, returning 2.
checked program was:
/* begin */


/*top*/
int main() { return 0; }
int t() { void ((*volatile p)()); p = (void ((*)()))dlerror; return 0;
}
/* end */
 
N

Nakada, Nobuyoshi

Hi,

At Fri, 13 May 2005 05:20:30 +0900,
have_header: checking for dlfcn.h... -------------------- yes

It seems to be supported certainly.
have_library: checking for main() in -ldl... -------------------- no

"/usr/bin/c89 -o conftest -I/home/ruby-1.8.2 -I../../. -I. -g
conftest.c -L'/home/ruby-1.8.2' -lruby-static -ldl "


**** FATAL ERROR **** [1083] - linker halting:
Cannot find dl, given in -l option.

But other library seems required to use dlopen(). Can't you find any
description in man pages or else?
 
N

nobu.nokada

Hi,

At Tue, 17 May 2005 04:15:31 +0900,
It's 'zrlddll'.

Then, this patch works?


Index: ext/dl/extconf.rb
===================================================================
RCS file: /cvs/ruby/src/ruby/ext/dl/extconf.rb,v
retrieving revision 1.12
diff -U2 -p -r1.12 extconf.rb
--- ext/dl/extconf.rb 8 Nov 2003 04:48:35 -0000 1.12
+++ ext/dl/extconf.rb 16 May 2005 23:20:14 -0000
@@ -137,6 +137,5 @@ end
if( have_header("dlfcn.h") )
dlc_define("HAVE_DLFCN_H")
- have_library("dl")
- have_func("dlopen")
+ %w"dl zrlddll".find {|dl| have_library(dl, "dlopen")} or exit
have_func("dlclose")
have_func("dlsym")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top