Jump to page: 1 2
Thread overview
How to link to libdl under linux
Dec 15, 2013
MrSmith
Dec 16, 2013
Danny Arends
Dec 16, 2013
Jacob Carlborg
Dec 16, 2013
MrSmith
Dec 16, 2013
Mike Parker
Dec 16, 2013
MrSmith
Dec 16, 2013
Mike Parker
Dec 16, 2013
Marco Leise
Dec 17, 2013
MrSmith
Dec 19, 2013
MrSmith
Dec 19, 2013
Jacob Carlborg
Dec 19, 2013
MrSmith
Dec 19, 2013
MrSmith
Dec 19, 2013
Xavier Bigand
Dec 20, 2013
MrSmith
December 15, 2013
I am trying to compile my program which uses derelict under ubuntu 13.10. DerelictUtil needs access to dl library. Simply providing libdl.a as parameter to compiler doesn't work.

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: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib32/libdl.a(dlopen.o): In function `dlopen':
(.text+0x1b): undefined reference to `__dlopen'
/usr/lib32/libdl.a(dlclose.o): In function `dlclose':
(.text+0x1): undefined reference to `__dlclose'
/usr/lib32/libdl.a(dlsym.o): In function `dlsym':
(.text+0x1b): undefined reference to `__dlsym'
/usr/lib32/libdl.a(dlerror.o): In function `dlerror':
(.text+0x1): undefined reference to `__dlerror'
collect2: error: ld returned 1 exit status
--- errorlevel 1
December 16, 2013
On Sunday, 15 December 2013 at 21:38:37 UTC, MrSmith wrote:
> I am trying to compile my program which uses derelict under ubuntu 13.10. DerelictUtil needs access to dl library. Simply providing libdl.a as parameter to compiler doesn't work.
>
> 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: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
> /usr/lib32/libdl.a(dlopen.o): In function `dlopen':
> (.text+0x1b): undefined reference to `__dlopen'
> /usr/lib32/libdl.a(dlclose.o): In function `dlclose':
> (.text+0x1): undefined reference to `__dlclose'
> /usr/lib32/libdl.a(dlsym.o): In function `dlsym':
> (.text+0x1b): undefined reference to `__dlsym'
> /usr/lib32/libdl.a(dlerror.o): In function `dlerror':
> (.text+0x1): undefined reference to `__dlerror'
> collect2: error: ld returned 1 exit status
> --- errorlevel 1

Pass it depending if you use rdmd or dmd

-L-ldl

or

-ldl

Gr,
Danny Arends
http://www.dannyarends.nl
December 16, 2013
On 2013-12-16 01:54, Danny Arends wrote:

> Pass it depending if you use rdmd or dmd
>
> -L-ldl
>
> or
>
> -ldl

It's -L-ldl regardless of it's rdmd or dmd.

-- 
/Jacob Carlborg
December 16, 2013
On Monday, 16 December 2013 at 07:36:12 UTC, Jacob Carlborg wrote:
> On 2013-12-16 01:54, Danny Arends wrote:
>
>> Pass it depending if you use rdmd or dmd
>>
>> -L-ldl
>>
>> or
>>
>> -ldl
>
> It's -L-ldl regardless of it's rdmd or dmd.

now i'm getting this error:

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
--- errorlevel 1
December 16, 2013
On 12/16/2013 6:55 PM, MrSmith wrote:
> On Monday, 16 December 2013 at 07:36:12 UTC, Jacob Carlborg wrote:

>
> now i'm getting this error:
>
> 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
> --- errorlevel 1

You're still not linking ld properly. It would help tremendously if you could show the command line you're using. Otherwise all people can do is make guesses about what *might* be wrong.
December 16, 2013
> You're still not linking ld properly. It would help tremendously if you could show the command line you're using. Otherwise all people can do is make guesses about what *might* be wrong.

Oh, right.
Here is first with "/usr/lib32/libdl.a" -L-ldl

andrey@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" "/usr/lib32/libdl.a" -L-ldl -of"bin/guidemo"

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: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib32/libdl.a(dlopen.o): In function `dlopen':
(.text+0x1b): undefined reference to `__dlopen'
/usr/lib32/libdl.a(dlclose.o): In function `dlclose':
(.text+0x1): undefined reference to `__dlclose'
/usr/lib32/libdl.a(dlsym.o): In function `dlsym':
(.text+0x1b): undefined reference to `__dlsym'
/usr/lib32/libdl.a(dlerror.o): In function `dlerror':
(.text+0x1): undefined reference to `__dlerror'
collect2: error: ld returned 1 exit status
--- errorlevel 1

Second with -L-ldl only

andrey@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-ldl -of"bin/guidemo"

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
--- errorlevel 1
December 16, 2013
On 12/16/2013 7:09 PM, MrSmith wrote:
>> You're still not linking ld properly. It would help tremendously if
>> you could show the command line you're using. Otherwise all people can
>> do is make guesses about what *might* be wrong.
>
> Oh, right.
> Here is first with "/usr/lib32/libdl.a" -L-ldl
>
> andrey@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" "/usr/lib32/libdl.a"
> -L-ldl -of"bin/guidemo"
>
> 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:
> warning: Using 'dlopen' in statically linked applications requires at
> runtime the shared libraries from the glibc version used for linking
> /usr/lib32/libdl.a(dlopen.o): In function `dlopen':
> (.text+0x1b): undefined reference to `__dlopen'
> /usr/lib32/libdl.a(dlclose.o): In function `dlclose':
> (.text+0x1): undefined reference to `__dlclose'
> /usr/lib32/libdl.a(dlsym.o): In function `dlsym':
> (.text+0x1b): undefined reference to `__dlsym'
> /usr/lib32/libdl.a(dlerror.o): In function `dlerror':
> (.text+0x1): undefined reference to `__dlerror'
> collect2: error: ld returned 1 exit status
> --- errorlevel 1
>
> Second with -L-ldl only
>
> andrey@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-ldl -of"bin/guidemo"
>
> 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
> --- errorlevel 1

