How to link to libdl under linux

MrSmith mrsmith33 at yandex.ru
Tue Dec 17 07:52:10 PST 2013


Eventually i have lot of time to answer.

Here is what 'find' emits:

andrey at andress-ubuntu:~/anchovy$ find /lib /lib32 /usr/lib 
/usr/lib32 -name "libdl*.so*" -type f -exec file {} ";"
/lib/i386-linux-gnu/libdl-2.17.so: ELF 32-bit LSB shared object, 
Intel 80386, version 1 (SYSV), dynamically linked (uses shared 
libs), BuildID[sha1]=0x37b128aa3fc5f9e2078059787463f6bb611b03d2, 
for GNU/Linux 2.6.24, stripped
/lib/x86_64-linux-gnu/libdl-2.17.so: ELF 64-bit LSB shared 
object, x86-64, version 1 (SYSV), dynamically linked (uses shared 
libs), BuildID[sha1]=0xa39d9d93eb46ba4511ee1a8971d5f90b1e67d999, 
for GNU/Linux 2.6.24, stripped
/lib32/libdl-2.17.so: ELF 32-bit LSB shared object, Intel 80386, 
version 1 (SYSV), dynamically linked (uses shared libs), 
BuildID[sha1]=0x686964642d380ed673813bc5f421eed8cb7de32b, for 
GNU/Linux 2.6.24, stripped
/usr/lib/libreoffice/program/libdlgprovlo.so: ELF 64-bit LSB 
shared object, x86-64, version 1 (SYSV), dynamically linked, 
BuildID[sha1]=0xfb0d088f0da1219a0c5590beb9db9873cf5d1177, stripped
/usr/lib/debug/lib/x86_64-linux-gnu/libdl-2.17.so: ELF 64-bit LSB 
shared object, x86-64, version 1 (SYSV), dynamically linked (uses 
shared libs), 
BuildID[sha1]=0xa39d9d93eb46ba4511ee1a8971d5f90b1e67d999, for 
GNU/Linux 2.6.24, not stripped


Here i use verbose linking:

andrey at andress-ubuntu:~/anchovy$  dmd -debug -gc -m32 
"examples/fpshelper.d" "examples/main.d" -I"import"   
-I"deps/dlib" -I"deps/derelict-fi-master/source" 
-I"deps/derelict-sdl2-master/source" 
-I"deps/derelict-ft-master/source" 
-I"deps/derelict-gl3-master/source" 
-I"deps/derelict-glfw3-master/source" 
-I"deps/derelict-util-1.0.0/source" "lib/debug/libgui.a" 
"lib/debug/libgraphics.a" "lib/debug/libcore.a" 
"lib/debug/libutils.a" "deps/dlib/libdlib.a" 
"deps/derelict-fi-master/lib/libDerelictFI.a" 
"deps/derelict-ft-master/lib/libDerelictFT.a" 
"deps/derelict-gl3-master/lib/libDerelictGL3.a" 
"deps/derelict-glfw3-master/lib/libDerelictGLFW3.a" 
"deps/derelict-util-1.0.0/lib/libDerelictUtil.a" -L--verbose 
-L-ldl -of"bin/guidemo" > link.txt
deps/derelict-fi-master/lib/libDerelictFI.a(sharedlib_416_4ee.o): 
In function `_D8derelict4util9sharedlib13LoadSharedLibFAyaZPv':
/home/andrey/anchovy/deps/derelict-fi-master/../../../.dub/packages/derelict-util-1.0.0/source/derelict/util/sharedlib.d:60: 
undefined reference to `dlopen'
deps/derelict-fi-master/lib/libDerelictFI.a(sharedlib_417_5d1.o): 
In function `_D8derelict4util9sharedlib15UnloadSharedLibFPvZv':
/home/andrey/anchovy/deps/derelict-fi-master/../../../.dub/packages/derelict-util-1.0.0/source/derelict/util/sharedlib.d:64: 
undefined reference to `dlclose'
deps/derelict-fi-master/lib/libDerelictFI.a(sharedlib_418_396.o): 
In function `_D8derelict4util9sharedlib9GetSymbolFPvAyaZPv':
/home/andrey/anchovy/deps/derelict-fi-master/../../../.dub/packages/derelict-util-1.0.0/source/derelict/util/sharedlib.d:68: 
undefined reference to `dlsym'
deps/derelict-fi-master/lib/libDerelictFI.a(sharedlib_419_463.o): 
In function `_D8derelict4util9sharedlib11GetErrorStrFZAya':
/home/andrey/anchovy/deps/derelict-fi-master/../../../.dub/packages/derelict-util-1.0.0/source/derelict/util/sharedlib.d:72: 
undefined reference to `dlerror'
collect2: error: ld returned 1 exit status

and here is content of link.txt http://pastebin.com/G3vyt345


More information about the Digitalmars-d-learn mailing list