无法构建ARM交叉编译器:pthread.h缺少

时间:2017-07-18 19:51:45

标签: gcc arm cross-compiling

我试图按照我发现的各种页面上的说明,在ARMv6(在AMD64主机上)上构建一个针对Linux的交叉编译器,但每次遇到同样的错误时:

~/projects/kobo/gcc> echo $TARGET
arm-linux-gnueabi

~/projects/kobo/gcc> echo $PREFIX
/usr/local/arm-linux-gnueabi

~/projects/kobo/gcc> echo $PATH
/usr/local/arm-linux-gnueabi/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/android-sdk/platform-tools/:/usr/local/pspdev/bin:/usr/local/pspdev/psp/sdk/bin:/opt/devkitpro/devkitARM/bin

~/projects/kobo/gcc> cd build-binutils/

…/kobo/gcc/build-binutils> ../binutils-2.28/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror

checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... arm-unknown-linux-gnueabi
checking for a BSD-compatible install... /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 gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
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 for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether g++ accepts -static-libstdc++ -static-libgcc... yes
checking for gnatbind... 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 isl 0.16, 0.15, or deprecated 0.14... no
recommended isl version is 0.16 or 0.15, the minimum required isl version 0.14 is deprecated
checking for isl 0.16 or 0.15... no
checking for default BUILD_CONFIG... 
checking for --enable-vtable-verify... no
*** removing intl/Makefile to force reconfigure
*** removing libiberty/Makefile to force reconfigure
*** removing opcodes/Makefile to force reconfigure
*** removing bfd/Makefile to force reconfigure
*** removing zlib/Makefile to force reconfigure
*** removing binutils/Makefile to force reconfigure
*** removing gas/Makefile to force reconfigure
*** removing ld/Makefile to force reconfigure
*** removing gprof/Makefile to force reconfigure
*** removing etc/Makefile to force reconfigure
checking for bison... bison -y
checking for bison... bison
checking for gm4... no
checking for gnum4... no
checking for m4... m4
checking for flex... flex
checking for flex... flex
checking for makeinfo... makeinfo
checking for expect... expect
checking for runtest... no
checking for ar... ar
checking for as... as
checking for dlltool... no
checking for ld... ld
checking for lipo... no
checking for nm... nm
checking for ranlib... ranlib
checking for strip... strip
checking for windres... no
checking for windmc... no
checking for objcopy... objcopy
checking for objdump... objdump
checking for readelf... readelf
checking for arm-linux-gnueabi-cc... no
checking for arm-linux-gnueabi-gcc... no
checking for arm-linux-gnueabi-c++... no
checking for arm-linux-gnueabi-g++... no
checking for arm-linux-gnueabi-cxx... no
checking for arm-linux-gnueabi-gxx... no
checking for arm-linux-gnueabi-gcc... no
checking for arm-linux-gnueabi-gcj... no
checking for arm-linux-gnueabi-gfortran... no
checking for arm-linux-gnueabi-gccgo... no
checking for arm-linux-gnueabi-ar... no
checking for arm-linux-gnueabi-as... no
checking for arm-linux-gnueabi-dlltool... no
checking for arm-linux-gnueabi-ld... no
checking for arm-linux-gnueabi-lipo... no
checking for arm-linux-gnueabi-nm... no
checking for arm-linux-gnueabi-objcopy... no
checking for arm-linux-gnueabi-objdump... no
checking for arm-linux-gnueabi-ranlib... no
checking for arm-linux-gnueabi-readelf... no
checking for arm-linux-gnueabi-strip... no
checking for arm-linux-gnueabi-windres... no
checking for arm-linux-gnueabi-windmc... no
checking where to find the target ar... just compiled
checking where to find the target as... just compiled
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... just compiled
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... just compiled
checking where to find the target lipo... pre-installed
checking where to find the target nm... just compiled
checking where to find the target objcopy... just compiled
checking where to find the target objdump... just compiled
checking where to find the target ranlib... just compiled
checking where to find the target readelf... just compiled
checking where to find the target strip... just compiled
checking where to find the target windres... just compiled
checking where to find the target windmc... just compiled
checking whether to enable maintainer-specific portions of Makefiles... no
configure: creating ./config.status
config.status: creating Makefile

…/kobo/gcc/build-binutils> make all
[...]

…/kobo/gcc/build-binutils> sudo make install
[...]

…/kobo/gcc/build-binutils> cd ../build-gcc/

~/projects/kobo/gcc/build-gcc> ../gcc-7.1.0/configure --target=$TARGET --prefix=$PREFIX --with-arch=armv6 --with-fpu=vfp --with-float=softfp --disable-sjlj-exceptions --enable-checking=release --enable-linker-build-id --enable-gnu-unique-object --disable-nls --enable-languages=c --without-headers --disable-shared --disable-threads --disable-multilib --disable-decimal-float --disable-libmudflap --disable-libssp --disable-libgomp --disable-lto --without-ppl --without-cloog
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... arm-unknown-linux-gnueabi
checking for a BSD-compatible install... /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... yes
checking for libitm support... yes
checking for libsanitizer support... yes
checking for libvtv support... yes
checking for libmpx support... no
checking for libhsail-rt support... no
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
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 for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether g++ accepts -static-libstdc++ -static-libgcc... yes
checking for gnatbind... 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 isl 0.15 or later... no
required isl version is 0.15 or later
*** This configuration is not supported in the following subdirectories:
     target-libmpx gnattools gotools target-libada target-libhsail-rt target-libstdc++-v3 target-libgfortran target-libbacktrace target-libgo target-libffi target-libobjc target-libgomp target-liboffloadmic target-libssp target-libcilkrts target-libitm target-libsanitizer target-libvtv
    (Any other directories should still work fine.)
checking for default BUILD_CONFIG... 
checking for --enable-vtable-verify... no
*** removing build-x86_64-pc-linux-gnu/libiberty/Makefile to force reconfigure
*** removing build-x86_64-pc-linux-gnu/libcpp/Makefile to force reconfigure
*** removing build-x86_64-pc-linux-gnu/fixincludes/Makefile to force reconfigure
*** removing intl/Makefile to force reconfigure
*** removing libiberty/Makefile to force reconfigure
*** removing zlib/Makefile to force reconfigure
*** removing libbacktrace/Makefile to force reconfigure
*** removing libcpp/Makefile to force reconfigure
*** removing libdecnumber/Makefile to force reconfigure
*** removing fixincludes/Makefile to force reconfigure
*** removing gcc/Makefile to force reconfigure
*** removing arm-linux-gnueabi/libgcc/Makefile to force reconfigure
checking for bison... bison -y
checking for bison... bison
checking for gm4... no
checking for gnum4... no
checking for m4... m4
checking for flex... flex
checking for flex... flex
checking for makeinfo... makeinfo
checking for expect... expect
checking for runtest... no
checking for ar... ar
checking for as... as
checking for dlltool... no
checking for ld... ld
checking for lipo... no
checking for nm... nm
checking for ranlib... ranlib
checking for strip... strip
checking for windres... no
checking for windmc... no
checking for objcopy... objcopy
checking for objdump... objdump
checking for readelf... readelf
checking for arm-linux-gnueabi-cc... no
checking for arm-linux-gnueabi-gcc... no
checking for arm-linux-gnueabi-c++... no
checking for arm-linux-gnueabi-g++... no
checking for arm-linux-gnueabi-cxx... no
checking for arm-linux-gnueabi-gxx... no
checking for arm-linux-gnueabi-gcc... no
checking for arm-linux-gnueabi-gfortran... no
checking for arm-linux-gnueabi-gccgo... no
checking for ar... /usr/local/arm-linux-gnueabi/arm-linux-gnueabi/bin/ar
checking for as... /usr/local/arm-linux-gnueabi/arm-linux-gnueabi/bin/as
checking for dlltool... no
checking for arm-linux-gnueabi-dlltool... no
checking for ld... /usr/local/arm-linux-gnueabi/arm-linux-gnueabi/bin/ld
checking for lipo... no
checking for arm-linux-gnueabi-lipo... no
checking for nm... /usr/local/arm-linux-gnueabi/arm-linux-gnueabi/bin/nm
checking for objcopy... /usr/local/arm-linux-gnueabi/arm-linux-gnueabi/bin/objcopy
checking for objdump... /usr/local/arm-linux-gnueabi/arm-linux-gnueabi/bin/objdump
checking for ranlib... /usr/local/arm-linux-gnueabi/arm-linux-gnueabi/bin/ranlib
checking for readelf... /usr/local/arm-linux-gnueabi/arm-linux-gnueabi/bin/readelf
checking for strip... /usr/local/arm-linux-gnueabi/arm-linux-gnueabi/bin/strip
checking for windres... no
checking for arm-linux-gnueabi-windres... no
checking for windmc... no
checking for arm-linux-gnueabi-windmc... no
checking where to find the target ar... pre-installed in /usr/local/arm-linux-gnueabi/arm-linux-gnueabi/bin
checking where to find the target as... pre-installed in /usr/local/arm-linux-gnueabi/arm-linux-gnueabi/bin
checking where to find the target cc... just compiled
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... just compiled
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 in /usr/local/arm-linux-gnueabi/arm-linux-gnueabi/bin
checking where to find the target lipo... pre-installed
checking where to find the target nm... pre-installed in /usr/local/arm-linux-gnueabi/arm-linux-gnueabi/bin
checking where to find the target objcopy... pre-installed in /usr/local/arm-linux-gnueabi/arm-linux-gnueabi/bin
checking where to find the target objdump... pre-installed in /usr/local/arm-linux-gnueabi/arm-linux-gnueabi/bin
checking where to find the target ranlib... pre-installed in /usr/local/arm-linux-gnueabi/arm-linux-gnueabi/bin
checking where to find the target readelf... pre-installed in /usr/local/arm-linux-gnueabi/arm-linux-gnueabi/bin
checking where to find the target strip... pre-installed in /usr/local/arm-linux-gnueabi/arm-linux-gnueabi/bin
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

