您的位置:首页 > 运维架构 > Linux

CentOS 6.9 制作crosstool-ng交叉编译 错误日志

2018-03-15 12:36 363 查看
crosstool-ng 制作交叉编译 CentOS 6.9版本制作 错误日志

[klaus@localhost crosstool-ng-1.16.0]$ ls
bootstrap  configure     contrib  ct-ng.comp  docs     LICENSES    Makefile.in  README   scripts   TODO
config     configure.ac  COPYING  ct-ng.in    kconfig  licenses.d  patches      samples  steps.mk
[klaus@localhost crosstool-ng-1.16.0]$ ./configure --prefix=`pwd`
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking whether sed understands -r -i -e... yes
checking whether ln -s works... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for ranlib... ranlib
checking for objcopy... objcopy
checking for absolute path to objcopy... /usr/bin/objcopy
checking for objdump... objdump
checking for absolute path to objdump... /usr/bin/objdump
checking for readelf... readelf
checking for absolute path to readelf... /usr/bin/readelf
checking for bison... no
configure: error: missing required tool: bison


缺少部分组件,执行

[klaus@localhost ~]$ sudo yum install "automake" "autoconf" "bison" "gcc" "gcc-c++" "make" "zlib" "texinfo" "flex" "cmake" "zlib-devel" "openssl-devel" "gperf" "*curses*"
[klaus@localhost ~]$ sudo yum group mark install -y "Development Tools"


[klaus@localhost tarballs]$ cd ..
[klaus@localhost crosstool-ng-1.16.0]$ ./ct-ng build
[INFO ]  Performing some trivial sanity checks
[00:00] / touch: cannot touch `/backtrace': Permission denied
[ERROR]
[ERROR]  >>
[ERROR]  >>  Build failed in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in: CT_DoExecLog[scripts/functions@172]
[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@64]
[00:00] / touch: cannot touch `/backtrace': Permission denied
[ERROR]
[ERROR]  >>
[ERROR]  >>  Build failed in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in: CT_DoExecLog[scripts/functions@158]

[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@64]
[ERROR]  >>
[ERROR]  >>  For more info on this error, look at the file: 'build.log'
[ERROR]  >>  There is a list of known issues, some with workarounds, in:
[ERROR]  >>      'share/doc/crosstool-ng/ct-ng.1.16.0/B - Known issues.txt'
[ERROR]
[ERROR]  (elapsed: 25351863:48.56)
[00:00] / make: *** [build] Error 1


权限不够

[klaus@localhost crosstool-ng-1.16.0]$ sudo ./ct-ng build
[sudo] password for klaus:
[INFO ]  Performing some trivial sanity checks
[INFO ]  Build started 20180315.040856
[INFO ]  Building environment variables
[EXTRA]  Preparing working directories


新问题,生成的文件发现没有../bin/文件也就是没有生成交叉编译器,博主已经重新做了一遍

[INFO ]  Finishing installation (may take a few seconds)...
[24:20] / [klaus@localhost crosstool-ng-1.16.0]$
[klaus@localhost crosstool-ng-1.16.0]$
[klaus@localhost crosstool-ng-1.16.0]$ /opt/x-tools/arm920t/bin/arm-arm920t-linux-gnueabi-gcc -v
Using built-in specs.
Target: arm-arm920t-linux-gnueabi
Configured with: /home/klaus/crosstool/crosstool-ng-1.16.0/.build/src/gcc-4.4.6/configure --build=x86_64-build_unknown-linux-gnu --host=x86_64-build_unknown-linux-gnu --target=arm-arm920t-linux-gnueabi --prefix=/opt/x-tools/arm920t --with-sysroot=/opt/x-tools/arm920t/arm-arm920t-linux-gnueabi/sysroot --enable-languages=c,c++ --with-arch=armv4t --with-cpu=arm9tdmi --with-tune=arm920t --with-float=soft --with-pkgversion='crosstool-NG 1.16.0' --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --with-gmp=/home/klaus/crosstool/crosstool-ng-1.16.0/.build/arm-arm920t-linux-gnueabi/buildtools --with-mpfr=/home/klaus/crosstool/crosstool-ng-1.16.0/.build/arm-arm920t-linux-gnueabi/buildtools --with-ppl=/home/klaus/crosstool/crosstool-ng-1.16.0/.build/arm-arm920t-linux-gnueabi/buildtools --with-cloog=/home/klaus/crosstool/crosstool-ng-1.16.0/.build/arm-arm920t-linux-gnueabi/buildtools --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --enable-threads=posix --enable-target-optspace --disable-nls --disable-multilib --with-local-prefix=/opt/x-tools/arm920t/arm-arm920t-linux-gnueabi/sysroot --enable-c99 --enable-long-long
Thread model: posix
gcc version 4.4.6 (crosstool-NG 1.16.0)
[klaus@localhost crosstool-ng-1.16.0]$


问题解决