For starters, remove "/usr/lib32/libdl.a". All you need is -L-ldl. The -L flag tells DMD that what follows needs to be passed to the linker. -ldl tells the linker to link with libdl. It will link with the shared version, which is really what you want. As it stands, you're telling DMD to link with both the static version of libdl (which you don't have installed, I think, according to the error in your original post) and the shared version at the same time. I don't know if that's the source of your current linker errors, but it's certainly potentially problematic.

Also, since you aren't using dub to manage your project, I suggest you copy all of the Derelict libraries to a common location. Then, you can remove all of the "*/libDerelict*.a" from the command line and do this instead:

-L-Lpath/to/libs -L-lDerelictFI -L-lDerelictGL3...

On the other hand, if you use dub to manage your project, all of this, including libdl, will be linked in for you automatically. Then your command line becomes:

dub build

during development and

dub build --build=release

when you're ready for the release version.
December 16, 2013
Am Mon, 16 Dec 2013 11:09:52 +0100
schrieb "MrSmith" <mrsmith33@yandex.ru>:

> > You're still not linking ld properly. It would help tremendously if you could show the command line you're using. Otherwise all people can do is make guesses about what *might* be wrong.
> 
> Oh, right.
> Here is first with "/usr/lib32/libdl.a" -L-ldl
> 
> andrey@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" "/usr/lib32/libdl.a" -L-ldl -of"bin/guidemo"
> 
> 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:
> warning: Using 'dlopen' in statically linked applications
> requires at runtime the shared libraries from the glibc version
> used for linking
> /usr/lib32/libdl.a(dlopen.o): In function `dlopen':
> (.text+0x1b): undefined reference to `__dlopen'
> /usr/lib32/libdl.a(dlclose.o): In function `dlclose':
> (.text+0x1): undefined reference to `__dlclose'
> /usr/lib32/libdl.a(dlsym.o): In function `dlsym':
> (.text+0x1b): undefined reference to `__dlsym'
> /usr/lib32/libdl.a(dlerror.o): In function `dlerror':
> (.text+0x1): undefined reference to `__dlerror'
> collect2: error: ld returned 1 exit status
> --- errorlevel 1
> 
> Second with -L-ldl only
> 
> andrey@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-ldl -of"bin/guidemo"
> 
> 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
> --- errorlevel 1

Do you have the 32-bit version of libdl installed?
What does this command output?:

  find /lib /lib32 /usr/lib /usr/lib32 -name "libdl*.so*"
  -type f -exec file {} ";"

For me it prints

 /lib32/libdl-2.15.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped

so there is a libdl for 32-bit in /lib32.
If you have one as well, you'll probably need to call the
linker with the verbose option:

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"

By the way, can you recompile everything in 64-bit or do you have a 32-only system. In that case you don't require the -m32 flag.

-- 
Marco

December 17, 2013
Eventually i have lot of time to answer.

Here is what 'find' emits:

andrey@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@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
December 19, 2013
Still need help. I've tried compiling a little test project with dub and it compiled. Then i tried to compile it by hand and got the same error.
I think there is some issue in my command with parameter ordering.

Here is test project

module test;

import derelict.glfw3.glfw3;
import std.stdio;

void main() {
	DerelictGLFW3.load();
	writeln("test");
}

with package

{
	"targetName": "test",
	"dependencies": {
		"derelict-glfw3": "~master"
	},
	"targetType":"executable",
	"name": "test",
	"sourceFiles":["./test.d"]
}

The dub does two step compilation:
dmd -m32 -of.dub/build/application-debug-x86-dmd-DA39A3EE5E6B4B0D3255BFEF95601890AFD80709/test -c -of.dub/build/application-debug-x86-dmd-DA39A3EE5E6B4B0D3255BFEF95601890AFD80709/test.o -debug -g -w -version=Have_test -version=Have_derelict_glfw3 -version=Have_derelict_util -I../../.dub/packages/derelict-glfw3-master/source -I../../.dub/packages/derelict-util-1.0.0/source test.d ../../.dub/packages/derelict-glfw3-master/source/derelict/glfw3/package.d ../../.dub/packages/derelict-glfw3-master/source/derelict/glfw3/glfw3.d ../../.dub/packages/derelict-util-1.0.0/source/derelict/util/xtypes.d ../../.dub/packages/derelict-util-1.0.0/source/derelict/util/exception.d ../../.dub/packages/derelict-util-1.0.0/source/derelict/util/system.d ../../.dub/packages/derelict-util-1.0.0/source/derelict/util/loader.d ../../.dub/packages/derelict-util-1.0.0/source/derelict/util/sharedlib.d ../../.dub/packages/derelict-util-1.0.0/source/derelict/util/wintypes.d
Linking...
dmd -of.dub/build/application-debug-x86-dmd-DA39A3EE5E6B4B0D3255BFEF95601890AFD80709/test .dub/build/application-debug-x86-dmd-DA39A3EE5E6B4B0D3255BFEF95601890AFD80709/test.o -L-ldl -m32 -g
Copying target from /home/andrey/test/.dub/build/application-debug-x86-dmd-DA39A3EE5E6B4B0D3255BFEF95601890AFD80709/test to /home/andrey/test


So, do i need to use two step compilation or i need proper ordering of parameters?
One more question: why dub uses -of flag twice?
« First   ‹ Prev
1 2