cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-library Mailing List Archives

undefined reference to `dlsym'

From: David Byron <dbyron_at_dbyron.com>
Date: Fri, 30 Oct 2009 13:17:13 -0700

I'm trying to configure and build libcurl and curl from the 7.19.6 tarball
and have run into a couple of errors like this:

dso_dlfcn.c:(.text+0x2b4): undefined reference to `dlsym'

The first place I ran into them was during configure. Here's an excerpt
from config.log:

configure:24344: checking for SSL_connect in -lssl
configure:24376: gcc -o conftest -g0 -O2 -Wno-system-headers
-I<ssl_path>/openssl/include -I<ssl_path>/include/openssl
-L<ssl_path>/openssl/lib conftest.c -lssl -lcrypto -lrt >&5
<ssl_path>/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_func':
dso_dlfcn.c:(.text+0x2b4): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x361): undefined reference to `dlerror'
<ssl_path>/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_var':
dso_dlfcn.c:(.text+0x3d4): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x481): undefined reference to `dlerror'
<ssl_path>/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_unload':
dso_dlfcn.c:(.text+0x4dd): undefined reference to `dlclose'
<ssl_path>lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_load':
dso_dlfcn.c:(.text+0x592): undefined reference to `dlopen'
dso_dlfcn.c:(.text+0x5fb): undefined reference to `dlclose'
dso_dlfcn.c:(.text+0x623): undefined reference to `dlerror'
collect2: ld returned 1 exit status
configure:24383: $? = 1

Here are my arguments to configure from config.log

  $ <abs_path_to>/curl/configure --prefix=<some_path>
--libdir=${prefix}/lib/Release --bindir=${prefix}/bin/Release
--enable-shared=no --disable-manual --disable-ftp --disable-ldap
--disable-file --disable-dict --disable-telnet --with-ssl=<ssl_path>
--with-zlib=<zlib_path>

ssl_path is a path where I installed openssl 0.9.8k that I built myself. I
(tried to) only build a static version of openssl, which is to say when I
built it, I passed no-shared to the config script.

I was able to fix the configure test with this patch:

Index: configure.ac
===================================================================
--- configure.ac (revision 85)
+++ configure.ac (working copy)
@@ -1229,7 +1229,7 @@
     dnl This is only reasonable to do if crypto actually is there: check
for
     dnl SSL libs NOTE: it is important to do this AFTER the crypto lib

- AC_CHECK_LIB(ssl, SSL_connect)
+ AC_CHECK_LIB(ssl, SSL_connect, [], [], [-ldl])

     if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
         dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff

With this, configure completes and seems to work. It's probably not the
right fix. Even so, I get the same errors later on:

...src> make
make all-am
make[1]: Entering directory `...src'
/bin/sh ../libtool --tag=CC --mode=link gcc -g0 -O2 -Wno-system-headers
-L<ssl_path>/lib -L<prefix>/lib -o curl main.o hugehelp.o urlglob.o
writeout.o writeenv.o getpass.o homedir.o curlutil.o os-specific.o
strtoofft.o strdup.o rawstr.o nonblock.o ../lib/libcurl.la -lz
libtool: link: gcc -g0 -O2 -Wno-system-headers -o curl main.o hugehelp.o
urlglob.o writeout.o writeenv.o getpass.o homedir.o curlutil.o os-specific.o
strtoofft.o strdup.o rawstr.o nonblock.o -L<ssl_path>/lib -L<prefix>/lib
../lib/.libs/libcurl.a /usr/lib64/libidn.so -lssl -lcrypto -lrt -lz
<ssl_path>/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_func':
dso_dlfcn.c:(.text+0x2b4): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x361): undefined reference to `dlerror'
<ssl_path>/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_var':
dso_dlfcn.c:(.text+0x3d4): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x481): undefined reference to `dlerror'
<ssl_path>/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_unload':
dso_dlfcn.c:(.text+0x4dd): undefined reference to `dlclose'
<ssl_path>/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_load':
dso_dlfcn.c:(.text+0x592): undefined reference to `dlopen'
dso_dlfcn.c:(.text+0x5fb): undefined reference to `dlclose'
dso_dlfcn.c:(.text+0x623): undefined reference to `dlerror'
collect2: ld returned 1 exit status
make[1]: *** [curl] Error 1
make[1]: Leaving directory `...src'
make: *** [all] Error 2

I haven't figured out a good way to add "-ldl" to CURL_LIBS, or in some
other way get the curl app to link.

Have I built openssl incorrectly? Am I on the right track here? Can I
provide more information about this to help figure it out?

Thanks much.

-DB

$ uname -a
Linux tuneup 2.6.18.2-34-default #1 SMP Mon Nov 27 11:46:27 UTC 2006 x86_64
x86_64 x86_64 GNU/Linux

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-10-30

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET