GCC: building cross compiler for ARM - pthread.h not found

Using Ubuntu 12.04 host, I followed closely this SO answer here ( Recipe for Compiling Binutils and GCC Together ) to build GCC and binutils in the same tree with all their dependencies.

Here is the config line I am doing inside my build directory:

    ../gcc-4.9.0/configure --target=arm-linux-gnueabi --prefix=/home/mint/cross-arm --disable-werror

      

The Makefile gets set up correctly and then I run:

    sudo make -j8

      

I get into the compilation process for a while, and then eventually, here are the errors:

    In file included from ../../../gcc-4.9.0/libgcc/gthr.h:148:0,
             from ../../../gcc-4.9.0/libgcc/libgcov-interface.c:27:
./gthr-default.h:35:21: fatal error: pthread.h: No such file or directory
#include <pthread.h>
                 ^
compilation terminated.
make[2]: *** [_gcov_flush.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from ../../../gcc-4.9.0/libgcc/gthr.h:148:0,
             from ../../../gcc-4.9.0/libgcc/libgcov-interface.c:27:
./gthr-default.h:35:21: fatal error: pthread.h: No such file or directory
#include <pthread.h>
                 ^
compilation terminated.
make[2]: *** [_gcov_execlp.o] Error 1
In file included from ../../../gcc-4.9.0/libgcc/gthr.h:148:0,
             from ../../../gcc-4.9.0/libgcc/libgcov-interface.c:27:
./gthr-default.h:35:21: fatal error: pthread.h: No such file or directory
#include <pthread.h>
                 ^
In file included from ../../../gcc-4.9.0/libgcc/gthr.h:148:0,
             from ../../../gcc-4.9.0/libgcc/libgcov-interface.c:27:
./gthr-default.h:35:21: fatal error: pthread.h: No such file or directory
#include <pthread.h>
                 ^
compilation terminated.
make[2]: compilation terminated.
*** [_gcov_fork.o] Error 1
make[2]: *** [_gcov_execl.o] Error 1
In file included from ../../../gcc-4.9.0/libgcc/gthr.h:148:0,
             from ../../../gcc-4.9.0/libgcc/libgcov-interface.c:27:
./gthr-default.h:35:21: fatal error: pthread.h: No such file or directory
#include <pthread.h>
                 ^
compilation terminated.
make[2]: *** [_gcov_execle.o] Error 1
make[2]: Leaving directory `/home/mint/Workspaces/src/build/arm-linux-gnueabi/libgcc'
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory `/home/mint/Workspaces/src/build'
make: *** [all] Error 2

      

Am I missing a specific dependency that prevents this build?

PS I installed "build-essential" via apt-get before building.

+3


source to share


1 answer


The error indicates some problems with the C library.

To build a GCC compiler, you need to create binutils + a prebuilt C library beforehand.

In the case of a cross compiler, one of the possible paths is:



  • Make sure you create binutils (cross compilation assembly) beforehand
  • GCC Cross-Compilation: Add Tuning Option - No Headers. Now compile (see Creating targets in the link below).
  • Compile your C library and reference it when compiling your program for the target

See some instructions for cross-compiling gcc here GCC Cross Compiling . Then "install" the appropriate C library (glibc / newlib).

Also, (if you don't already), it might be helpful to make sure the -prefix for bintutils and the gcc cross-compile assembly are the same location.

0


source







All Articles