"building binutils for target" question

Michael Zintakis michael.zintakis@googlemail.com
Sun Mar 27 03:21:00 GMT 2011


>> In my case, fortunately (or unfortunately, depending if a newbie like me 
>> has to do it) the answer is 'yes' as the target machine would need to 
>> compile and run programs using gcc, so I have to prepare everything on 
>> the (powerful) x86_64 arch machine, build the image, deploy it to the 
>> target powerpc and then let that machine do its business.
>>     
>
> OK. So you can build your cross-toolchain with crosstool-NG, that's
> supported. But for building the cross-native compiler to run on your
> PPC, you'll mostly be on your own; crostool-NG won't help you much...
>   
Will see how it goes - I'll attempt this in a couple of days (compiling 
gcc that is - the rest of the stuff seems to be fine - i.e. the cross 
toolchain is working perfectly with building "normal" packages - I 
compiled and installed quite a lot of these packages today without much 
trouble - touch wood!).

>> As for the CFLAGS/LDFLAGS includes that is a given, although I am 
>> thinking if I run with chroot to /some/place/staging and then execute 
>> make install then I won't be needing this, right? I might be wrong though!
>>     
>
> You can't use a chroot: the chroot you'd like to chroot into is a PPC
> system, while the machine you're running on is an x86_64...
>   
Ah, bugger, forgot about that! Well, in that case it becomes more 
complicated as I need to keep track of the -L and -I flags.


>> I know, I've read all of the doc files and I am also aware of the 
>> populate tool, but to me it seemed a bit of a chicken-and-egg scenario - 
>> you need to build the tools in the staging area in order to use this 
>> script, but in effect I can't build the tools if I do not have the core 
>> libraries...
>>     
>
> Hmmm... Sorry, I'm missing something here...
> Of course you do have the system libraries: they are in the sysroot of
> the cross-toolchain.
>   
I am not thinking straight. I forgot that I could point to my 
(non-standard) lib directories where the sysroot files are - I already 
done this today, so I know it works. You are right though, once all the 
files are installed (compiled using the sysroot pointers to the library 
files) I could just issue the populate command.

One thing I am not completely clear about - if I compile, build and 
install a package with one "--prefix" (say 
--prefix=${HOME}/staging/buildroot) and then try to run that program 
from the real root when I install the image would that work as 
effectively this prefix is now "/" and not "${HOME}/staging/buildroot"?

>> But as you pointed out below, if I just copy all of the toolchain's 
>> sysroot to my staging area I won't need any of this, right? Would that 
>> mean that I do not have to install the kernel headers for the target 
>> machine as well?
>>     
>
> Eactly. Copy the sysroot to your staging, you'll get all the system stuff:
> - headers from the kernel
> - headers from the libc
> - libs from the libc
>   
That is a better way of doing it I think because "populate" won't copy 
the headers or any other files which are not "linked" to my programs (.a 
files for example or localisation files), so I might go for this option 
instead.


--
For unsubscribe information see http://sourceware.org/lists.html#faq



More information about the crossgcc mailing list