problems when doing cross compilation

Junfeng Dong
Mon May 4 22:47:00 GMT 2015

I want to investigate newlib for our future IOT project. Now I got
problem to create a cross tool-chain base on newlib-,
binutils-2.17, gcc-4.8.4. My build machine is 64 bit Ubuntu 14.04, I
want build 32 bit toolchain for i586.

My build step is:
1. Macro export.
a. export TARGET=i386-linux-gnu
b. export PREFIX=/opt/newlib32
c. export PATH=$PATH:/opt/newlib32/bin
2. binutils build
a. SRC_DIR/configure --target=$TARGET --prefix=$PREFIX; make all -j8
CFLAGS="-Wno-error=unused-but-set-variable  -Wno-error=format-security
"; make install
3. Gcc build
a. SRC_DIR/configure --target=$TARGET --prefix=$PREFIX
--with-newlib --without-headers --with-gnu-as    --with-gnu-ld
--disable-shared --enable-languages=c    --disable-werror
--disable-decimal-float --disable-lib
b. make all-gcc CFLAGS_FOR_TARGET="-I
c. make install-gcc
4. newlib build
a. ../../newlib- --target=$TARGET
--prefix=$PREFIX CC=$TARGET-gcc LD=$TARGET-ld
b. Make all
Then I got the following error:
rm -f lib.a
ln x86_64/lib.a lib.a >/dev/null 2>/dev/null || \
         cp x86_64/lib.a lib.a
cp: cannot stat 'x86_64/lib.a': No such file or directory
make[4]: *** [lib.a] Error 1
It is wrong to use x86_64, because my target is 32bit machine. Did I
made some mistake during configuraton?
If I add –host=$TARGET, I got the error as follows:
configure:4936: i586-pc-linux-gnu-gcc -O2   conftest.c  >&5
crt1.o: No such file: No such file or directory

Any comments are appreciated.

Best regards.
J. F.

More information about the Newlib mailing list