compilation - 编译废弃程序 (D)

标签 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>

我很乐意为您提供任何类型的附加信息。

谢谢,
南蒂尔

编辑

当我运行这个:
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。有效。它现在也编译得很好!我不知道发生了什么事。

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

谢谢,
南蒂尔

最佳答案

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

基本上,只需调用dmd-I/usr/include/d2 -L-lDerelictGL -L-lDerelictGLU -L-lDerelictSDL -L-lDerelictUtil -L-ldl .根据需要添加其他 Derelict 模块(如 -L-lDerelictSDLttfSDL_ttf )。

注意网站上的示例程序有一个编译错误(容易修复),对于带有Phobos库的D2,需要替换Tango的tostringz带有 std.string 的模块在 Display.d .

我从默认的 Arch 存储库安装了 DMD,从 AUR 安装了 Derelict。由于 DMD 已添加到官方存储库中,我怀疑用户在让一切正常工作时遇到的问题会更少。

关于compilation - 编译废弃程序 (D),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8482003/

相关文章:

java - 如何编译和运行具有多个包或源文件的Java代码

c++ - 有没有办法确保 C++ .h 与相应的 C++ .cpp 文件匹配?

iPhone SDK Objective-C __DATE__ (编译日期)无法转换为 NSDate

exception - 在 D 中打开一个文件

DUB:如何指定 git repo 的版本?

ios - 在 Xcode 中比通常的编译时间更长

ubuntu - 如何在 Ubuntu 中跟上最新版本的 Node.js?购电协议(protocol)?编译?

caching - D 中内存函数的纯度

parameter-passing - 如何按值传递对象?

d - 有没有办法自行托管 DUB 注册表?