I want to build gcc as mentioned here: https://gcc.gnu.org/install/ for my machine. The build machine is:
- Ubuntu 22.04
- x86_64
- Intel i7
I successfully built gcc 13.1.0 on this machine. Next I want to build the same gcc for the other machine (because that one's much slower and has a lot less RAM).
The host/target machine is (I want to be able to compile C/C++ and run resulting programs here):
- Poky (Yocto Project Reference Distro) 3.0.2 (zeus)
- aarch64
- arm64
Letting the configure script run on the target machine gives: --host=aarch64-unknown-linux-gnu
So I run configure with --build=x86_64-intel-linux-gnu
, --host=aarch64-arm64-linux-gnu
, which doesn't complain, but when I then run make, it results in error. Scrolling up reveals:/bin/bash: line 1: aarch64-arm64-linux-gnu-ar: command not found
and./libtool: line 1115: aarch64-arm64-linux-gnu-ar: command not found
So what am I doing wrong? How am I supposed to configure it to build gcc for another machine?
Snippet from ( https://gcc.gnu.org/install/configure.html ) below. As for the cpu-company-system
, that's essentially what I'm struggling with what I'm supposed to put in there. Is company just intel/arm/apple or what?
Host, Build and Target specification Specify the host, build and target machine configurations. You do this when you run the configure script.
The build machine is the system which you are using, the host machine is the system where you want to run the resulting compiler (normally the build machine), and the target machine is the system for which you want the compiler to generate code.
If you are building a compiler to produce code for the machine it runs on (a native compiler), you normally do not need to specify any operands to configure; it will try to guess the type of machine you are on and use that as the build, host and target machines. So you don’t need to specify a configuration when building a native compiler unless configure cannot figure out what your configuration is or guesses wrong.
In those cases, specify the build machine’s configuration name with the --host option; the host and target will default to be the same as the host machine.
Here is an example:
./configure --host=x86_64-pc-linux-gnu A configuration name may be canonical or it may be more or less abbreviated (config.sub script produces canonical versions).
A canonical configuration name has three parts, separated by dashes. It looks like this: ‘cpu-company-system’.
Here are the possible CPU types:
aarch64, aarch64_be, alpha, alpha64, amdgcn, arc, arceb, arm, armeb, avr, bfin, bpf, cris, csky, epiphany, fido, fr30, frv, ft32, h8300, hppa, hppa2.0, hppa64, i486, i686, ia64, iq2000, lm32, loongarch64, m32c, m32r, m32rle, m68k, mcore, microblaze, microblazeel, mips, mips64, mips64el, mips64octeon, mips64orion, mips64vr, mipsel, mipsisa32, mipsisa32r2, mipsisa64, mipsisa64r2, mipsisa64r2el, mipsisa64sb1, mipsisa64sr71k, mipstx39, mmix, mn10300, moxie, msp430, nds32be, nds32le, nios2, nvptx, or1k, pdp11, powerpc, powerpc64, powerpc64le, powerpcle, pru, riscv32, riscv32be, riscv64, riscv64be, rl78, rx, s390, s390x, sh, shle, sparc, sparc64, tic6x, v850, v850e, v850e1, vax, visium, x86_64, xstormy16, xtensa
Here is a list of system types:
aixversion, amdhsa, aout, cygwin, darwinversion, eabi, eabialtivec, eabisim, eabisimaltivec, elf, elf32, elfbare, elfoabi, freebsdversion, gnu, hpux, hpuxversion, kfreebsd-gnu, kopensolaris-gnu, linux-androideabi, linux-gnu, linux-gnu_altivec, linux-musl, linux-uclibc, lynxos, mingw32, mingw32crt, mmixware, msdosdjgpp, netbsd, netbsdelfversion, nto-qnx, openbsd, rtems, solarisversion, symbianelf, tpf, uclinux, uclinux_eabi, vms, vxworks, vxworksae, vxworksmils
1条答案
按热度按时间e5njpo681#
“主机”是GCC、汇编器和链接器将在其上运行的机器
“目标”是运行gcc生成的代码的机器。
因此,如果您想在x86_64机器上运行gcc以生成将在aarch 64机器上运行的二进制文件,则需要host = x86_64和target = aarch 64。
注意,您需要 * 所有 * 工具来实现宿主和目标的组合(汇编器、链接器以及gcc --这些通常是binutils包的一部分)。您还需要为要链接的目标构建库。