https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113648
Bug ID: 113648 Summary: Cross compiler cannot find cross binutils on macOS Product: gcc Version: 13.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: galaxyking0419 at gmail dot com Target Milestone: --- According to https://gcc.gnu.org/install/configure.html, the gcc should find binutils components (e.g., as, ld, objdump) using rule: - Unless GCC is being built with a cross compiler, check the libexec/gcc/target/version directory. libexec defaults to exec-prefix/libexec; exec-prefix defaults to prefix, which defaults to /usr/local unless overridden by the --prefix=pathname switch described above. target is the target system triple, such as ‘sparc-sun-solaris2.11’, and version denotes the GCC version, such as 3.0. If the target system is the same that you are building on, check operating system specific directories. - Check in the PATH for a tool whose name is prefixed by the target system triple. - Check in the PATH for a tool whose name is not prefixed by the target system triple, if the host and target system triple are the same (in other words, we use a host tool if it can be used for the target as well). My setup following the target system triple convention: [u@mbp d]% whereis aarch64-linux-gnu-ld aarch64-linux-gnu-ld: /Volumes/Toolchain/openwrt/bin/aarch64-linux-gnu-ld But the aarch64-linux-gnu-gcc still picks the macOS as, ld etc: [u@mbp d]% aarch64-linux-gnu-gcc -print-prog-name=ld ld [u@mbp d]% aarch64-linux-gnu-gcc -print-prog-name=as as [u@mbp d]% aarch64-linux-gnu-gcc -print-prog-name=objdump objdump GCC configuration: Using built-in specs. COLLECT_GCC=aarch64-linux-gnu-gcc COLLECT_LTO_WRAPPER=/Volumes/Toolchain/openwrt/lib/gcc/aarch64-linux-gnu/13.2.0/lto-wrapper Target: aarch64-linux-gnu Configured with: ../gcc-13.2.0/configure --disable-libgomp --disable-libquadmath --disable-libsanitizer --disable-libssp --disable-libstdcxx-pch --disable-libunwind-exceptions --disable-multilib --disable-nls --disable-werror --enable-__cxa_atexit --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-gnu-indirect-function --enable-gnu-unique-object --enable-install-libiberty --enable-languages=c,c++ --enable-lto --enable-shared --enable-threads=posix --libexecdir=/Volumes/Toolchain/openwrt/lib --prefix=/Volumes/Toolchain/openwrt --program-prefix=aarch64-linux-gnu- --target=aarch64-linux-gnu --with-build-sysroot=/Volumes/Toolchain/openwrt/aarch64-linux-gnu --with-cpu=cortex-a53+crypto --with-glibc-version=2.38 --with-gmp=/opt/homebrew --with-mpc=/opt/homebrew --with-mpfr=/opt/homebrew --with-local-prefix=/Volumes/Toolchain/openwrt/aarch64-linux-gnu --with-sysroot=/Volumes/Toolchain/openwrt/aarch64-linux-gnu --with-system-zlib Thread model: posix Supported LTO compression algorithms: zlib gcc version 13.2.0 (GCC)