gcc + uclibc

Alberich de megres alberich2k5 at gmail.com
Mon Apr 2 08:13:25 UTC 2012


Hello!

I'm trying to understand the toolchain creation, by building one. I
want to learn how they work.
I'm building one for arm, with:
- binutils 2.22
- kernel 3.1.8 headers
- gcc 4.6.2


When compiling gcc final stage I got the following error:


/home/abm/kr/xenv-0.3.01/work/rpi/build/gcc-4.6.2/./gcc/xgcc
-B/home/abm/kr/xenv-0.3.01/work/rpi/build/gcc-4.6.2/./gcc/
-B/opt/xenv/x-tools/arm-none-eabi/bin/
-B/opt/xenv/x-tools/arm-none-eabi/lib/ -isystem
/opt/xenv/x-tools/arm-none-eabi/include -isystem
/opt/xenv/x-tools/arm-none-eabi/sys-include    -g -O2 -O2  -g -O2
-DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wwrite-strings
-Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
-Wold-style-definition  -isystem ./include  -fno-inline
-Wno-missing-prototypes -g  -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED
-fno-stack-protector   -I. -I. -I../.././gcc
-I/home/abm/kr/xenv-0.3.01/work/rpi/src/gcc-4.6.2/libgcc
-I/home/abm/kr/xenv-0.3.01/work/rpi/src/gcc-4.6.2/libgcc/.
-I/home/abm/kr/xenv-0.3.01/work/rpi/src/gcc-4.6.2/libgcc/../gcc
-I/home/abm/kr/xenv-0.3.01/work/rpi/src/gcc-4.6.2/libgcc/../include
-DHAVE_CC_TLS  -o _muldi3.o -MT _muldi3.o -MD -MP -MF _muldi3.dep
-DL_muldi3 -c /home/abm/kr/xenv-0.3.01/work/rpi/src/gcc-4.6.2/libgcc/../gcc/libgcc2.c
\
In file included from
/home/abm/kr/xenv-0.3.01/work/rpi/src/gcc-4.6.2/libgcc/../gcc/libgcc2.c:29:0:
/home/abm/kr/xenv-0.3.01/work/rpi/src/gcc-4.6.2/libgcc/../gcc/tsystem.h:87:19:
fatal error: stdio.h: No such file or directory
compilation terminated.
make[2]: *** [_muldi3.o] Error 1
make[2]: Leaving directory
`/home/abm/kr/xenv-0.3.01/work/rpi/build/gcc-4.6.2/arm-none-eabi/libgcc'
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory `/home/abm/kr/xenv-0.3.01/work/rpi/build/gcc-4.6.2'
make: *** [all] Error 2


But stdio.h is there in the sysroot directory:
find . | grep stdio
./usr/arm-linux-uclibc/usr/include/bits/uClibc_stdio.h
./usr/arm-linux-uclibc/usr/include/bits/stdio.h
./usr/arm-linux-uclibc/usr/include/stdio.h

Thanks!!
Alberich


---------------------------------------------------------

Some varieables:
XSYSROOT=/opt/x/
XPREFIX=/opt/x/x-tools
export TARGET=arm-unknown-linux-gnu
ENDIAN=little
export ARCH=arm
export CROSS_COMPILE=${TARGET}-

---------------------------------------------------------

The config lines I'm using are:

binutils
gcc step 1
  ${XECURSRC}/configure --prefix=${XPREFIX} --target=${TARGET}  \
   --without-headers --disable-threads --with-newlib \
   --disable-shared  --disable-libssp \
   --disable-libgomp --disable-libmudflap --disable-libquadmath \
   --enable-languages=c
 make all-gcc all-target-libgcc
make install-gcc install-target-libgcc

uclibc
  make allnoconfig ARCH=$ARCH CROSS=$CROSS_COMPILE PREFIX=$XSYSROOT
  echo "
  s/^[# ]*\\(TARGET_[a-zA-Z0-9_\\-]*\\).*/# \1 is not set/g
  s/^[# ]*\(TARGET_${ARCH}\).*/\1=y/g
  s/^[# ]*TARGET_ARCH[ =].*/TARGET_ARCH=\"${ARCH}\"/g
  s/^[# ]*TARGET_SUBARCH[= ].*/TARGET_SUBARCH=\"\"/g
  s@^KERNEL_HEADERS=.*@KERNEL_HEADERS=\"${XSYSROOT}/usr/include\"@g
  s/^[# ]*ARCH_BIG_ENDIAN=.*/ARCH_LITTLE_ENDIAN=y\nARCH_WANTS_LITTLE_ENDIAN=y/g
  s/^[# ]*ARCH_LITTLE_ENDIAN=.*/ARCH_LITTLE_ENDIAN=y\nARCH_WANTS_LITTLE_ENDIAN=y/g
  s/^[# ]*\\(ARCH_WANTS_BIG_ENDIAN\\)=.*/# \1 is not set/g
  s/^[# ]*HAS_NO_THREADS.*/# HAS_NO_THREADS is not set/g
  s/^[# ]*UCLIBC_HAS_THREADS.*/UCLIBC_HAS_THREADS=y/g
  /^[# ]*UCLIBC_HAS_THREADS.*/i\UCLIBC_HAS_THREADS_NATIVE=y
  /^[# ]*UCLIBC_HAS_THREADS.*/a\UCLIBC_HAS_TLS=y\n#
PTHREADS_DEBUG_SUPPORT is not set
  " >.tmp.xenv_sed_file
  sed -f .tmp.xenv_sed_file  < .config > .xenv_config
 cp .xenv_config .config
  make ARCH=$ARCH CROSS=$CROSS_COMPILE PREFIX=$XSYSROOT
install_headers install_startfiles
  make CROSS=$CROSS_COMPILE PREFIX=$XSYSROOT install

gcc_final
  ${XECURSRC}/configure --prefix=${XPREFIX} --target=${TARGET}
--with-sysroot=${XSYSROOT} \
  --disable-libssp --disable-libgomp \
  --disable-libmudflap --disable-libquadmath \
  --enable-languages=c,c++ \
  --disable-nls --disable-multilib

make
make install


More information about the uClibc mailing list