编制废弃程序(D)

时间:2011-12-12 22:45:15

标签: compilation d

我花了好几个小时试图做到这一点没有成功,所以我现在就在这里。

我正在尝试编译this (click)程序来测试我的Derelict安装但没有成功。

我正在使用Arch Linux发行版。我一直在尝试使用AUR(社区托管存储库)中的多个命令行和不同的DMD2(和GDC)包。 我也尝试过DSSS或AUR安装Derelict。

一个命令行选项是:

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

和另一个:

dmd2 -I/usr/include/d2 main

他们都抛出了大量丑陋的链接器错误(每个都不同)。

所谓正确文件的目录是:

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

我很乐意为您提供任何其他信息。

谢谢你,
Nanthiel

修改

当我运行时:

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

它有效。但是,只有GDC。不是DMD2。我不知道为什么。

GDC版本:GCC(4.5.1)gdc(0.30)dmd(2.056) DMD2版本:我不知道怎么弄它。 :/但它应该是最新的,因为它来自git。

此外,当2.0应该足够时,Derelict希望Open GL 3.0支持自定义着色器。 = /

编辑2

以下是链接器错误,对于缓慢更新感到抱歉。

    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

编辑3

我尝试重新安装所有内容(从SVN检查了Derelict2,重新安装了DMD2,来自AUR的dmd2-complete包),这次使用DMD2重新编译了Derelict2。有效。它现在也很好编译!我不知道发生了什么。

如果有人能告诉我,现在将这个标记为“已解决”或什么的程序是什么?

谢谢你,
Nanthiel

1 个答案:

答案 0 :(得分:0)

根据Tim的要求,我将描述如何编译示例程序(here)。请注意,这适用于Arch Linux发行版,在其他地方可能不一样,但应该非常类似。

基本上,只需使用dmd致电-I/usr/include/d2 -L-lDerelictGL -L-lDerelictGLU -L-lDerelictSDL -L-lDerelictUtil -L-ldl即可。根据需要添加其他废弃模块(例如-L-lDerelictSDLttf的{​​{1}})。

请注意,网站上的示例程序存在编译错误(易于修复),对于带有Phobos库的D2,您需要在{{1}中将Tango的SDL_ttf模块替换为tostringz }}

我从默认的Arch存储库安装了DMD,从AUR安装了Derelict。由于DMD被添加到官方存储库中,我怀疑用户将一切工作的问题更少。