~/projects/kobo/gcc/build-gcc> make all-gcc
[...]

~/projects/kobo/gcc/build-gcc> sudo make install-gcc
[...]

~/projects/kobo/gcc/build-gcc> make all-target-libgcc
[...]
../../../gcc-7.1.0/libgcc/config/arm/fp16.c:169:1: warning: no previous prototype for '__gnu_h2f_internal' [-Wmissing-prototypes]
 __gnu_h2f_internal(unsigned short a, int ieee)
 ^~~~~~~~~~~~~~~~~~
../../../gcc-7.1.0/libgcc/config/arm/fp16.c:194:1: warning: no previous prototype for '__gnu_f2h_ieee' [-Wmissing-prototypes]
 __gnu_f2h_ieee(unsigned int a)
 ^~~~~~~~~~~~~~
../../../gcc-7.1.0/libgcc/config/arm/fp16.c:200:1: warning: no previous prototype for '__gnu_h2f_ieee' [-Wmissing-prototypes]
 __gnu_h2f_ieee(unsigned short a)
 ^~~~~~~~~~~~~~
../../../gcc-7.1.0/libgcc/config/arm/fp16.c:206:1: warning: no previous prototype for '__gnu_f2h_alternative' [-Wmissing-prototypes]
 __gnu_f2h_alternative(unsigned int x)
 ^~~~~~~~~~~~~~~~~~~~~
../../../gcc-7.1.0/libgcc/config/arm/fp16.c:212:1: warning: no previous prototype for '__gnu_h2f_alternative' [-Wmissing-prototypes]
 __gnu_h2f_alternative(unsigned short a)
 ^~~~~~~~~~~~~~~~~~~~~
../../../gcc-7.1.0/libgcc/config/arm/fp16.c:218:1: warning: no previous prototype for '__gnu_d2h_ieee' [-Wmissing-prototypes]
 __gnu_d2h_ieee (unsigned long long a)
 ^~~~~~~~~~~~~~
../../../gcc-7.1.0/libgcc/config/arm/fp16.c:224:1: warning: no previous prototype for '__gnu_d2h_alternative' [-Wmissing-prototypes]
 __gnu_d2h_alternative (unsigned long long x)
 ^~~~~~~~~~~~~~~~~~~~~
