第一个gcc交叉编译器编译阶段出错(arm none eabi/bin/as:Unrecogned option';--64';)
我正在遵循一个gcc裸金属交叉编译器构建过程。以下是关于ARM GCC阶段1的说明第一个gcc交叉编译器编译阶段出错(arm none eabi/bin/as:Unrecogned option';--64';),gcc,compilation,arm,Gcc,Compilation,Arm,我正在遵循一个gcc裸金属交叉编译器构建过程。以下是关于ARM GCC阶段1的说明 5. Configure, build and install ARM GCC stage 1. This step creates a bootstrap ARM toolchain without any of the standard C libraries. Note that in the following commands any text within square br
5. Configure, build and install ARM GCC stage 1. This step creates a
bootstrap ARM toolchain without any of the standard C libraries. Note that
in the following commands any text within square brackets must only be used
when building the arm-none-eabi (or armeb-none-eabi) toolchain.
You do not type the square brackets themselves, only the text between them.
$ cd build-<target>/gcc_stage1
$ ../../gcc-linaro-5.3-2016.05/configure --target=<target> \
--prefix=<install_dir> \
--with-arch=armv8-a \
[--with-fpu=crypto-neon-fp-armv8] \
--disable-multilib \
--disable-werror \
--enable-languages=c \
--disable-shared \
--without-headers \
--with-newlib \
--with-gnu-as \
--with-gnu-ld
$ make all-gcc <-- error here "--64"
$ make install-gcc
$ cd ../..
然后,当我运行makeallgcc
时,我得到以下错误。(为简洁起见,仅显示最后一部分,此日志是在第二次发出命令后显示的,因此仅显示最后一个错误部分)
日志将
显示为
,这是我在正确使用之前构建的。我在网上搜索了一下,但没有找到相同的案例。有人能给我一些想法吗?这可能是因为您似乎瞄准的ARM体系结构,armv8-a
(64位体系结构)与您正在构建的工具链,ARM none eabi
:您应该瞄准aarch64 none elf
:这类似于:
../../gcc-linaro-5.3-2016.05/configure --target=aarch64-elf --prefix=/opt/arm-toolchain --with-arch=armv8-a --with-fpu=crypto-neon-fp-armv8 --disable-multilib --disable-werror --enable-languages=c --disable-shared --without-headers --with-newlib --with-gu-as --with-gnu-ld
ARM gcc工具链是使用以下选项构建的:
/opt/arm/9/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/aarch64-none-elf-gcc -v
Using built-in specs.
COLLECT_GCC=/opt/arm/9/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/aarch64-none-elf-gcc
COLLECT_LTO_WRAPPER=/opt/arm/9/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../libexec/gcc/aarch64-none-elf/9.2.1/lto-wrapper
Target: aarch64-none-elf
Configured with: /tmp/dgboter/bbs/rhev-vm1--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-elf/build/src/gcc/configure --target=aarch64-none-elf --prefix=/tmp/dgboter/bbs/rhev-vm1--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-elf/build/build-aarch64-none-elf/install// --with-gmp=/tmp/dgboter/bbs/rhev-vm1--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-elf/build/build-aarch64-none-elf/host-tools --with-mpfr=/tmp/dgboter/bbs/rhev-vm1--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-elf/build/build-aarch64-none-elf/host-tools --with-mpc=/tmp/dgboter/bbs/rhev-vm1--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-elf/build/build-aarch64-none-elf/host-tools --with-isl=/tmp/dgboter/bbs/rhev-vm1--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-elf/build/build-aarch64-none-elf/host-tools --disable-shared --disable-nls --disable-threads --disable-tls --enable-checking=release --enable-languages=c,c++,fortran --with-newlib --with-pkgversion='GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)' --with-bugurl=https://bugs.linaro.org/
Thread model: single
gcc version 9.2.1 20191025 (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10))
这可能是因为您似乎要针对的ARM体系结构(
armv8-a
)是64位体系结构,而您正在构建的工具链(ARM none-eabi
)之间不匹配:您应该针对aarch64 none-elf
:这类似于:
../../gcc-linaro-5.3-2016.05/configure --target=aarch64-elf --prefix=/opt/arm-toolchain --with-arch=armv8-a --with-fpu=crypto-neon-fp-armv8 --disable-multilib --disable-werror --enable-languages=c --disable-shared --without-headers --with-newlib --with-gu-as --with-gnu-ld
ARM gcc工具链是使用以下选项构建的:
/opt/arm/9/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/aarch64-none-elf-gcc -v
Using built-in specs.
COLLECT_GCC=/opt/arm/9/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/aarch64-none-elf-gcc
COLLECT_LTO_WRAPPER=/opt/arm/9/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../libexec/gcc/aarch64-none-elf/9.2.1/lto-wrapper
Target: aarch64-none-elf
Configured with: /tmp/dgboter/bbs/rhev-vm1--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-elf/build/src/gcc/configure --target=aarch64-none-elf --prefix=/tmp/dgboter/bbs/rhev-vm1--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-elf/build/build-aarch64-none-elf/install// --with-gmp=/tmp/dgboter/bbs/rhev-vm1--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-elf/build/build-aarch64-none-elf/host-tools --with-mpfr=/tmp/dgboter/bbs/rhev-vm1--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-elf/build/build-aarch64-none-elf/host-tools --with-mpc=/tmp/dgboter/bbs/rhev-vm1--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-elf/build/build-aarch64-none-elf/host-tools --with-isl=/tmp/dgboter/bbs/rhev-vm1--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-elf/build/build-aarch64-none-elf/host-tools --disable-shared --disable-nls --disable-threads --disable-tls --enable-checking=release --enable-languages=c,c++,fortran --with-newlib --with-pkgversion='GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)' --with-bugurl=https://bugs.linaro.org/
Thread model: single
gcc version 9.2.1 20191025 (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10))
因此,s:
为arm构建(aarch32)
arm none eabi as so.s-o so.o
arm none eabi objdump-d so.o
so.o:文件格式elf32 littlearm
第节的分解。正文:
00000000 :
0:e1a00000 nop;(mov r0,r0)
为aarch64(64位arm)构建
aarch64无elf as so.s-o so.o
AARC64非elf对象转储-d so.o
so.o:文件格式elf64-LITLEARCH64
第节的分解。正文:
0000000000000000 :
0:d503201f无
及mips作示范用途
mips-elf-as so.s -o so.o
mips-elf-objdump -d so.o
so.o: file format elf32-bigmips
Disassembly of section .text:
00000000 <.text>:
0: 00000000 nop
mips elf as so.s-o so.o
mips elf objdump-d so.o
so.o:文件格式elf32 bigmips
第节的分解。正文:
00000000 :
0:00000000无
x86
as so.s-o so.o
objdump-dso.o
so.o:文件格式elf64-x86-64
第节的分解。正文:
0000000000000000 :
0:90不
两个不同的指令集两个不同的gnu目标,就像x86、mips和arm是不同的目标和gnu工具的不同版本
这只是这个答案的一个演示。so.s:
为arm构建(aarch32)
arm none eabi as so.s-o so.o
arm none eabi objdump-d so.o
so.o:文件格式elf32 littlearm
第节的分解。正文:
00000000 :
0:e1a00000 nop;(mov r0,r0)
为aarch64(64位arm)构建
aarch64无elf as so.s-o so.o
AARC64非elf对象转储-d so.o
so.o:文件格式elf64-LITLEARCH64
第节的分解。正文:
0000000000000000 :
0:d503201f无
及mips作示范用途
mips-elf-as so.s -o so.o
mips-elf-objdump -d so.o
so.o: file format elf32-bigmips
Disassembly of section .text:
00000000 <.text>:
0: 00000000 nop
mips elf as so.s-o so.o
mips elf objdump-d so.o
so.o:文件格式elf32 bigmips
第节的分解。正文:
00000000 :
0:00000000无
x86
as so.s-o so.o
objdump-dso.o
so.o:文件格式elf64-x86-64
第节的分解。正文:
0000000000000000 :
0:90不
两个不同的指令集两个不同的gnu目标,就像x86、mips和arm是不同的目标和gnu工具的不同版本
向上投票Frants answer顺便说一句,这只是该答案的演示。谢谢,那么,您的意思是我应该删除配置中的
--使用arch=armv8-a
?我明天可以试一试。我只是增加了我的答案。顺便说一下,如果这个或任何答案都解决了你的问题(我想它已经有了),请点击一下复选标记来考虑。这向更广泛的社区表明,你已经找到了一个解决方案,并给回答者和你自己带来了一些声誉。没有义务这样做。您正在使用的程序是否有效是另一个主题,可能会导致更多的问题。您需要使用aarch64,而不是arm。为aarch64打造的任何装备。不同的gnu目标(不同的,完全不兼容的指令集)。armv8-a如果arm支持armv8-a,不管它实际上为aarch32构建了什么,armv7-a兼容功能。谢谢,那么,您的意思是我应该删除配置中的--with arch=armv8-a
?我明天可以试一试。我只是增加了我的答案。顺便说一下,如果这个或任何答案都解决了你的问题(我想它已经有了),请点击一下复选标记来考虑。这向更广泛的社区表明,你已经找到了一个解决方案,并给回答者和你自己带来了一些声誉。没有义务这样做。您正在使用的程序是否有效是另一个主题,可能会导致更多的问题。您需要使用aarch64,而不是arm。为aarch64打造的任何装备。不同的gnu目标(不同的,完全不兼容的指令集)。armv8-a,如果arm支持的话,不管实际为aarch32构建的是什么,armv7-a兼容特性。
aarch64-none-elf-as so.s -o so.o
aarch64-none-elf-objdump -d so.o
so.o: file format elf64-littleaarch64
Disassembly of section .text:
0000000000000000 <.text>:
0: d503201f nop
mips-elf-as so.s -o so.o
mips-elf-objdump -d so.o
so.o: file format elf32-bigmips
Disassembly of section .text:
00000000 <.text>:
0: 00000000 nop
as so.s -o so.o
objdump -D so.o
so.o: file format elf64-x86-64
Disassembly of section .text:
0000000000000000 <.text>:
0: 90 nop