简体   繁体   English

使用automake进行交叉编译时,重要的是什么?

[英]What is important when cross compiling using automake?

This may not be easy to answer concisely but I don't consider it to be open-ended: when using automake and configure to cross-compile a library, what should be the most important things I need to avoid 'toolchain leaks'? 简单地回答这个问题可能并不容易,但是我不认为它是开放式的:使用automakeconfigure为交叉编译库时,为避免“工具链泄漏”,最重要的事情是什么?

Here is some context... 这是一些背景...

First off, a toolchain leak is defined here: http://landley.net/writing/docs/cross-compiling.html 首先,在此处定义了工具链泄漏: 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. 我正在使用工具链从源代码编译libuuid,该工具链是为将在基于定制debian的系统上运行的交叉编译代码而设计的。 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. 该项目的目标是使用工具链编译代码(包括我的应用程序依赖的第3方库),以便编译独立于主机。

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. 到目前为止,我已经尝试提供工具链的gcc编译器,它看起来还不错,但是当我运行./configure ,它会检查很多东西,而且我不确定如何分辨哪一个真正重要。不知道如何让它只签入我的工具链并忽略主机系统上的任何内容。 Here are a few examples: 这里有一些例子:

Here you can see that ./configure is happy with my toolchain compiler: 在这里,您可以看到./configure对我的工具链编译器感到满意:

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' 然后不久,您可以看到它在我的主机系统上找到了grep ,这似乎是“工具链泄漏”

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

Then shortly after you can see it finds grep on my host system which seems like a 'toolchain leak' 然后不久,您可以看到它在我的主机系统上找到了grep,这似乎是“工具链泄漏”

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). 来自autoconf --build系统的头文件不正确(在本文和您的文章中称为“主机”)。
  • Improper libraries from the --build system --build系统中的库不正确

I don't think any toolchain I've used has it's own grep executable. 我认为我使用过的任何工具链都不具有自己的grep可执行文件。 What would it do differently? 它会有什么不同?

That being said, it shouldn't be using --build s linux headers. 话虽如此,它不应该使用--buildlinux头文件。 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. 我正在使用工具链从源代码编译libuuid,该工具链是为将在基于定制debian的系统上运行的交叉编译代码而设计的。 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. 该项目的目标是使用工具链编译代码(包括我的应用程序依赖的第3方库),以便编译独立于主机。

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). 它将是这样的:使用工具链编译依赖项,并将其安装在工具链/usr/lib (或者,如果您不想弄乱工具链,则可以计划保留交叉编译的库)。 Compile libuuid with the toolchain (referencing the dependency, of course). 使用工具链编译libuuid (当然是引用依赖关系)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM