Question

This may not be easy to answer concisely but I don't consider it to be open-ended: when using automakeand configure to cross-compile a library, what should be the most important things I need to avoid 'toolchain leaks'?

Here is some context...

First off, a toolchain leak is defined here: http://landley.net/writing/docs/cross-compiling.html

I'm compiling libuuid from source using a toolchain that is made for cross compiling code that will run on a custom debian based system. The goal of the project is to compile the code (including this 3rd party library that my app depends on) using the toolchain so that the compilation is independent of the host machine.

So far, I've tried to supply my toolchain's gcc compiler which looks okay, but when I run ./configure there are many things it checks for, and I'm not sure how to tell which ones truly matter, and I'm not sure how to have it only check in my toolchain and ignore anything on the host system. Here are a few examples:

Here you can see that ./configure is happy with my toolchain compiler:

checking whether we are using the GNU C compiler... yes
checking whether <toolchain>/bin/i686-linux-gcc accepts -g... yes

Then shortly after you can see it finds grep on my host system which seems like a 'toolchain leak'

checking for grep that handles long lines and -e... /bin/grep

Then later on it searches the host system for some headers. I think I can specify where it should look, but I still don't know which headers are required:

checking for linux/compiler.h... no
checking for linux/blkpg.h... yes
checking for linux/major.h... yes
checking asm/io.h usability... no
<...>
Était-ce utile?

La solution

Then shortly after you can see it finds grep on my host system which seems like a 'toolchain leak'

I would not call that a 'toolchain leak', and the referenced article doesn't either. It does mention these things as being 'leaks':

  • Improper header files from the autoconf --build system (called "host" in the article, and in your post).
  • Improper libraries from the --build system

I don't think any toolchain I've used has it's own grep executable. What would it do differently?

That being said, it shouldn't be using --builds linux headers. Usually the toolchain has it's own copy of those. That would be a 'leak'.

I'm compiling libuuid from source using a toolchain that is made for cross compiling code that will run on a custom debian based system. The goal of the project is to compile the code (including this 3rd party library that my app depends on) using the toolchain so that the compilation is independent of the host machine.

It'll go something like this: compile the dependency with the toolchain and install it in the toolchain /usr/lib (or somewhere where you plan on keeping cross compiled libraries, if you don't want to clutter up your toolchain). Compile libuuid with the toolchain (referencing the dependency, of course).

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top