This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Building a cross-compiler for a Raspberry Pi


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]