构建arm-elf-gcc时出错

发布于 2024-09-16 21:18:20 字数 3172 浏览 3 评论 0原文

我正在尝试构建一个arm-elf-gcc 交叉编译器。

因此,我首先使用以下配置选项安装了 binutils 2.18:

./configure --target=arm-elf --enable-interwork --enable-multilib

这似乎工作正常。

接下来我安装了 gmp、mpfr 和 libmpc,

现在安装 gcc 本身。

//编辑 - 删除了以前的错误并更新了当前的错误(我尝试单独构建所有内容)

首先我使用这些配置选项安装引导gcc:

--target=arm-elf --disable-libssp --with-newlib --without-headers --with-gnu-as --with-gnu-ld

然后我尝试用它构建newlib 1.17.0

--target=arm-elf --disable-werror --disable-newlib-supplied-syscalls --disable-nls --with-gnu-as --with-gnu-ld

但这仍然会导致同样的错误。也许 newlib 尝试使用 apple gcc 构建 x86 架构(我在 OS X 上运行这些东西),但它可能不理解这些参数?

    cc1: error: unrecognized command line option "-msse4"
../../../../../../newlib/libc/argz/dummy.c:1: error: bad value (core2) for -march= switch
cc1: error: unrecognized command line option "-msse4"
FATAL:/usr/bin/../libexec/gcc/darwin/x86_64/as: I don't understand 'm' flag!
../../../../../../newlib/libc/argz/argz_add.c:1: error: bad value (core2) for -march= switch
cc1: error: unrecognized command line option "-msse4"
../../../../../../newlib/libc/argz/argz_add_sep.c:1: error: bad value (core2) for -march= switch
cc1: error: unrecognized command line option "-msse4"
make[8]: *** [lib_a-argz_add.o] Error 1
make[8]: *** Waiting for unfinished jobs....
../../../../../../newlib/libc/argz/argz_append.c:1: error: bad value (core2) for -march= switch
FATAL:/usr/bin/../libexec/gcc/darwin/x86_64/as: I don't understand 'm' flag!
cc1: error: unrecognized command line option "-msse4"
../../../../../../newlib/libc/argz/argz_create.c:1: error: bad value (core2) for -march= switch
cc1: error: unrecognized command line option "-msse4"
../../../../../../newlib/libc/argz/argz_count.c:1: error: bad value (core2) for -march= switch
FATAL:/usr/bin/../libexec/gcc/darwin/x86_64/as: I don't understand 'm' flag!
cc1: error: unrecognized command line option "-msse4"
../../../../../../newlib/libc/argz/argz_delete.c:1: error: bad value (core2) for -march= switch
make[8]: *** [lib_a-dummy.o] Error 1
make[8]: *** [lib_a-argz_create.o] Error 1
FATAL:/usr/bin/../libexec/gcc/darwin/x86_64/as: I don't understand 'm' flag!
FATAL:/usr/bin/../libexec/gcc/darwin/x86_64/as: I don't understand 'm' flag!
FATAL:/usr/bin/../libexec/gcc/darwin/x86_64/as: I don't understand 'm' flag!
make[8]: *** [lib_a-argz_add_sep.o] Error 1
make[8]: *** [lib_a-argz_delete.o] Error 1
FATAL:/usr/bin/../libexec/gcc/darwin/x86_64/as: I don't understand 'm' flag!
make[8]: *** [lib_a-argz_count.o] Error 1
make[8]: *** [lib_a-argz_append.o] Error 1
FATAL:/usr/bin/../libexec/gcc/darwin/x86_64/as: I don't understand 'm' flag!
cc1: error: unrecognized command line option "-msse4"
../../../../../../newlib/libc/argz/argz_create_sep.c:1: error: bad value (core2) for -march= switch
make[8]: *** [lib_a-argz_create_sep.o] Error 1
make[7]: *** [all-recursive] Error 1
make[6]: *** [all-recursive] Error 1
make[5]: *** [all] Error 2
make[4]: *** [multi-do] Error 1
make[3]: *** [all-multi] Error 2
make[2]: *** [all] Error 2
make[1]: *** [all-target-newlib] Error 2
make: *** [all] Error 2

I'm trying to build a arm-elf-gcc cross compiler.

So firts I installed binutils 2.18 with the following configure options:

./configure --target=arm-elf --enable-interwork --enable-multilib

This seems to work fine.

next I installed gmp, mpfr and libmpc

so now to the gcc itself.

//edit - removed previous error and updated with the current one (I tried to build everything separately)

First I install a bootstrap gcc with these configure options:

--target=arm-elf --disable-libssp --with-newlib --without-headers --with-gnu-as --with-gnu-ld

And afterwards I try to build newlib 1.17.0 with it

--target=arm-elf --disable-werror --disable-newlib-supplied-syscalls --disable-nls --with-gnu-as --with-gnu-ld

