交叉编译gcc for Android

时间:2018-01-02 10:46:47

标签: android gcc cross-compiling

我正在尝试使用buildroot生成的工具链来交叉编译Android的gcc。

./configure --prefix=/home/Desktop/gcc_5/build/ CC=/home/buildroot-2017.02-rc3/output/host/usr/bin/aarch64-buildroot-linux-uclibc-gcc CXX=/home/buildroot-2017.02-rc3/output/host/usr/bin/aarch64-buildroot-linux-uclibc-g++  CFLAGS="-I/home/buildroot-2017.02-rc3/output/host/usr/include/  -fPIC -static -lc -lgmp -lmpfr -lmpc" LDFLAGS="-L/home/buildroot-2017.02-rc3/output/host/usr/lib" --host=arm-linux  --disable-shared --disable-f77 --disable-fc --disable-fortran

配置结果

configure: WARNING: If you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used.
checking build system type... x86_64-unknown-linux-uclibc
checking host system type... arm-unknown-linux-gnu
checking target system type... arm-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /bin/sed
checking for gawk... gawk
checking for libatomic support... yes
checking for libcilkrts support... no
checking for libitm support... yes
checking for libsanitizer support... yes
checking for libvtv support... no
checking for arm-linux-gcc... /home/buildroot-2017.02-rc3/output/host/usr/bin/aarch64-linux-gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... yes
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /home/doha/Desktop/buildroot-2017.02-rc3/output/host/usr/bin/aarch64-linux-gcc accepts -g... yes
checking for /home/doha/Desktop/buildroot-2017.02-rc3/output/host/usr/bin/aarch64-linux-gcc option to accept ISO C89... none needed
checking whether we are using the GNU C++ compiler... yes
checking whether /home/doha/Desktop/buildroot-2017.02-rc3/output/host/usr/bin/aarch64-linux-g++ accepts -g... yes
checking whether g++ accepts -static-libstdc++ -static-libgcc... yes
checking for arm-linux-gnatbind... no
checking for gnatbind... no
checking for arm-linux-gnatmake... no
checking for gnatmake... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
checking for objdir... .libs
checking for the correct version of gmp.h... yes
checking for the correct version of mpfr.h... yes
checking for the correct version of mpc.h... yes
checking for the correct version of the gmp/mpfr/mpc libraries... yes
checking for compatible ISL... no
The following languages will be built: c,c++,fortran,java,lto,objc
*** This configuration is not supported in the following subdirectories:
     target-libcilkrts target-libvtv target-libmpx gnattools gotools target-libada target-libgo target-libbacktrace target-liboffloadmic
    (Any other directories should still work fine.)
checking for default BUILD_CONFIG... 
checking for --enable-vtable-verify... no
checking for bison... no
checking for byacc... no
checking for yacc... no
checking for bison... no
checking for gm4... no
checking for gnum4... no
checking for m4... no
checking for flex... no
checking for lex... no
checking for flex... no
checking for makeinfo... no
/home/Desktop/gcc_5/missing: 81: /home/Desktop/gcc_5/missing: makeinfo: not found
checking for expect... no
checking for runtest... no
checking for arm-linux-ar... no
checking for arm-linux-as... no
checking for arm-linux-dlltool... no
checking for ld... (cached) /home/buildroot-2017.02-rc3/output/host/usr/lib/gcc/aarch64-buildroot-linux-uclibc/6.3.0/../../../../aarch64-buildroot-linux-uclibc/bin/ld
checking for arm-linux-ld... (cached) /home/buildroot-2017.02-rc3/output/host/usr/lib/gcc/aarch64-buildroot-linux-uclibc/6.3.0/../../../../aarch64-buildroot-linux-uclibc/bin/ld
checking for arm-linux-lipo... no
checking for arm-linux-nm... no
checking for arm-linux-ranlib... no
checking for arm-linux-strip... no
checking for arm-linux-windres... no
checking for arm-linux-windmc... no
checking for arm-linux-objcopy... no
checking for arm-linux-objdump... no
checking for arm-linux-readelf... no
checking where to find the target ar... pre-installed
checking where to find the target as... pre-installed
checking where to find the target cc... pre-installed
checking where to find the target c++... pre-installed
checking where to find the target c++ for libstdc++... pre-installed
checking where to find the target dlltool... pre-installed
checking where to find the target gcc... pre-installed
checking where to find the target gcj... pre-installed
checking where to find the target gfortran... pre-installed
checking where to find the target gccgo... pre-installed
checking where to find the target ld... pre-installed
checking where to find the target lipo... pre-installed
checking where to find the target nm... pre-installed
checking where to find the target objcopy... pre-installed
checking where to find the target objdump... pre-installed
checking where to find the target ranlib... pre-installed
checking where to find the target readelf... pre-installed
checking where to find the target strip... pre-installed
checking where to find the target windres... pre-installed
checking where to find the target windmc... pre-installed
checking whether to enable maintainer-specific portions of Makefiles... no
configure: creating ./config.status
config.status: creating Makefile

当我尝试make

我收到了这个错误

    make[1]: Entering directory '/home/Desktop/gcc_5'
make[2]: Entering directory '/home/Desktop/gcc_5/host-arm-linux/libiberty'
rm -f ./libiberty.a pic/./libiberty.a noasan/./libiberty.a
arm-linux-ar rc ./libiberty.a \
  ./regex.o ./cplus-dem.o ./cp-demangle.o ./md5.o ./sha1.o ./alloca.o ./argv.o ./choose-temp.o ./concat.o ./cp-demint.o ./crc32.o ./d-demangle.o ./dwarfnames.o ./dyn-string.o ./fdmatch.o ./fibheap.o ./filename_cmp.o ./floatformat.o ./fnmatch.o ./fopen_unlocked.o ./getopt.o ./getopt1.o ./getpwd.o ./getruntime.o ./hashtab.o ./hex.o ./lbasename.o ./lrealpath.o ./make-relative-prefix.o ./make-temp-file.o ./objalloc.o ./obstack.o ./partition.o ./pexecute.o ./physmem.o ./pex-common.o ./pex-one.o ./pex-unix.o ./vprintf-support.o ./rust-demangle.o ./safe-ctype.o ./simple-object.o ./simple-object-coff.o ./simple-object-elf.o ./simple-object-mach-o.o ./simple-object-xcoff.o ./sort.o ./spaces.o ./splay-tree.o ./stack-limit.o ./strerror.o ./strsignal.o ./timeval-utils.o ./unlink-if-ordinary.o ./xasprintf.o ./xatexit.o ./xexit.o ./xmalloc.o ./xmemdup.o ./xstrdup.o ./xstrerror.o ./xstrndup.o ./xvasprintf.o  ./sigsetmask.o ./setproctitle.o
/bin/bash: arm-linux-ar: command not found
Makefile:249: recipe for target 'libiberty.a' failed
make[2]: *** [libiberty.a] Error 127
make[2]: Leaving directory '/home/Desktop/gcc_5/host-arm-linux/libiberty'
Makefile:7779: recipe for target 'all-libiberty' failed
make[1]: *** [all-libiberty] Error 2
make[1]: Leaving directory '/home/Desktop/gcc_5/'
Makefile:896: recipe for target 'all' failed
make: *** [all] Error 2

如何解决这个问题?

0 个答案:

没有答案