What is the best way to compile programs with DMD on a 64bit machine? It doesn't need to compile to 64Bit code. I know about GDC, but want to work with D2 also. There is also chroot, but am hoping for a simpler way.
在64位机器上使用DMD编译程序的最佳方法是什么?它不需要编译为64位代码。我知道GDC,但也希望与D2合作。还有chroot,但我希望有一个更简单的方法。
The actual problem isn't with compiling, but linking. DMD calls on GCC to perform linking with system libraries. Could I get DMD to have GCC link against 32bit library? Or how would I do it manually?
实际问题不在于编译,而在于链接。 DMD调用GCC来执行与系统库的链接。我可以让DMD与32位库进行GCC链接吗?或者我该如何手动完成?
I already have the ia32 libraries installed which is why I can run DMD.
我已经安装了ia32库,这就是我可以运行DMD的原因。
1 个解决方案
#1
Ask GCC to perform 32-bit link by passing it '-m32'
flag.
要求GCC通过传递'-m32'标志来执行32位链接。
It appears that DMD
doesn't invoke gcc
to perform the link, but rather invokes ld
directly. The equivalent ld
switch is '-melf_i386'
, and apparently the way to make DMD
pass that option to the linker is with '-L-melf_i386'
flag.
似乎DMD不会调用gcc来执行链接,而是直接调用ld。等效的ld开关是'-melf_i386',显然,让DMD将该选项传递给链接器的方法是使用'-L-melf_i386'标志。
Note that many systems separate runtime and development libraries. 32-bit runtime packages are almost always installed by default, but 32-bit development packages may not be.
请注意,许多系统将运行时和开发库分开。默认情况下,几乎总是安装32位运行时包,但32位开发包可能不是。
You need development 32-bit packages to build 32-bit programs. The fact that 32-bit DMD
can run does not in itself prove that you have all the 32-bit libraries you need in order to build 32-bit programs.
您需要开发32位软件包来构建32位程序。 32位DMD可以运行的事实本身并不能证明您拥有构建32位程序所需的所有32位库。
#1
Ask GCC to perform 32-bit link by passing it '-m32'
flag.
要求GCC通过传递'-m32'标志来执行32位链接。
It appears that DMD
doesn't invoke gcc
to perform the link, but rather invokes ld
directly. The equivalent ld
switch is '-melf_i386'
, and apparently the way to make DMD
pass that option to the linker is with '-L-melf_i386'
flag.
似乎DMD不会调用gcc来执行链接,而是直接调用ld。等效的ld开关是'-melf_i386',显然,让DMD将该选项传递给链接器的方法是使用'-L-melf_i386'标志。
Note that many systems separate runtime and development libraries. 32-bit runtime packages are almost always installed by default, but 32-bit development packages may not be.
请注意,许多系统将运行时和开发库分开。默认情况下,几乎总是安装32位运行时包,但32位开发包可能不是。
You need development 32-bit packages to build 32-bit programs. The fact that 32-bit DMD
can run does not in itself prove that you have all the 32-bit libraries you need in order to build 32-bit programs.
您需要开发32位软件包来构建32位程序。 32位DMD可以运行的事实本身并不能证明您拥有构建32位程序所需的所有32位库。