This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Building a cross-compiler for a Raspberry Pi
- From: Andrew Haley <aph at redhat dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Tue, 15 Mar 2016 11:02:51 +0000
- Subject: Re: Building a cross-compiler for a Raspberry Pi
- Authentication-results: sourceware.org; auth=none
- References: <20160313060143 dot 4e5a89b4c428e989bc0351c9 at laposte dot net> <56E547C3 dot 7010009 at redhat dot com> <20160313135107 dot 9dd2c57c3831c19574de4a7b at laposte dot net> <56E690C1 dot 2060406 at redhat dot com> <20160315115159 dot e4f39be8aed1d7264e0d8932 at laposte dot net>
On 03/15/2016 10:51 AM, YuGiOhJCJ Mailing-List wrote:
> These are the steps I follow in order to build a cross-compiler:
> 1) I build binutils for the target
> 2) I install the headers from a library (that is specific)
> 3) I build a minimal gcc for the target (only C language supported)
> 4) I build a library for the target (that is specific)
> 5) I build a full gcc for the target (C and C++ languages supported)
>
> For the step 2), it must be skipped for some targets:
> * If the target is avr, it must be skipped
> * If the target is i686-w64-mingw32, it must be done
>
> For the step 2) and 4), the library I use depends on the target:
> * If the target is avr, I use avr-libc [1]
> * If the target is i686-w64-mingw32, I use mingw-w64 [2]
>
> This method works fine for avr and i686-w64-mingw32, so I am
> wondering why it does not work for my armv6l-unknown-linux-gnueabihf
> machine too.
Because you need the target libraries. It's not just libc itelf, but
also ld.so and possibly some others such as libdl.so.
Each GNU/Linux system has its dynamic libraries, and you should make
sure that you are building GCC against the correct versions installed
on your target system.
> I guess it is because I don't know which specific library I can use
> for the steps 2) and 4).
> Maybe newlib [3] is what I am looking for.
>
> Can you tell me if my method is correct and if newlib could be what
> I am looking for?
Newlib is wrong for any GNU/Linux system. You want an appropriately-
configured glibc.
It's my turn to ask a question. Why do you want to make this so
difficult, when you could simply build a cross compiler and be
finished already?
Andrew.