Re: Building a cross-compiler for a Raspberry Pi

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

 



OK, so each GNU/Linux system has its dynamic libraries and I must build gcc aginst these libraries.

When you say "GNU/Linux" it means that my avr and i686-w64-mingw32 cross-compilers are not concerned by that (because they are not "GNU/Linux" systems).
So, it explains why I don't need to build gcc against any library for these two cross-compilers.

As the cross-compiler I want to build is armv6l-unknown-linux-gnueabihf, it is concerned by that.
Indeed, this time, the target is a "GNU/Linux" system.
In fact, that's the first time I build a cross-compiler for a target which is a "GNU/Linux" system.
That's maybe why it is so different.

To give an answer to your question: Indeed, I could build my cross-compiler against libraries available on my target machine.
But as it is the first time I need to do that and that I hate to depend on binaries I have not built myself, I try to find an other way to build my cross-compiler.
I think I have no choice but to follow your suggestion.

I hope you understand my point of view.
When I built my cross-compiler for avr, I have not copied files from my avr machine to be able to build my cross-compiler.
When I built my cross-compiler for i686-w64-mingw32, I have not copied files from my Windows machine to be able to build my cross-compiler.
So, I was sure in my mind that it was not necessary to copy files from my Raspberry Pi to be able to build my armv6l-unknown-linux-gnueabihf cross-compiler.

OK, I will try your suggestion with --sysroot=<dirname> and it should work.

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.

On Tue, 15 Mar 2016 11:02:51 +0000
Andrew Haley <aph@xxxxxxxxxx> wrote:

> 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.



[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