But this still results in the same error. Maybe newlib tries to build for x86 architecture with the apple gcc (I'm running these things all on OS X) which maybe doesn't understand these parameters?

    cc1: error: unrecognized command line option "-msse4"
../../../../../../newlib/libc/argz/dummy.c:1: error: bad value (core2) for -march= switch
cc1: error: unrecognized command line option "-msse4"
FATAL:/usr/bin/../libexec/gcc/darwin/x86_64/as: I don't understand 'm' flag!
../../../../../../newlib/libc/argz/argz_add.c:1: error: bad value (core2) for -march= switch
cc1: error: unrecognized command line option "-msse4"
../../../../../../newlib/libc/argz/argz_add_sep.c:1: error: bad value (core2) for -march= switch
cc1: error: unrecognized command line option "-msse4"
make[8]: *** [lib_a-argz_add.o] Error 1
make[8]: *** Waiting for unfinished jobs....
../../../../../../newlib/libc/argz/argz_append.c:1: error: bad value (core2) for -march= switch
FATAL:/usr/bin/../libexec/gcc/darwin/x86_64/as: I don't understand 'm' flag!
cc1: error: unrecognized command line option "-msse4"
../../../../../../newlib/libc/argz/argz_create.c:1: error: bad value (core2) for -march= switch
cc1: error: unrecognized command line option "-msse4"
../../../../../../newlib/libc/argz/argz_count.c:1: error: bad value (core2) for -march= switch
FATAL:/usr/bin/../libexec/gcc/darwin/x86_64/as: I don't understand 'm' flag!
cc1: error: unrecognized command line option "-msse4"
../../../../../../newlib/libc/argz/argz_delete.c:1: error: bad value (core2) for -march= switch
make[8]: *** [lib_a-dummy.o] Error 1
make[8]: *** [lib_a-argz_create.o] Error 1
FATAL:/usr/bin/../libexec/gcc/darwin/x86_64/as: I don't understand 'm' flag!
FATAL:/usr/bin/../libexec/gcc/darwin/x86_64/as: I don't understand 'm' flag!
FATAL:/usr/bin/../libexec/gcc/darwin/x86_64/as: I don't understand 'm' flag!
make[8]: *** [lib_a-argz_add_sep.o] Error 1
make[8]: *** [lib_a-argz_delete.o] Error 1
FATAL:/usr/bin/../libexec/gcc/darwin/x86_64/as: I don't understand 'm' flag!
make[8]: *** [lib_a-argz_count.o] Error 1
make[8]: *** [lib_a-argz_append.o] Error 1
FATAL:/usr/bin/../libexec/gcc/darwin/x86_64/as: I don't understand 'm' flag!
cc1: error: unrecognized command line option "-msse4"
../../../../../../newlib/libc/argz/argz_create_sep.c:1: error: bad value (core2) for -march= switch
make[8]: *** [lib_a-argz_create_sep.o] Error 1
make[7]: *** [all-recursive] Error 1
make[6]: *** [all-recursive] Error 1
make[5]: *** [all] Error 2
make[4]: *** [multi-do] Error 1
make[3]: *** [all-multi] Error 2
make[2]: *** [all] Error 2
make[1]: *** [all-target-newlib] Error 2
make: *** [all] Error 2

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

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

发布评论

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

评论(2

七禾 2024-09-23 21:18:20

并非 binutils、gcc 和 newlib 的所有组合都可以工作。我很久以前就放弃了个人尝试寻找任何组合。上次我成功是在 gcc 3.x 时代,你不能交叉编译 gcc 3.x 和 gcc 4.x,或者至少它变得越来越难。

也许可以尝试不使用互操作和多库,直到你可以直臂工作。也许你需要一个 eabi,以某种形式的 arm-non-eabi 之类的东西?

这是一个获得有效 gcc 和 libgcc 的组合

http://www. coplark.com/2009-07-04-building-gcc/

代码源应该提供其构建信息,以了解如何,至少达到 binutils 和 gcc。

不知何故,你在那里得到了 core2 架构,但我没有看到任何明显的东西。

Not every combination of binutils, gcc, and newlib work. I gave up a long time ago personally trying to find any combinations. Last time I was successful was in the gcc 3.x days, and you cant cross compile gcc 3.x with gcc 4.x or at least it is getting harder.

Maybe try without the interwork and multilib until you get straight arm working. Maybe you need an eabi in there in some form arm-non-eabi, something like that?

Here is a combination that gets a working gcc and libgcc

http://www.cowlark.com/2009-07-04-building-gcc/

code sourcery should have their build information available to figure out how to, at least get as far as binutils and gcc.

Somehow you are getting a core2 architecture in there, I dont see anything obvious though.

呆° 2024-09-23 21:18:20

是的,这是一篇旧帖子,但我在寻找答案时发现了它。
现在我找到了答案,所以我将其发布在这里。

仔细观察“as” - 哪个 as 实际执行,您的 as 是针对主机计算机还是针对目标体系结构?

答案是:至于目标架构。

当您在 Mac 上构建时(无论是在 PowerPC 上还是在 intel 上),都会发生这种情况。
您应该在构建 binutils 后立即设置 PATH 环境变量,以便找到正确的 binutils,否则您的本机 x86(或 PowerPC)工具将用于构建 ARM 目标。那是行不通的。

Yes this is an old post, but I found it as I was looking for an answer.
Now I found the answer, so I'll post it here.

Look closely at the "as" - which as is actually executed, your as for the host-computer or for the target architecture ?

The answer is: The as for the target architecture.

This happens when you build on Mac - both on PowerPC and on intel.
You should set up your PATH environment variable right after building binutils, so that the correct binutils will be found, otherwise your native x86 (or PowerPC) tools will be used to build your ARM target. That just won't work.

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