Cross compiling.

Amar Takhar verm at darkbeer.org
Fri Feb 12 19:11:15 UTC 2016


On 2016-02-12 11:02 -0800, Hal Murray wrote:

> I think there are two things I'm looking for.  One is the concepts.  The 
> other is the details.  Text that I can cut/paste cover the details.  It 
> probably takes a sentence or two to explain the concept.
> 
> It can be as simple as "Install the compiler" to decode things like 
> "gcc-arm-linux-gnu".  But is it really just the compiler or does that package 
> also include other tools?  It may take a bit of background info on the target 
> environment to set things up.
> 
> If you have an example worked out for Ubuntu, I can probably find the 
> corresponding packages on other distros/OSes.  That's assuming that I'll have 
> to go through the same steps but some of the names have changed.  In the 
> simple case, somebody could cover another distro/OS by adding a set of 
> cut-paste steps.

Cross compiling isn't that easy.  It's a moving target and every operating 
system does it in a very different way.  Some are for embedded boards, others 
only partially carry over what's needed.

This one on Ubuntu is the only one I've used that has worked out of the box 
flawlessly for binaries I've never actually experienced that before on any OS I 
was surprised.

I don't want to go down the road of having to maintain this sort of 
documentation it will be a huge burden.  Anyone who is wanting to cross compile 
will already know what they're doing...or should.


> >   waf configure --cross-compiler=arm-linux-gnueabihf-gcc
> 
> Where do the header files and libraries come from?

This is beyond our scope.  We can't explain how to setup a cross compiling 
environment to our users.  There are thousands of documents out there that do 
just that.

All we need to document is how to cross compile waf in your environment.


> What does "waf install" do?

Same as any install you tell it the prefix and install it there is nothing 
special about it.


> > It built fine.  No OpenSSL or libevent2.  I built those later using the same
> >  compiler and it all worked as expected.
> 
> What did you do to get OpenSSL or libevent2?

Same as you would on any operating system.  This is up top the user to figure 
out.


> > OK.. if anyone has any suggestions where the docs should go I can write
> > something. 
> 
> devel/HOWTO-cross

I would literally put this into that document:


  Setup a cross compile environment for your architecture.

  Run waf configure with --enable-cross=/path/to/your/cross/cc

  There are also --cross-cflags and --cross-ldflags to supply the cross compiler 
  with appropriate values.

  You may need to install dependencies in order to get a full build.


Amar.


More information about the devel mailing list