Re: Building a cross-compiler for a Raspberry Pi

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I remark that the root of my target [1] does not have enough headers in order to become a sysroot for gcc.
Indeed, the stdio.h header is missing.
The error while building gcc is:
$ ../configure --prefix=/usr --target=armv6l-unknown-linux-gnueabihf --with-arch=armv6 --with-fpu=vfp --with-float=hard --enable-languages=c --disable-shared --disable-nls --disable-libssp --with-sysroot=`pwd`/../sysroot
[...]
$ make
[...]
/tmp/build/armv6l-unknown-linux-gnueabihf/gcc-5.3.0-tmp/./gcc/xgcc -B/tmp/build/armv6l-unknown-linux-gnueabihf/gcc-5.3.0-tmp/./gcc/ -B/usr/armv6l-unknown-linux-gnueabihf/bin/ -B/usr/armv6l-unknown-linux-gnueabihf/lib/ -isystem /usr/armv6l-unknown-linux-gnueabihf/include -isystem /usr/armv6l-unknown-linux-gnueabihf/sys-include    -g -O2 -O2  -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fPIC -fno-inline -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector   -fPIC -fno-inline -I. -I. -I../.././gcc -I../../../gcc-5.3.0/libgcc -I../../../gcc-5.3.0/libgcc/. -I../../../gcc-5.3.0/libgcc/../gcc -I../../../gcc-5.3.0/libgcc/../include  -DHAVE_CC_TLS  -o _muldi3.o -MT _muldi3.o -MD -MP -MF _muldi3.dep -DL_muldi3 -c ../../../gcc-5.3.0/libgcc/libgcc2.c -fvisibility=hidden -DHIDE_EXPORTS
In file included from ../../../gcc-5.3.0/libgcc/libgcc2.c:27:0:
../../../gcc-5.3.0/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 `/tmp/build/armv6l-unknown-linux-gnueabihf/gcc-5.3.0-tmp/armv6l-unknown-linux-gnueabihf/libgcc'
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory `/tmp/build/armv6l-unknown-linux-gnueabihf/gcc-5.3.0-tmp'
make: *** [all] Error 2

So, I have extracted the provided glibc package [2] to complete the sysroot.
Now, stdio.h is available but I still have an error.
The error while building gcc is:
$ ../configure --prefix=/usr --target=armv6l-unknown-linux-gnueabihf --with-arch=armv6 --with-fpu=vfp --with-float=hard --enable-languages=c --disable-shared --disable-nls --disable-libssp --with-sysroot=`pwd`/../sysroot
[...]
$ make
[...]
checking for /tmp/build/armv6l-unknown-linux-gnueabihf/gcc-5.3.0-tmp/./gcc/xgcc -B/tmp/build/armv6l-unknown-linux-gnueabihf/gcc-5.3.0-tmp/./gcc/ -B/usr/armv6l-unknown-linux-gnueabihf/bin/ -B/usr/armv6l-unknown-linux-gnueabihf/lib/ -isystem /usr/armv6l-unknown-linux-gnueabihf/include -isystem /usr/armv6l-unknown-linux-gnueabihf/sys-include    option to accept ISO C89... unsupported
checking how to run the C preprocessor... /lib/cpp
configure: error: in `/tmp/build/armv6l-unknown-linux-gnueabihf/gcc-5.3.0-tmp/armv6l-unknown-linux-gnueabihf/libgcc':
configure: error: C preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details.
make[1]: *** [configure-target-libgcc] Error 1
make[1]: Leaving directory `/tmp/build/armv6l-unknown-linux-gnueabihf/gcc-5.3.0-tmp'
make: *** [all] Error 2

Why it is looking at /lib/cpp?
I don't have a cpp file at this location (not in my target machine sysroot and not in my build machine root).
Should I create a symbolic link to my gcc compiler on my build machine?

Remark: My target system does not support hard float [3].
I can read some messages like that in my config.log file too:
/tmp/build/armv6l-unknown-linux-gnueabihf/sysroot/usr/include/gnu/stubs.h:10:0: fatal error: gnu/stubs-hard.h: No such file or directory
It means that the config.guess script I run on my target machine has guessed incorrectly:
# ./config.guess 
armv6l-unknown-linux-gnueabihf

I should name my cross-compiler like that:
armv6l-unknown-linux-gnueabi
And I should remove the --with-float=hard option, isn't it?

Anyway, I think I do some mistakes when I am building my toolchain:
* I have not used the --with-sysroot option while I built my binutils whereas I am using --with-sysroot while I build gcc
* When I create my sysroot tree, I am extracting files from these archives [1, 2] (I could also copy files from my target machine but I know there are the same files and it requires to copy with rsync/ssh so it is more complex for nothing). The result is that some symbolic links have an absolute path for the target and they reference a file in my build system instead of my target system. I need to find a way to avoid that by replacing the target of all these symbolic links.

[1] ftp://ftp.arm.slackware.com/slackwarearm/slackwarearm-devtools/minirootfs/roots/slack-14.1-miniroot_04Nov13.tar.xz
[2] ftp://ftp.arm.slackware.com/slackwarearm/slackwarearm-14.1/slackware/l/glibc-2.17-arm-14.tgz
[3] http://arm.slackware.com/ ("Slackware ARM hard float port now in progress", by mozes, on 2013-04-02)

On Tue, 15 Mar 2016 15:47:56 +0000
Andrew Haley <aph@xxxxxxxxxx> wrote:

> On 03/15/2016 03:20 PM, YuGiOhJCJ Mailing-List wrote:
> 
> > Please tell me if what I have written in this message is wrong
> > again.  Maybe I have misunderstand something you told me so I want
> > to be sure all is right.
> 
> It looks right.
> 
> You can cross-compile some target libraries if you want, but it's
> actually easier to build a cross compiler in the way I described, then
> use that cross compiler to build the new target libraries.
> 
> Andrew.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux