在 64 位 Linux 上使用 DMD 编译或与 32 位目标文件链接

发布于 2024-07-19 10:42:42 字数 244 浏览 3 评论 0原文

在 64 位机器上使用 DMD 编译程序的最佳方法是什么? 它不需要编译为 64 位代码。 我了解 GDC,但也想与 D2 合作。 还有 chroot,但我希望有一种更简单的方法。

实际的问题不在于编译,而在于链接。 DMD 调用 GCC 来执行与系统库的链接。 我可以让 DMD 拥有针对 32 位库的 GCC 链接吗? 或者我该如何手动完成?

我已经安装了 ia32 库,这就是我可以运行 DMD 的原因。

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.

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?

I already have the ia32 libraries installed which is why I can run DMD.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半世晨晓 2024-07-26 10:42:42

要求 GCC 通过传递 '-m32' 标志来执行 32 位链接。

看来 DMD 不会调用 gcc 来执行链接,而是直接调用 ld。 等效的 ld 开关是 '-melf_i386',显然让 DMD 将该选项传递给链接器的方法是使用 ' -L-melf_i386' 标志。

请注意,许多系统将运行时库和开发库分开。 32 位运行时包几乎总是默认安装,但 32 位开发包可能不会。

您需要开发 32 位程序包来构建 32 位程序。 32 位 DMD 可以运行这一事实本身并不能证明您拥有构建 32 位程序所需的所有 32 位库。

Ask GCC to perform 32-bit link by passing it '-m32' flag.

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.

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.

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文