Re: Problems linking libdl?
On 02/20/2012 10:33 PM, simendsjo wrote: On Mon, 20 Feb 2012 22:26:58 +0100, Mike Wey wrote: On 02/20/2012 09:49 PM, simendsjo wrote: On Mon, 20 Feb 2012 21:41:45 +0100, simendsjo wrote: I've tried the following using dmd 58 and trunk - both -m64 on kubuntu. Any idea what I'm doing wrong? import std.loader; void main(string[] args) { auto res = ExeModule_Init(); assert(res == 0); scope(exit) ExeModule_Uninit(); auto mod = ExeModule_Load("./libtcod.so"); } $ dmd-trunk -v -L-ldl so.d gcc so.o -o so -m64 -ldl -Xlinker -L/home/simendsjo/code/dmd-trunk/build/lib64 -Xlinker -L/home/simendsjo/code/dmd-trunk/build/lib -Xlinker --no-warn-search-mismatch -Xlinker --export-dynamic -lphobos2 -lpthread -lm -lrt I get the same error using gdc-4.6 The problem is that -ldl should appear after -lphobos2 in the arguments passed to gcc. Ok, that removed the error (although I got another). But how can I specify this when I run dmd or gdc? dmd and gdc adds -L options before phobos... The last time this problem came up in the newsgroup, with librt, it was moved from the configuration file into the compiler, so now it's hardcoded. You could try passing -L--start-group before -L-ldl it should cause ld to recursively search for the symbols. Unfortunately i can't test this on my system. -- Mike Wey
Re: Problems linking libdl?
On Mon, 20 Feb 2012 22:26:58 +0100, Mike Wey wrote: On 02/20/2012 09:49 PM, simendsjo wrote: On Mon, 20 Feb 2012 21:41:45 +0100, simendsjo wrote: I've tried the following using dmd 58 and trunk - both -m64 on kubuntu. Any idea what I'm doing wrong? import std.loader; void main(string[] args) { auto res = ExeModule_Init(); assert(res == 0); scope(exit) ExeModule_Uninit(); auto mod = ExeModule_Load("./libtcod.so"); } $ dmd-trunk -v -L-ldl so.d gcc so.o -o so -m64 -ldl -Xlinker -L/home/simendsjo/code/dmd-trunk/build/lib64 -Xlinker -L/home/simendsjo/code/dmd-trunk/build/lib -Xlinker --no-warn-search-mismatch -Xlinker --export-dynamic -lphobos2 -lpthread -lm -lrt I get the same error using gdc-4.6 The problem is that -ldl should appear after -lphobos2 in the arguments passed to gcc. Ok, that removed the error (although I got another). But how can I specify this when I run dmd or gdc? dmd and gdc adds -L options before phobos...
Re: Problems linking libdl?
On 02/20/2012 09:49 PM, simendsjo wrote: On Mon, 20 Feb 2012 21:41:45 +0100, simendsjo wrote: I've tried the following using dmd 58 and trunk - both -m64 on kubuntu. Any idea what I'm doing wrong? import std.loader; void main(string[] args) { auto res = ExeModule_Init(); assert(res == 0); scope(exit) ExeModule_Uninit(); auto mod = ExeModule_Load("./libtcod.so"); } $ dmd-trunk -v -L-ldl so.d gcc so.o -o so -m64 -ldl -Xlinker -L/home/simendsjo/code/dmd-trunk/build/lib64 -Xlinker -L/home/simendsjo/code/dmd-trunk/build/lib -Xlinker --no-warn-search-mismatch -Xlinker --export-dynamic -lphobos2 -lpthread -lm -lrt I get the same error using gdc-4.6 The problem is that -ldl should appear after -lphobos2 in the arguments passed to gcc. -- Mike Wey
Re: Problems linking libdl?
On Mon, 20 Feb 2012 21:41:45 +0100, simendsjo wrote: I've tried the following using dmd 58 and trunk - both -m64 on kubuntu. Any idea what I'm doing wrong? import std.loader; void main(string[] args) { auto res = ExeModule_Init(); assert(res == 0); scope(exit) ExeModule_Uninit(); auto mod = ExeModule_Load("./libtcod.so"); } $ dmd-trunk -v -L-ldl so.d gcc so.o -o so -m64 -ldl -Xlinker -L/home/simendsjo/code/dmd-trunk/build/lib64 -Xlinker -L/home/simendsjo/code/dmd-trunk/build/lib -Xlinker --no-warn-search-mismatch -Xlinker --export-dynamic -lphobos2 -lpthread -lm -lrt /home/simendsjo/code/dmd-trunk/build/lib64/libphobos2.a(loader_ad5_5c6.o): In function `_D3std6loader15ExeModule_Load_FxAyaZPv': std/loader.d:(.text._D3std6loader15ExeModule_Load_FxAyaZPv+0x69): undefined reference to `dlopen' /home/simendsjo/code/dmd-trunk/build/lib64/libphobos2.a(loader_ad2_567.o): In function `_D3std6loader13record_error_FZv': std/loader.d:(.text._D3std6loader13record_error_FZv+0x7): undefined reference to `dlerror' /home/simendsjo/code/dmd-trunk/build/lib64/libphobos2.a(loader_ad7_707.o): In function `_D3std6loader18ExeModule_Release_FKPvZv': std/loader.d:(.text._D3std6loader18ExeModule_Release_FKPvZv+0x31): undefined reference to `dlclose' /home/simendsjo/code/dmd-trunk/build/lib64/libphobos2.a(loader_ad8_7dc.o): In function `_D3std6loader20ExeModule_GetSymbol_FKPvxAyaZPv': std/loader.d:(.text._D3std6loader20ExeModule_GetSymbol_FKPvxAyaZPv+0x2a): undefined reference to `dlsym' collect2: ld returned 1 exit status --- errorlevel 1 $ locate libdl (...) /lib/x86_64-linux-gnu/libdl-2.13.so /lib/x86_64-linux-gnu/libdl.so.2 /lib32/libdl-2.13.so /lib32/libdl.so.2 /usr/lib/x86_64-linux-gnu/libdl.a /usr/lib/x86_64-linux-gnu/libdl.so /usr/lib32/libdl.a /usr/lib32/libdl.so (...) I get the same error using gdc-4.6
Problems linking libdl?
I've tried the following using dmd 58 and trunk - both -m64 on kubuntu. Any idea what I'm doing wrong? import std.loader; void main(string[] args) { auto res = ExeModule_Init(); assert(res == 0); scope(exit) ExeModule_Uninit(); auto mod = ExeModule_Load("./libtcod.so"); } $ dmd-trunk -v -L-ldl so.d gcc so.o -o so -m64 -ldl -Xlinker -L/home/simendsjo/code/dmd-trunk/build/lib64 -Xlinker -L/home/simendsjo/code/dmd-trunk/build/lib -Xlinker --no-warn-search-mismatch -Xlinker --export-dynamic -lphobos2 -lpthread -lm -lrt /home/simendsjo/code/dmd-trunk/build/lib64/libphobos2.a(loader_ad5_5c6.o): In function `_D3std6loader15ExeModule_Load_FxAyaZPv': std/loader.d:(.text._D3std6loader15ExeModule_Load_FxAyaZPv+0x69): undefined reference to `dlopen' /home/simendsjo/code/dmd-trunk/build/lib64/libphobos2.a(loader_ad2_567.o): In function `_D3std6loader13record_error_FZv': std/loader.d:(.text._D3std6loader13record_error_FZv+0x7): undefined reference to `dlerror' /home/simendsjo/code/dmd-trunk/build/lib64/libphobos2.a(loader_ad7_707.o): In function `_D3std6loader18ExeModule_Release_FKPvZv': std/loader.d:(.text._D3std6loader18ExeModule_Release_FKPvZv+0x31): undefined reference to `dlclose' /home/simendsjo/code/dmd-trunk/build/lib64/libphobos2.a(loader_ad8_7dc.o): In function `_D3std6loader20ExeModule_GetSymbol_FKPvxAyaZPv': std/loader.d:(.text._D3std6loader20ExeModule_GetSymbol_FKPvxAyaZPv+0x2a): undefined reference to `dlsym' collect2: ld returned 1 exit status --- errorlevel 1 $ locate libdl (...) /lib/x86_64-linux-gnu/libdl-2.13.so /lib/x86_64-linux-gnu/libdl.so.2 /lib32/libdl-2.13.so /lib32/libdl.so.2 /usr/lib/x86_64-linux-gnu/libdl.a /usr/lib/x86_64-linux-gnu/libdl.so /usr/lib32/libdl.a /usr/lib32/libdl.so (...)