I am finally going to admit defeat and come ask for help on this. I am
trying to build a cross-compiler to run on an x86 machine for several
targets: ARM, MIPS, AVR, and m681x. I would like a single compiler to
handle those 4 architectures in addition to the x86, eventually.
However, for now, I am just trying to get the individual targets able to
compile.
I can get the binutils to compile/install/run just fine. The compiler
build, however, is not cooperating, and I am almost certain I am
overlooking something remarkably simple, but I just don't see it. I
have my source tree installed in /mnt/tmp/gcc-4.1.2 and I am building in
/mnt/tmp/objdir. (I found one recommendation to always build in a
seperate directory.) I configure it with the following (as run from in
objdir):
../gcc-4.1.2/configure --prefix=/mnt/tmp --program-prefix=mips-elf- \
--target=mips-elf --enable-threads=posix --enable-shared \
--enable-languages=c --disable-checking --with-gnu-ld --verbose
This should, as I understand it, build the MIPS's compiler and after
running "make install"put it in the /mnt/tmp/bin directory, prefixing
each executable with "mips-elf-" right?
After configure runs, I just type 'make' to build the compiler.
Everything goes OK (now that I figured out the --enable-threads=posix
thing), until I get to this (I apologize about the formatting, but I
wanted to send exactly what I see):
/mnt/tmp/objdir/./gcc/xgcc -B/mnt/tmp/objdir/./gcc/
-B/mnt/tmp/mips-elf/bin/ -B/mnt/tmp/mips-elf/lib/ -isystem
/mnt/tmp/mips-elf/include -isystem /mnt/tmp/mips-elf/sys-include -O2
-O2 -g -O2 -DIN_GCC -DCROSS_COMPILE -W -Wall -Wwrite-strings
-Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition
-isystem ./include -G 0 -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2
-D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc -I. -I. -I../../gcc-4.1.2/gcc
-I../../gcc-4.1.2/gcc/. -I../../gcc-4.1.2/gcc/../include
-I../../gcc-4.1.2/gcc/../libcpp/include -fexceptions -c
../../gcc-4.1.2/gcc/unwind-dw2.c -o libgcc/./unwind-dw2.o
In file included from ./gthr-default.h:1,
from ../../gcc-4.1.2/gcc/gthr.h:114,
from ../../gcc-4.1.2/gcc/unwind-dw2.c:42:
../../gcc-4.1.2/gcc/gthr-posix.h:43:21: error: pthread.h: No such file
or directory
../../gcc-4.1.2/gcc/gthr-posix.h:44:20: error: unistd.h: No such file or
directory
In file included from ./gthr-default.h:1,
from ../../gcc-4.1.2/gcc/gthr.h:114,
from ../../gcc-4.1.2/gcc/unwind-dw2.c:42:
../../gcc-4.1.2/gcc/gthr-posix.h:46: error: expected '=', ',', ';',
'asm' or '__attribute__' before '__gthread_key_t'
../../gcc-4.1.2/gcc/gthr-posix.h:47: error: expected '=', ',', ';',
'asm' or '__attribute__' before '__gthread_once_t'
../../gcc-4.1.2/gcc/gthr-posix.h:48: error: expected '=', ',', ';',
'asm' or '__attribute__' before '__gthread_mutex_t'
../../gcc-4.1.2/gcc/gthr-posix.h:49: error: expected '=', ',', ';',
'asm' or '__attribute__' before '__gthread_recursive_mutex_t'
../../gcc-4.1.2/gcc/gthr-posix.h:88: error: 'pthread_once' undeclared
here (not in a function)
../../gcc-4.1.2/gcc/gthr-posix.h:88: warning: type defaults to 'int' in
declaration of '__gthrw_pthread_once'
../../gcc-4.1.2/gcc/gthr-posix.h:89: error: 'pthread_getspecific'
undeclared here (not in a function)
../../gcc-4.1.2/gcc/gthr-posix.h:89: warning: type defaults to 'int' in
declaration of '__gthrw_pthread_getspecific'
../../gcc-4.1.2/gcc/gthr-posix.h:90: error: 'pthread_setspecific'
undeclared here (not in a function)
../../gcc-4.1.2/gcc/gthr-posix.h:90: warning: type defaults to 'int' in
declaration of '__gthrw_pthread_setspecific'
../../gcc-4.1.2/gcc/gthr-posix.h:91: error: 'pthread_create' undeclared
here (not in a function)
../../gcc-4.1.2/gcc/gthr-posix.h:91: warning: type defaults to 'int' in
declaration of '__gthrw_pthread_create'
../../gcc-4.1.2/gcc/gthr-posix.h:92: error: 'pthread_cancel' undeclared
here (not in a function)
../../gcc-4.1.2/gcc/gthr-posix.h:92: warning: type defaults to 'int' in
declaration of '__gthrw_pthread_cancel'
../../gcc-4.1.2/gcc/gthr-posix.h:93: error: 'pthread_mutex_lock'
undeclared here (not in a function)
../../gcc-4.1.2/gcc/gthr-posix.h:93: warning: type defaults to 'int' in
declaration of '__gthrw_pthread_mutex_lock'
../../gcc-4.1.2/gcc/gthr-posix.h:94: error: 'pthread_mutex_trylock'
undeclared here (not in a function)
../../gcc-4.1.2/gcc/gthr-posix.h:94: warning: type defaults to 'int' in
declaration of '__gthrw_pthread_mutex_trylock'
../../gcc-4.1.2/gcc/gthr-posix.h:95: error: 'pthread_mutex_unlock'
undeclared here (not in a function)
../../gcc-4.1.2/gcc/gthr-posix.h:95: warning: type defaults to 'int' in
declaration of '__gthrw_pthread_mutex_unlock'
../../gcc-4.1.2/gcc/gthr-posix.h:96: error: 'pthread_mutex_init'
undeclared here (not in a function)
../../gcc-4.1.2/gcc/gthr-posix.h:96: warning: type defaults to 'int' in
declaration of '__gthrw_pthread_mutex_init'
../../gcc-4.1.2/gcc/gthr-posix.h:99: error: 'pthread_key_create'
undeclared here (not in a function)
../../gcc-4.1.2/gcc/gthr-posix.h:99: warning: type defaults to 'int' in
declaration of '__gthrw_pthread_key_create'
../../gcc-4.1.2/gcc/gthr-posix.h:100: error: 'pthread_key_delete'
undeclared here (not in a function)
../../gcc-4.1.2/gcc/gthr-posix.h:100: warning: type defaults to 'int' in
declaration of '__gthrw_pthread_key_delete'
../../gcc-4.1.2/gcc/gthr-posix.h:101: error: 'pthread_mutexattr_init'
undeclared here (not in a function)
../../gcc-4.1.2/gcc/gthr-posix.h:101: warning: type defaults to 'int' in
declaration of '__gthrw_pthread_mutexattr_init'
../../gcc-4.1.2/gcc/gthr-posix.h:102: error: 'pthread_mutexattr_settype'
undeclared here (not in a function)
../../gcc-4.1.2/gcc/gthr-posix.h:102: warning: type defaults to 'int' in
declaration of '__gthrw_pthread_mutexattr_settype'
../../gcc-4.1.2/gcc/gthr-posix.h:103: error: 'pthread_mutexattr_destroy'
undeclared here (not in a function)
../../gcc-4.1.2/gcc/gthr-posix.h:103: warning: type defaults to 'int' in
declaration of '__gthrw_pthread_mutexattr_destroy'
../../gcc-4.1.2/gcc/gthr-posix.h:513: error: expected ')' before '*' token
../../gcc-4.1.2/gcc/gthr-posix.h:522: error: expected ')' before '*' token
../../gcc-4.1.2/gcc/gthr-posix.h:528: error: expected ')' before 'key'
../../gcc-4.1.2/gcc/gthr-posix.h:534: error: expected ')' before 'key'
../../gcc-4.1.2/gcc/gthr-posix.h:540: error: expected ')' before 'key'
../../gcc-4.1.2/gcc/gthr-posix.h:546: error: expected ')' before '*' token
../../gcc-4.1.2/gcc/gthr-posix.h:555: error: expected ')' before '*' token
../../gcc-4.1.2/gcc/gthr-posix.h:564: error: expected ')' before '*' token
../../gcc-4.1.2/gcc/gthr-posix.h:574: error: expected ')' before '*' token
../../gcc-4.1.2/gcc/gthr-posix.h:595: error: expected ')' before '*' token
../../gcc-4.1.2/gcc/gthr-posix.h:601: error: expected ')' before '*' token
../../gcc-4.1.2/gcc/gthr-posix.h:607: error: expected ')' before '*' token
../../gcc-4.1.2/gcc/unwind-dw2.c: In function 'uw_init_context_1':
../../gcc-4.1.2/gcc/unwind-dw2.c:1259: error: expected '=', ',', ';',
'asm' or '__attribute__' before 'once_regsizes'
../../gcc-4.1.2/gcc/unwind-dw2.c:1259: error: 'once_regsizes' undeclared
(first use in this function)
../../gcc-4.1.2/gcc/unwind-dw2.c:1259: error: (Each undeclared
identifier is reported only once
../../gcc-4.1.2/gcc/unwind-dw2.c:1259: error: for each function it
appears in.)
../../gcc-4.1.2/gcc/unwind-dw2.c:1259: error: 'PTHREAD_ONCE_INIT'
undeclared (first use in this function)
../../gcc-4.1.2/gcc/unwind-dw2.c:1260: warning: implicit declaration of
function '__gthread_once'
make[3]: *** [libgcc/./unwind-dw2.o] Error 1
make[3]: Leaving directory `/mnt/tmp/objdir/gcc'
make[2]: *** [stmp-multilib] Error 2
make[2]: Leaving directory `/mnt/tmp/objdir/gcc'
make[1]: *** [all-gcc] Error 2
make[1]: Leaving directory `/mnt/tmp/objdir'
make: *** [all] Error 2
I have tried this same process using different versions (4.1.1, 4.1.2,
4.2.2) of gcc and I keep hitting this same wall. II can find
gcc-4.1.2/fixincludes/tests/base/sys/pthread.h and
gcc-4.1.2/fixincludes/tests/base/pthread.h as well as
gcc-4.1.2/fixincludes/tests/base/unistd.h and
gcc-4.1.2/libssp/ssp/unistd.h, but none of these directory paths appear
to be included with -I ... parameters. This is what leads me to believe
that I am somehow missing something in my configure command, but I just
can't figure it out.
Alternatively, I am only untar-ing the gcc-core-4.x.x.tar.gz.... I only
need the 'C' compiler, not the C++ or ada or others. I have tried
untar-ing all of them, but the build still failed.
Please help!
Wenton L. Davis
wenton@xxxxxxxx