1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| cd $TOOLCHAIN/src/gcc-7.5.0 mkdir build-aarch64 && cd build-aarch64
export LIBRARY_PATH=
../configure --prefix=$AARCH64 \ --host=aarch64-linux-gnu --target=aarch64-linux-gnu \ --enable-languages=c,c++ \ --disable-multilib
make -j8 make install
# 遇到问题 1. LIBRARY_PATH shouldn't contain the current directory when building gcc 查看是否含有可能会出现当前路径: echo $LIBRARY_PATH 暂时屏蔽掉: export LIBRARY_PATH= 重新运行 configure 然后再编译
2. 有 error 停止编译,可以查看 config.log 定位 error 位置 如果改动了 configure,然后想要重新编译的话,记得执行 make distclean; make clean 清理 cache。再重新编译。如果还有相关问题,那就删除编译目录 build_aarch64,在重新创建,重新编译。
3. 遇到如下的问题不用理会,继续往下找错误 gcc: error: unrecognized command line option '-V' gcc: fatal error: no input files compilation terminated.
4. 遇到 /usr/bin/ld: unrecognised emulation mode: aarch64linux 疑惑点是本不应该使用本机的 x86 链接器:/usr/bin/ld。但是却使用了,一定是指定的链接器路径有问题。警告一番周折,发现是没有安装 aarch64 架构的交叉工具链,还有一定要设置 CC、CXX 等这些环境变量。 要使用 aarch64-linux-gnu,不要使用 aarch64-linux。
|