mv -f libunwind.visT libunwind.vis
/home/rena/projects/kobo/gcc/build-gcc/./gcc/xgcc -B/home/rena/projects/kobo/gcc/build-gcc/./gcc/ -B/usr/local/arm-linux-gnueabi/arm-linux-gnueabi/bin/ -B/usr/local/arm-linux-gnueabi/arm-linux-gnueabi/lib/ -isystem /usr/local/arm-linux-gnueabi/arm-linux-gnueabi/include -isystem /usr/local/arm-linux-gnueabi/arm-linux-gnueabi/sys-include    -g -O2 -O2  -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fPIC -fno-inline -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -Dinhibit_libc  -fPIC -fno-inline -I. -I. -I../.././gcc -I../../../gcc-7.1.0/libgcc -I../../../gcc-7.1.0/libgcc/. -I../../../gcc-7.1.0/libgcc/../gcc -I../../../gcc-7.1.0/libgcc/../include  -DHAVE_CC_TLS  -o pr-support.o -MT pr-support.o -MD -MP -MF pr-support.dep -fexceptions -c ../../../gcc-7.1.0/libgcc/config/arm/pr-support.c -fvisibility=hidden -DHIDE_EXPORTS
/home/rena/projects/kobo/gcc/build-gcc/./gcc/xgcc -B/home/rena/projects/kobo/gcc/build-gcc/./gcc/ -B/usr/local/arm-linux-gnueabi/arm-linux-gnueabi/bin/ -B/usr/local/arm-linux-gnueabi/arm-linux-gnueabi/lib/ -isystem /usr/local/arm-linux-gnueabi/arm-linux-gnueabi/include -isystem /usr/local/arm-linux-gnueabi/arm-linux-gnueabi/sys-include    -g -O2 -O2  -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fPIC -fno-inline -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -Dinhibit_libc  -fPIC -fno-inline -I. -I. -I../.././gcc -I../../../gcc-7.1.0/libgcc -I../../../gcc-7.1.0/libgcc/. -I../../../gcc-7.1.0/libgcc/../gcc -I../../../gcc-7.1.0/libgcc/../include  -DHAVE_CC_TLS  -o unwind-c.o -MT unwind-c.o -MD -MP -MF unwind-c.dep -fexceptions -c ../../../gcc-7.1.0/libgcc/unwind-c.c -fvisibility=hidden -DHIDE_EXPORTS
In file included from ../../../gcc-7.1.0/libgcc/config/arm/unwind-arm.c:143:0:
../../../gcc-7.1.0/libgcc/unwind-arm-common.inc: In function 'get_eit_entry':
../../../gcc-7.1.0/libgcc/unwind-arm-common.inc:245:29: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
       ucbp->pr_cache.ehtp = (_Unwind_EHT_Header *)&eitp->content;
                             ^
/home/rena/projects/kobo/gcc/build-gcc/./gcc/xgcc -B/home/rena/projects/kobo/gcc/build-gcc/./gcc/ -B/usr/local/arm-linux-gnueabi/arm-linux-gnueabi/bin/ -B/usr/local/arm-linux-gnueabi/arm-linux-gnueabi/lib/ -isystem /usr/local/arm-linux-gnueabi/arm-linux-gnueabi/include -isystem /usr/local/arm-linux-gnueabi/arm-linux-gnueabi/sys-include    -g -O2 -O2  -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fPIC -fno-inline -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -Dinhibit_libc  -fPIC -fno-inline -I. -I. -I../.././gcc -I../../../gcc-7.1.0/libgcc -I../../../gcc-7.1.0/libgcc/. -I../../../gcc-7.1.0/libgcc/../gcc -I../../../gcc-7.1.0/libgcc/../include  -DHAVE_CC_TLS  -o emutls.o -MT emutls.o -MD -MP -MF emutls.dep -fexceptions -c ../../../gcc-7.1.0/libgcc/emutls.c -fvisibility=hidden -DHIDE_EXPORTS
/home/rena/projects/kobo/gcc/build-gcc/./gcc/xgcc -B/home/rena/projects/kobo/gcc/build-gcc/./gcc/ -B/usr/local/arm-linux-gnueabi/arm-linux-gnueabi/bin/ -B/usr/local/arm-linux-gnueabi/arm-linux-gnueabi/lib/ -isystem /usr/local/arm-linux-gnueabi/arm-linux-gnueabi/include -isystem /usr/local/arm-linux-gnueabi/arm-linux-gnueabi/sys-include    -g -O2 -O2  -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fPIC -fno-inline -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -Dinhibit_libc  -fPIC -fno-inline -I. -I. -I../.././gcc -I../../../gcc-7.1.0/libgcc -I../../../gcc-7.1.0/libgcc/. -I../../../gcc-7.1.0/libgcc/../gcc -I../../../gcc-7.1.0/libgcc/../include  -DHAVE_CC_TLS  -o _gcov_merge_add.o -MT _gcov_merge_add.o -MD -MP -MF _gcov_merge_add.dep -DL_gcov_merge_add -c ../../../gcc-7.1.0/libgcc/libgcov-merge.c
In file included from ../../../gcc-7.1.0/libgcc/gthr.h:148:0,
                 from ../../../gcc-7.1.0/libgcc/emutls.c:31:
./gthr-default.h:35:10: fatal error: pthread.h: No such file or directory
 #include <pthread.h>
          ^~~~~~~~~~~
compilation terminated.
make[1]: *** [../../../gcc-7.1.0/libgcc/static-object.mk:17: emutls.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/home/rena/projects/kobo/gcc/build-gcc/arm-linux-gnueabi/libgcc'
make: *** [Makefile:11190: all-target-libgcc] Error 2

我不知道为什么pthread.h总是丢失。添加--disable-threads并没有帮助。我做错了什么?

0 个答案:

没有答案