Errors while crosscompiling a mips toolchain under OSX
Guylhem Aznar
crossgcc@guylhem.net
Mon May 30 21:37:00 GMT 2011
Hello
A quick follow up. I studied Khem's scripts and I'm now using uclibc
and similar stages, but once again failling at gcc stage 2. I tried
with and without threads- same problem ,
Initially the phase 2 gcc complained about missing headers because I
had (among other things - due to an inherited uclibc-config) a wrong
DEVEL_PREFIX instead of / as expected by Khem's scripts. My
KERNEL_HEADERS is fine (="/gcc/sysroot/usr/include") but I see no NR
in /gcc/mips-fritzbox-linux-uclibc/include/unistd.h.
It though it might be the cause of the problem (
http://kerneltrap.org/node/7373 ) since I tried with a 2.6.19.2 kernel
to match the version currently running on the hardware, but further
trials with very recent kernel didn't improve the situtation.
Gcc really doesn't like the uclibc headers
(...)
/gcc/sources-done/gcc-2nt/./gcc/xgcc
-B/gcc/sources-done/gcc-2nt/./gcc/
-B/gcc/mips-fritzbox-linux-uclibc/bin/
-B/gcc/mips-fritzbox-linux-uclibc/lib/ -isystem
/gcc/mips-fritzbox-linux-uclibc/include -isystem
/gcc/mips-fritzbox-linux-uclibc/sys-include -g -O2
-minterlink-mips16 -O2 -g -O2 -minterlink-mips16 -DIN_GCC
-DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wwrite-strings -Wcast-qual
-Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition
-isystem ./include -fPIC -g -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED
-I. -I. -I../.././gcc -I../../../gcc-4.5.3/libgcc
-I../../../gcc-4.5.3/libgcc/. -I../../../gcc-4.5.3/libgcc/../gcc
-I../../../gcc-4.5.3/libgcc/../include -DHAVE_CC_TLS -o _muldi3.o
-MT _muldi3.o -MD -MP -MF _muldi3.dep -DL_muldi3 -c
../../../gcc-4.5.3/libgcc/../gcc/libgcc2.c \
-fvisibility=hidden -DHIDE_EXPORTS
In file included from /gcc/mips-fritzbox-linux-uclibc/include/pthread.h:21:0,
from
/gcc/mips-fritzbox-linux-uclibc/include/bits/uClibc_mutex.h:15,
from
/gcc/mips-fritzbox-linux-uclibc/include/bits/uClibc_stdio.h:107,
from /gcc/mips-fritzbox-linux-uclibc/include/stdio.h:72,
from ../../../gcc-4.5.3/libgcc/../gcc/tsystem.h:87,
from ../../../gcc-4.5.3/libgcc/../gcc/libgcc2.c:29:
/gcc/mips-fritzbox-linux-uclibc/include/time.h: In function 'libc_hidden_proto':
/gcc/mips-fritzbox-linux-uclibc/include/time.h:194:15: error: storage
class specified for parameter 'difftime'
/gcc/mips-fritzbox-linux-uclibc/include/time.h:201:15: error: storage
class specified for parameter 'mktime'
(.. and many more..)
I thought I should use a patch with gcc?
Here are the lines I did use:
cd gmp-5.0.2 && ./configure --prefix=/gcc/ --enable-cxx |tee
config-gmp.log && make -j4 | tee make-gmp.log && make install && cd ..
cd mpfr-3.0.1 && ./configure --disable-nls --prefix=/gcc/
--with-gmp=/gcc/| tee config-mpfr.log && make -j4 | tee make-mpfr.log
&& make install && cd ..
cd mpc-0.8.2 && ./configure --disable-nls --prefix=/gcc
--with-gmp=/gcc --with-mpfr=/gcc | tee config-mpc.log && make -j4 |tee
make-binutils.log && make install && cd ..
# same as before ; now some changes
cd binutils-2.21 && ./configure --disable-nls --prefix=/gcc
--with-gmp=/gcc --with-mpfr=/gcc --target=mips-fritzbox-linux-uclibc
--with-gnu-as --with-gnu-ld --with-sysroot=/gcc/sysroot
--disable-werror --enable-ld && make -j8 && make install && cd ..
rm -fr gcc-1 ; mkdir gcc-1 && cd gcc-1 && ../gcc-4.5.3/configure
--disable-nls --prefix=/gcc --with-gmp=/gcc --with-mpfr=/gcc
--with-mpc=/gcc --target=mips-fritzbox-linux-uclibc
--program-prefix=mips-fritzbox-linux-uclibc- --with-gnu-as
--with-gnu-ld --without-headers --with-newlib --enable-languages=c
--disable-shared --disable-threads --disable-libssp
--disable-libmudflap --disable-libgomp && make -j8 && cd ..
mkdir /gcc/linux && cd linux-2.6.19.2 && PATH=$PATH:/gcc/bin make
headers_install ARCH=mips CROSS_COMPILE=mips-fritzbox-linux-uclibc-
INSTALL_HDR_PATH=/gcc/sysroot/usr O=/gcc/linux && cd ..
cp uclibc-config uClibc-0.9.31 && cd uClibc-0.9.31 &&
PATH=$PATH:/gcc/bin make CROSS=mips-fritzbox-linux-uclibc-
PREFIX=/gcc/sysroot oldconfig && PATH=$PATH:/gcc/bin make
CROSS=mips-fritzbox-linux-uclibc- PREFIX=/gcc/sysroot install_headers
&& cd ..
# attempt with threads
rm -fr gcc-2 ; mkdir gcc-2 && cd gcc-2 && ../gcc-4.5.3/configure
--disable-nls --prefix=/gcc --with-gmp=/gcc --with-mpfr=/gcc
--with-mpc=/gcc --target=mips-fritzbox-linux-uclibc
--program-prefix=mips-fritzbox-linux-uclibc- --with-gnu-as
--with-gnu-ld --with-sysroot=/gcc/sysroot
--with-build-sysroot=/gcc/sysroot --enable-languages=c
--disable-libssp --disable-libmudflap --disable-libgomp
--with-arch=mips32r2 --with-abi=32 --with-tune=24kec
# attempt without threads
rm -fr gcc-2nt ; mkdir gcc-2nt && cd gcc-2nt && ../gcc-4.5.3/configure
--disable-nls --prefix=/gcc --with-gmp=/gcc --with-mpfr=/gcc
--with-mpc=/gcc --target=mips-fritzbox-linux-uclibc
--program-prefix=mips-fritzbox-linux-uclibc- --with-gnu-as
--with-gnu-ld --with-sysroot=/gcc/sysroot --enable-languages=c
--with-arch=mips32r2 --with-abi=32 --with-tune=24kec --disable-threads
I thought there might be a problem with them so I tried to follow Khem
script line by line, but I got the same problem :
/khem/obj/gcc2/./gcc/xgcc -B/khem/obj/gcc2/./gcc/
-B/khem/tools/mips-linux-uclibc/bin/
-B/khem/tools/mips-linux-uclibc/lib/ -isystem
/khem/tools/mips-linux-uclibc/include -isystem
/khem/tools/mips-linux-uclibc/sys-include -g -O2 -minterlink-mips16
-O2 -g -O2 -minterlink-mips16 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W
-Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes
-Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC
-g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -I. -I.
-I../.././gcc -I../../../../src/gcc-4.5.3/libgcc
-I../../../../src/gcc-4.5.3/libgcc/.
-I../../../../src/gcc-4.5.3/libgcc/../gcc
-I../../../../src/gcc-4.5.3/libgcc/../include -DHAVE_CC_TLS -o
_ashldi3.o -MT _ashldi3.o -MD -MP -MF _ashldi3.dep -DL_ashldi3 -c
../../../../src/gcc-4.5.3/libgcc/../gcc/libgcc2.c -fvisibility=hidden
-DHIDE_EXPORTS
Fails with:
../../../../src/gcc-4.5.3/libgcc/../gcc/tsystem.h:87:19: fatal error:
stdio.h: No such file or directory
compilation terminated.
As you can see there are headersm but maybe not in the place where
they are expected??
*$ find /khem/|grep stdio.h
/khem//obj/uclibc-headers/include/bits/stdio.h
/khem//obj/uclibc-headers/include/bits/uClibc_stdio.h
/khem//src/gcc-4.5.3/fixincludes/tests/base/stdio.h
/khem//src/gcc-4.5.3/gcc/testsuite/gcc.dg/cpp/usr/include/stdio.h
/khem//src/gcc-4.5.3/libssp/ssp/stdio.h
/khem//src/gcc-4.5.3/libstdc++-v3/config/io/basic_file_stdio.h
/khem//src/gcc-4.5.3/libstdc++-v3/config/io/c_io_stdio.h
/khem//src/gcc-4.5.3/libstdc++-v3/include/c_compatibility/stdio.h
/khem//src/gcc-4.5.3/libstdc++-v3/include/tr1/stdio.h
/khem//src/linux-2.6.34/arch/powerpc/boot/stdio.h
/khem//src/linux-2.6.34/arch/powerpc/xmon/nonstdio.h
/khem//src/uClibc-0.9.31/include/stdio.h
/khem//src/uClibc-0.9.31/libc/stdio/_stdio.h
/khem//src/uClibc-0.9.31/libc/sysdeps/linux/common/bits/stdio.h
/khem//src/uClibc-0.9.31/libc/sysdeps/linux/common/bits/uClibc_stdio.h
/khem//sysroot/usr/mips-linux-uclibc/usr/include/stdio.h
So I tried with -I/khem//obj/uclibc-headers/include/bits but I got then:
In file included from ../../../../src/gcc-4.5.3/libgcc/../gcc/tsystem.h:87:0,
from ../../../../src/gcc-4.5.3/libgcc/../gcc/libgcc2.c:29:
/khem//obj/uclibc-headers/include/bits/stdio.h:21:3: error: #error
"Never include <bits/stdio.h> directly; use <stdio.h> instead."
In file included from ../../../../src/gcc-4.5.3/libgcc/../gcc/libgcc2.c:29:0:
../../../../src/gcc-4.5.3/libgcc/../gcc/tsystem.h:90:23: fatal error:
sys/types.h: No such file or directory
compilation terminated.
$ find /khem/|grep sys\/types.h
/khem//src/gcc-4.5.3/fixincludes/tests/base/sys/types.h
/khem//src/uClibc-0.9.31/include/sys/types.h
/khem//sysroot/usr/mips-linux-uclibc/usr/include/sys/types.h
So I tried again with
-I/khem//sysroot/usr/mips-linux-uclibc/usr/include but I got:
In file included from ../../../../src/gcc-4.5.3/libgcc/../gcc/tsystem.h:87:0,
from ../../../../src/gcc-4.5.3/libgcc/../gcc/libgcc2.c:29:
/khem//obj/uclibc-headers/include/bits/stdio.h:21:3: error: #error
"Never include <bits/stdio.h> directly; use <stdio.h> instead."
In file included from
/khem//sysroot/usr/mips-linux-uclibc/usr/include/sys/types.h:27:0,
from ../../../../src/gcc-4.5.3/libgcc/../gcc/tsystem.h:90,
from ../../../../src/gcc-4.5.3/libgcc/../gcc/libgcc2.c:29:
/khem//sysroot/usr/mips-linux-uclibc/usr/include/features.h:187:33:
fatal error: bits/uClibc_config.h: No such file or directory
compilation terminated.
In the end, I tried with /khem//obj/uclibc-headers/include which gave
me the very same error I had with my scripts.
Once again a hint or a pointer would be appreciated.
I'm attaching the full log + the uclibc config in case I made another
obvious mistake.
Guylhem
-------------- next part --------------
A non-text attachment was scrubbed...
Name: log.txt.bz2
Type: application/x-bzip2
Size: 15972 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/crossgcc/attachments/20110530/76ca6857/attachment.bz2>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: uclibc-config.bz2
Type: application/x-bzip2
Size: 1875 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/crossgcc/attachments/20110530/76ca6857/attachment-0001.bz2>
-------------- next part --------------
--
For unsubscribe information see http://sourceware.org/lists.html#faq
More information about the crossgcc
mailing list