macos 如何在 mac os x 10.6 上安装 gnu ld?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1608009/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 06:29:54  来源:igfitidea点击:

How to install gnu ld on mac os x 10.6?

macosldbinutils

提问by Gyom

I'm having a lot of trouble compiling the otherwise excellent Contiki OSon my macbook pro (with mac os x 10.6). Contiki actually uses a lot of GNU-specific features and options of GCC, AR, LD, and so on. So I installed those utilities via macports, but it looks like "port install binutils" does not install GNU ld, does it ?

我在我的 macbook pro(使用 mac os x 10.6)上编译其他优秀的Contiki 操作系统时遇到了很多麻烦。Contiki 实际上使用了很多 GCC、AR、LD 等特定于 GNU 的特性和选项。所以我通过 macports 安装了这些实用程序,但看起来“port install binutils”没有安装 GNU ld,是吗?

So, the question is, how do I get GNU ld on my mac ? Is there a simple alternative to the hard-way (i.e. the wget, configure, make, make installway) ?

所以,问题是,我如何在我的 mac 上获得 GNU ld?有没有一种简单的替代方法来代替困难的方式(即wget, configure, make, make install方式)?

回答by Brian Campbell

As far as I can tell, GNU binutils does not support the Mach-Oformat. None of the documentationmentions it, and some Googling turns up some recent messagesindicating that it is not supported.

据我所知,GNU binutils 不支持Mach-O格式。没有一个文档提到它,一些谷歌搜索显示了一些最近的消息,表明它不受支持。

Now, you mention the Contiki OS, which looks to me like an embedded operating system. Are you needing to compile to a native executable, or are you trying to cross-compile for some other environment? MacPorts does include several ports of binutilsfor cross compilation.

现在,您提到了 Contiki OS,它在我看来就像一个嵌入式操作系统。您是否需要编译为本机可执行文件,或者您是否正在尝试针对其他环境进行交叉编译?MacPorts 确实包含多个用于交叉编译的 binutils 端口

回答by zoul

$ port info binutils
(…) Tools are prefixed with g to avoid conflicts with original tools. (…)

回答by Rob Napier

Generally you can link directly with gcc or g++ and don't need gld. Try setting LD to point to the compiler and see if it doesn't link for you.

通常,您可以直接与 gcc 或 g++ 链接,不需要 gld。尝试将 LD 设置为指向编译器,看看它是否不适合您。