构建交叉编译器

发布于 2024-09-06 14:29:49 字数 155 浏览 6 评论 0原文

我正在尝试编译 c++ 文件并生成要在 PSIM 中反汇编和运行的 asm 或 s 文件。每当我尝试这样做时,我都会遇到错误。我正在尝试编译为 mipsI-linux。我想我已经确定给我的交叉编译器由于某种原因无法正常工作。谁能帮我构建一个新的交叉编译器来生成正确的指令格式?我正在研究 MAC。

I'm trying to compile a c++ file and generate an asm or s file to be disassembled and run in PSIM. Whenever I try to do this I get errors. I am attempting to compile to mipsI-linux. I think I've determined that my cross compiler that was given to me is not working correctly for some reason. Can anyone give me some help building a new cross compiler that will generate the correct instruction format? I'm working on a MAC.

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

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

发布评论

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

评论(3

向日葵 2024-09-13 14:29:49

您可能想看看crosstool-NG(基于crosstool)这似乎使构建交叉编译器工具链相对容易。

You probably want to take a look at crosstool-NG (based on crosstool) which seems to make building a cross-compiler toolchain relatively easy.

梦幻之岛 2024-09-13 14:29:49

Cross Linux-From-Scatch 是一个很好的起点。它引导您完成的第一步是构建一个具有所有依赖项的交叉编译器。

A great place to start is Cross Linux-From-Scatch. The first step it walks you through is building a cross-compiler with all of its dependencies.

自在安然 2024-09-13 14:29:49

我尝试了多种方法,发现使用 Buildroot 是最简单、最可靠的方法。只需下载Buildroot,解压,cd到顶级目录并运行make-menuconfig即可。设置选项,例如您需要交叉编译器的目标机器,然后运行 ​​make

制作需要 15-20 分钟,并且需要有效的互联网连接,因为所有源都是从在线档案下载并构建的。构建完成后,您将获得:交叉编译器工具链(gcc、as、ld 等,以及 glibc 或 ulibc,无论您在选项中选择哪个)。在 make 之后,二进制文件(名为-linux-gcc、-linux-as 等)位于

/ output/host/usr/bin。

将此位置添加到您的 PATH 变量(对于 Linux 用户),仅此而已。

编辑:抱歉,我刚才注意到这个问题是针对 MAC 的。 MAC 可能不正式支持 Buildroot。

I have tried a number of approaches and found that using Buildroot was the simplest and most reliable approach. Just download Buildroot, uncompress, cd to the top-level directory and run make-menuconfig. Set the options such as what target machine you need the cross compiler for, and run make.

The make takes 15-20 mins and needs an active internet connection as all sources are downloaded from online archives and built. After the build you get: a cross compiler toolchain (gcc,as,ld etc, and glibc or ulibc whichever you choose in the options). After make, the binaries (named < arch >-linux-gcc, < arch >-linux-as etc) are located at

<buildroot-top-directory>/output/host/usr/bin.

Add this location to your PATH variable (for linux users) and that's it.

Edit: Sorry, I noticed just now that the question is for MAC. Buildroot may not be officially supported for MAC.

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