【发布时间】:2011-12-12 22:45:14
【问题描述】:
我花了几个小时试图做到这一点,但没有成功,所以我现在就在这里。
我正在尝试编译 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>
我很乐意为您提供任何类型的附加信息。
谢谢你,
南希尔
编辑
当我运行这个时:
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。
此外,Derelict 希望 Open GL 3.0 支持自定义着色器,而 2.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。有效。它现在也编译得很好!我不知道发生了什么。
如果有人能告诉我,现在将其标记为“已解决”之类的程序是什么?
谢谢你,
南希尔
【问题讨论】:
-
您能发布一些第一个链接器错误吗?您可能还需要链接 libDerelictUtil.a 和 libDelerlictGL.a(以及其他)
-
我现在用
gdmd -I/usr/include/d2 -L-lDerelictGL -L-lDerelictGLU -L-lDerelictSDL -L-lDerelictUtil -L-ldl main.d -ofexample编译它。请注意,它不适用于 DMD2,只能使用 GDC。由于某种原因,我也未能使用 DMD2 重新编译 Derelict2,但它适用于 GDC。似乎 GDC 的版本也较旧,因为它没有提及typedef弃用(赞成alias)。明天我会进一步调查这件事,我现在要睡觉了。晚安! -
我知道 Derelict2 将在我这样做时使用 DMD 2.056 进行编译(至少在 OSX 上)。
-
如果没有链接器错误,我们无法确定是什么原因 - 我们只是猜测。
-
Nanthiel,我相信你有旧版本的库,里面没有那些符号。
标签: compilation d