[klaus@localhost Documents]$ /opt/x-tools/arm920t/bin/arm-arm920t-linux-gnueabi-gcc hello.c -o hello
[klaus@localhost Documents]$ file hello
hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 3.5.0, not stripped
[klaus@localhost Documents]$ du -h hello
8.0K    hello
[klaus@localhost Documents]$ /opt/x-tools/arm920t/bin/arm-arm920t-linux-gnueabi-gcc hello -o hello -static
hello: file not recognized: File truncated
collect2: ld returned 1 exit status
[klaus@localhost Documents]$ file hello
hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 3.5.
124aa
0, not stripped
[klaus@localhost Documents]$ du -h hello
564K    hello
[klaus@localhost Documents]$ file hello
hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 3.5.0, not stripped


效果还行

[klaus@localhost Documents]$  cd /opt/x-tools/arm920t/bin/
[klaus@localhost bin]$ vim symlink.sh


#!/bin/bash
for file in `ls arm-*-gnueabi-*` ; do
#!/bin/bash
for file in `ls arm-*-gnueabi-*` ; do
sym_file=arm-linux-`echo $file | awk -F '-' '{print $NF}'`
ln -s $file $sym_file
done


执行看一下结果

[klaus@localhost bin]$ sudo bash symlink.sh
[klaus@localhost bin]$ ls
arm-arm920t-linux-gnueabi-addr2line     arm-arm920t-linux-gnueabi-gprof     arm-linux-addr2line  arm-linux-ldd
arm-arm920t-linux-gnueabi-ar            arm-arm920t-linux-gnueabi-ld        arm-linux-ar         arm-linux-ng.config
arm-arm920t-linux-gnueabi-as            arm-arm920t-linux-gnueabi-ldd       arm-linux-as         arm-linux-nm
arm-arm920t-linux-gnueabi-c++           arm-arm920t-linux-gnueabi-nm        arm-linux-c++        arm-linux-objcopy
arm-arm920t-linux-gnueabi-cc            arm-arm920t-linux-gnueabi-objcopy   arm-linux-cc         arm-linux-objdump
arm-arm920t-linux-gnueabi-c++filt       arm-arm920t-linux-gnueabi-objdump   arm-linux-c++filt    arm-linux-populate
arm-arm920t-linux-gnueabi-cpp           arm-arm920t-linux-gnueabi-populate  arm-linux-cpp        arm-linux-ranlib
arm-arm920t-linux-gnueabi-ct-ng.config  arm-arm920t-linux-gnueabi-ranlib    arm-linux-g++        arm-linux-readelf
arm-arm920t-linux-gnueabi-g++           arm-arm920t-linux-gnueabi-readelf   arm-linux-gcc        arm-linux-size
arm-arm920t-linux-gnueabi-gcc           arm-arm920t-linux-gnueabi-size      arm-linux-gccbug     arm-linux-strings
arm-arm920t-linux-gnueabi-gcc-4.4.6     arm-arm920t-linux-gnueabi-strings   arm-linux-gcov       arm-linux-strip
arm-arm920t-linux-gnueabi-gccbug        arm-arm920t-linux-gnueabi-strip     arm-linux-gprof      symlink.sh
arm-arm920t-linux-gnueabi-gcov          arm-linux-4.4.6                     arm-linux-ld
[klaus@localhost bin]$ /opt/x-tools/arm920t/bin/arm-linux-gc
arm-linux-gcc     arm-linux-gccbug  arm-linux-gcov
[klaus@localhost bin]$ /opt/x-tools/arm920t/bin/arm-linux-gcc -v
Using built-in specs.
Target: arm-arm920t-linux-gnueabi
Configured with: /home/klaus/crosstool/crosstool-ng-1.16.0/.build/src/gcc-4.4.6/configure --build=x86_64-build_unknown-linux-gnu --host=x86_64-build_unknown-linux-gnu --target=arm-arm920t-linux-gnueabi --prefix=/opt/x-tools/arm920t --with-sysroot=/opt/x-tools/arm920t/arm-arm920t-linux-gnueabi/sysroot --enable-languages=c,c++ --with-arch=armv4t --with-cpu=arm9tdmi --with-tune=arm920t --with-float=soft --with-pkgversion='crosstool-NG 1.16.0' --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --with-gmp=/home/klaus/crosstool/crosstool-ng-1.16.0/.build/arm-arm920t-linux-gnueabi/buildtools --with-mpfr=/home/klaus/crosstool/crosstool-ng-1.16.0/.build/arm-arm920t-linux-gnueabi/buildtools --with-ppl=/home/klaus/crosstool/crosstool-ng-1.16.0/.build/arm-arm920t-linux-gnueabi/buildtools --with-cloog=/home/klaus/crosstool/crosstool-ng-1.16.0/.build/arm-arm920t-linux-gnueabi/buildtools --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --enable-threads=posix --enable-target-optspace --disable-nls --disable-multilib --with-local-prefix=/opt/x-tools/arm920t/arm-arm920t-linux-gnueabi/sysroot --enable-c99 --enable-long-long
Thread model: posix
gcc version 4.4.6 (crosstool-NG 1.16.0)
[klaus@localhost bin]$
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: