4
votes

I've spent hours trying to do this with no success, so I'm here now.

I'm trying to compile this (click) program to test my Derelict installation with no success.

I'm using the Arch Linux distribution. I've been trying with multiple command lines and different DMD2 (and GDC) packages from the AUR (community managed repository). I also tried installing Derelict by either DSSS or from the AUR.

One command line option is:

gdc -I/usr/include/d2/ -L -ldl -L -lDerelictGL -L -lDerelictGLUL -L -lDerelictSDL -L -lDerelictUtil *.d -ofexample

and another:

dmd2 -I/usr/include/d2 main

They both throw a plethora of ugly linker errors (different each).

The directories where the supposedly correct files are are:

libraries: /usr/lib/libDerelict*.a
"headers": /usr/include/d2/derelict/<folders of modules>

I'll be glad to supply you with any kind of additional information.

Thank you,
Nanthiel

EDIT

When I run this:

dmd -I/usr/include/d2 main.d Display.d -ofexample -L-lDerelictGL -L-lDerelictGLU -L-lDerelictSDL -L-lDerelictUtil -L-ldl

it works. However, only with GDC. Not with DMD2. I don't know why.

GDC versions: GCC (4.5.1) gdc (0.30) dmd (2.056) DMD2 version: I don't know how to get it. :/ But it should be the newest one, as it's from git.

Also, Derelict wants Open GL 3.0 support for custom shaders, when 2.0 should be enough. =/

EDIT 2

Here are the linker errors, sorry for the slow update.

    dmd -I/usr/include/d2 main.d Display.d -ofexample -L-lDerelictGL -L-lDerelictGLU -L-lDerelictSDL -L-lDerelictUtil -L-ldl
/usr/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../libDerelictGL.a(gl.o): In function `_D8derelict6opengl2gl16DerelictGLLoader17getExtensionStateMFAyaZE8derelict6opengl7gltypes16GLExtensionState':
(.text+0x38f9): undefined reference to `_d_throw'
/usr/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../libDerelictGL.a(gl.o): In function `_D8derelict6opengl2gl16DerelictGLLoader17isExtensionLoadedMFAyaZb':
(.text+0x395d): undefined reference to `_d_throw'
/usr/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../libDerelictGL.a(gl.o): In function `_D8derelict6opengl2gl16DerelictGLLoader20isExtensionSupportedMFAyaZb':
(.text+0x39c9): undefined reference to `_d_throw'
/usr/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../libDerelictGL.a(gl.o): In function `_D8derelict6opengl2gl16DerelictGLLoader14loadExtensionsMFZv':
(.text+0x3a6d): undefined reference to `_d_throw'
/usr/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../libDerelictGL.a(gl.o): In function `_D8derelict6opengl2gl16DerelictGLLoader18loadModernVersionsMFE8derelict6opengl2gl9GLVersionZE8derelict6opengl2gl9GLVersion':
(.text+0x3de0): undefined reference to `_d_throw'
/usr/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../libDerelictGL.a(gl.o):(.text+0x4889): more undefined references to `_d_throw' follow
/usr/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../libDerelictGL.a(extloader.o): In function `_D6object70__T16AssociativeArrayTAyaTE8derelict6opengl7gltypes16GLExtensionStateZ16AssociativeArray3dupMFNdZHAyaE8derelict6opengl7gltypes16GLExtensionState17__foreachbody1277MFKAyaKE8derelict6opengl7gltypes16GLExtensionStateZi':
(.text+0x5b): undefined reference to `_aaGetp'
/usr/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../libDerelictGL.a(extloader.o): In function `_D8derelict6opengl9extloader23getLoadedExtensionNamesFZAAya':
(.text+0x149): undefined reference to `_aaGetRvaluep'
/usr/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../libDerelictGL.a(extloader.o): In function `_D8derelict6opengl9extloader23getLoadedExtensionNamesFZAAya':
(.text+0x180): undefined reference to `_d_arrayappendcTp'
/usr/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../libDerelictGL.a(extloader.o): In function `_D8derelict6opengl9extloader26getNotLoadedExtensionNamesFZAAya':
(.text+0x298): undefined reference to `_d_arrayappendcTp'
/usr/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../libDerelictGL.a(extloader.o): In function `_D8derelict6opengl9extloader26getNotLoadedExtensionNamesFZAAya':
(.text+0x2ee): undefined reference to `_aaGetRvaluep'
/usr/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../libDerelictGL.a(extloader.o): In function `_D8derelict6opengl9extloader26getNotLoadedExtensionNamesFZAAya':
(.text+0x35c): undefined reference to `_d_arrayappendcTp'
/usr/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../libDerelictGL.a(extloader.o): In function `_D8derelict6opengl9extloader11extGetStateFAyaZE8derelict6opengl7gltypes16GLExtensionState':
(.text+0x46f): undefined reference to `_aaInp'
/usr/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../libDerelictGL.a(extloader.o): In function `_D8derelict6opengl9extloader13extLoadCommonFZv':
(.text+0x126f2): undefined reference to `_aaGetp'
/usr/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../libDerelictGL.a(extloader.o): In function `_D8derelict6opengl9extloader13extLoadCommonFZv':
(.text+0x1272d): undefined reference to `_aaGetp'
/usr/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../libDerelictGL.a(extloader.o): In function `_D8derelict6opengl9extloader13extLoadCommonFZv':
(.text+0x12780): undefined reference to `_aaGetp'
/usr/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../libDerelictGL.a(extloader.o): In function `_D8derelict6opengl9extloader13extLoadCommonFZv':
(.text+0x127f4): undefined reference to `_aaGetp'
/usr/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../libDerelictGL.a(extloader.o): In function `_D8derelict6opengl9extloader13extLoadCommonFZv':
(.text+0x12840): undefined reference to `_aaGetp'
/usr/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../libDerelictGL.a(extloader.o):(.text+0x1288c): more undefined references to `_aaGetp' follow
/usr/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../libDerelictGL.a(extloader.o): In function `_D6object70__T16AssociativeArrayTAyaTE8derelict6opengl7gltypes16GLExtensionStateZ16AssociativeArray3getMFAyaLE8derelict6opengl7gltypes16GLExtensionStateZE8derelict6opengl7gltypes16GLExtensionState':
(.text._D6object70__T16AssociativeArrayTAyaTE8derelict6opengl7gltypes16GLExtensionStateZ16AssociativeArray3getMFAyaLE8derelict6opengl7gltypes16GLExtensionStateZE8derelict6opengl7gltypes16GLExtensionState[_D6object70__T16AssociativeArrayTAyaTE8derelict6opengl7gltypes16GLExtensionStateZ16AssociativeArray3getMFAyaLE8derelict6opengl7gltypes16GLExtensionStateZE8derelict6opengl7gltypes16GLExtensionState]+0x2a): undefined reference to `_aaInp'
/usr/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../libDerelictUtil.a(exception.o): In function `_D8derelict4util9exception22SharedLibLoadException8throwNewFxAAaxAAaZv':
(.text+0x1fe): undefined reference to `_d_throw'
/usr/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../libDerelictUtil.a(exception.o): In function `_D8derelict4util9exception28Derelict_HandleMissingSymbolFAyaAyaZv':
(.text+0x4e2): undefined reference to `_d_throw'
/usr/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../libDerelictUtil.a(sharedlib.o): In function `_D8derelict4util9sharedlib9SharedLib4loadMFAAyaZv':
(.text+0x176): undefined reference to `_d_arrayappendcTp'
/usr/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../libDerelictUtil.a(sharedlib.o): In function `_D8derelict4util9sharedlib9SharedLib4loadMFAAyaZv':
(.text+0x1d8): undefined reference to `_d_arrayappendcTp'
collect2: ld returned 1 exit status
--- errorlevel 1

