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: Mon, 14 Mar 2016 10:21:53 +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>
On 13/03/16 12:51, YuGiOhJCJ Mailing-List wrote:
>> On 13/03/16 05:01, YuGiOhJCJ Mailing-List wrote:
>>> 1) How we determine the correct machine name?
>>
>> It looks correct.
>>
>
> OK it is correct but how to know it is correct?
Go to a Raspberry Pi and run config.guess.
> I mean, I have chance to find people who have written articles where I can see the good machine name.
> But alone, it is hard to guess.
> I read [1] and it gives me the idea to use the config.guess script:
> $ scp /usr/share/automake-1.11/config.guess root@raspberrypi:~/
> root@raspberrypi's password:
> config.guess 100% 44KB 43.8KB/s 00:00
> $ ssh root@raspberrypi
> root@raspberrypi's password:
> Last login: Fri Jan 2 07:32:11 1970 from 192.168.0.6
> Linux 4.1.19+.
> $ ./config.guess
> armv6l-unknown-linux-gnueabihf
>
> So, I think I could use this machine name too.
I think you could too.
> I don't like this solution with the config.guess script because it
> supposes to have an access to the target system in order to run the
> script on it.
That's true. But you need access to the target system in order to be
able to test a cross compiler, so it's not a big issue. It's obvious
that you must be able to test a cross compiler after you build it.
> Is there something (like a documentation) in the gcc source code
> that helps to guess the best machine name for an ARMv6 CPU on Linux?
I don't think so.
>>> 2) How to build my cross-compiler without glibc?
>>
>> Copy the root filesystem from a Raspberry Pi onto your machine, then
>> configure gcc with --sysroot=<dirname>, the RPi root filesystem. GCC
>> will then pull all target headers and libraries from the sysroot.
>
> I prefer a solution that does not require to have an access to the
> target machine. Also, I would like a solution that does not depend
> on binaries if that's possible.
It's not: you need to be able to link against the target's libraries.
It's not just about libc: very few programs use only libc. This way,
you have all of the target's libraries and header files.
> Why the method for a Raspberry Pi cross-compiler is so different
> from an i686-w64-mingw32 or avr cross-compiler please?
It's the standard way for GNU/Linux cross-compilers. It's the best
way, and the easiest. The other ways are inferior.
Andrew.