EDIT 3

I tried re-installing everything (checked Derelict2 out from SVN, reinstalled DMD2, the dmd2-complete package from the AUR) and recompiled Derelict2 again this time using DMD2. It worked. And it also all compiles well now! I don't know what was going on.

If anyone could tell me, what is the procedure of marking this as "solved" or something, now?

Thank you,
Nanthiel

1
Could you post some of the first linker errors? You may also need to link against libDerelictUtil.a and libDelerlictGL.a (among others) - Peter Alexander
I got it to compile now, using gdmd -I/usr/include/d2 -L-lDerelictGL -L-lDerelictGLU -L-lDerelictSDL -L-lDerelictUtil -L-ldl main.d -ofexample. Note that it does not work using DMD2, only GDC. I also failed to recompile Derelict2 with DMD2 for some reason, but it works with GDC. Seems that GDC's version is also older, because it doesn't mention typedef deprecation (in favour of alias). I will investigate the matter further tomorrow, I need to sleep now. Good night! - Matej
I know for a fact that Derelict2 will compile with DMD 2.056 as I do that (on OSX at least). - Peter Alexander
Without linker errors we can't be sure what is the reason - we will just guess. - DejanLekic
Nanthiel, I believe you had old version of the library, and it did not have those symbols inside. - DejanLekic

1 Answers

0
votes

As per Tim's request, I will describe how to get an example program (here) to compile. Note that this applies to the Arch Linux distribution and might not be the same elsewhere, but should be fairly similiar.

Basically, just call dmd with -I/usr/include/d2 -L-lDerelictGL -L-lDerelictGLU -L-lDerelictSDL -L-lDerelictUtil -L-ldl. Add other Derelict modules as needed (like -L-lDerelictSDLttf for SDL_ttf).

Note that the example program on the site has a compile error (easy to fix), and for D2 with the Phobos library, you need to replace Tango's tostringz module with std.string in Display.d.

I installed DMD from the default Arch repositories and Derelict from the AUR. Since DMD was added to an official repository, I suspect users will have fewer problems getting everything to work.