- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我一直在交叉编译我的单元测试以确保它们在所有感兴趣的平台上通过,例如x86-linux, win32, win64, arm-linux
他们的单元测试需要 CUnit 库
所以我还必须为每个平台交叉编译
它带有自己的 autoconf 东西,因此您可以通过为配置指定 --host 轻松地交叉构建它
我的问题是,为各种平台安装 CUnit 库的“正确”位置在哪里?即我应该为配置设置 --prefix 什么?
我最初的猜测是:
/usr/local/<platform>/lib/Cunit
即设置 --prefix /usr/local/<platform>
例如--prefix /usr/local/arm-linux-gnueabihf
在 sudo make install
上给你:
/usr/local/arm-linux-gnueabihf/doc/CUnit
/usr/local/arm-linux-gnueabihf/include/CUnit
/usr/local/arm-linux-gnueabihf/lib
/usr/local/arm-linux-gnueabihf/share/CUnit
显然,如果我不为配置指定前缀,每个平台构建都会覆盖前一个,这是不好的
为了成功链接到这些特定于平台的库,我需要在 Makefile 中为每个目标在其自己的 LDFLAGS 中指定相关的库目录
这是正确的方法吗?我的目录结构/位置是否适合这种交叉构建的东西?我假设必须有一个事实上的方法,但不确定它是什么..
可能配置应该为我处理所有这些东西?也许我只需要设置 --target
正确,也许 --enable-multilib
?所有与--prefix=/usr/local
?
我收到的一些错误消息建议 /usr/lib/gcc-cross
可能涉及?
通过阅读更多关于交叉编译和 Gnu 配置和构建系统的信息,我似乎应该为配置步骤设置 --target 选项
但是你怎么知道目标名称是什么?它们是交叉编译器名称的一部分吗?
我使用的 3 个交叉编译器是:
arm-linux-gnueabihf-gcc-4.8i686-w64-mingw32-gccx86_64-w64-mingw32-gcc
允许我为 ARM、win32 和 win64 交叉编译
我的主机是 32 位 ubuntu,我认为它可能是 --host i386-linux,但似乎配置应该将其设置为默认值
最佳答案
这是我最终想出并开始工作的程序:
对于我的 3 个交叉构建工具(arm、win32、win64),我对配置的调用如下所示:
./configure --host=arm-linux-gnueabihf --build=i686-pc-linux-gnu --prefix=/usr/local/arm-linux-gnueabihf
./configure --host=i686-w64-mingw32 --build=i686-pc-linux-gnu --prefix=/usr/local/i686-w64-mingw32
./configure --host=x86_64-w64-mingw32 --build=i686-pc-linux-gnu --prefix=/usr/local/x86_64-w64-mingw32
每一个后面都有make
,sudo make install
在为 arm cross 构建调用配置之前,我必须做:
ln -s /usr/bin/arm-linux-gnueabihf-gcc-4.8 /usr/bin/arm-linux-gnueabihf-gcc
这是因为编译器的末尾有 -4.8
标记,所以 configure 无法正确“猜测”编译器的名称
这个问题不适用于 win32 或 win64 mingw 编译器
注意一个额外的问题是,当随后尝试链接到这些交叉编译的 CUnit 库时,默认情况下似乎没有一个交叉编译器在/usr/local/include 中查找,所以我不得不手动添加:
-I/usr/local/include
为每个目标文件构建
例如我将 /usr/local/include
添加到我的 Makefile 中的 INCLUDE_DIRS
所有这一切似乎最终为我提供了正确的交叉构建的 CUnit 库,并且我已经成功地链接到它们,为每个目标平台生成交叉构建的单元测试二进制文件。
一点都不容易,我敢说配置选项设置“违反直觉”——因为花时间阅读相关文档是值得的——这个片段是相关的:
There are three system names that the build knows about: the machine you are building on (build), the machine that you are building for (host), and the machine that GCC will produce code for (target). When you configure GCC, you specify these with --build=, --host=, and --target=.
Specifying the host without specifying the build should be avoided, as configure may (and once did) assume that the host you specify is also the build, which may not be true.
If build, host, and target are all the same, this is called a native. If build and host are the same but target is different, this is called a cross. If build, host, and target are all different this is called a canadian (for obscure reasons dealing with Canada's political party and the background of the person working on the build at that time). If host and target are the same, but build is different, you are using a cross-compiler to build a native for a different system. Some people call this a host-x-host, crossed native, or cross-built native.
还有:
When people configure a project like './configure', man often meets these three confusing options, which are more related with cross-compilation
--host: In which system the generated program will run.
--build: In which system the program will be built.
--target: this option is only used to build a cross-compiling
toolchain. When the tool chain generates executable program, in which target
system the program will run.An example of tslib (a mouse driver library)
'./configure --host=arm-linux --build=i686-pc-linux-gnu': the dynamically library is built on a x86 linux computer but will be used for a embedded arm linux system.
关于在 Linux 上交叉构建第三方库位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27188116/
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,
Linux 管道可以缓冲多少数据?这是可配置的吗? 如果管道的两端在同一个进程中,但线程不同,这会有什么不同吗? 请注意:这个“同一个进程,两个线程”的问题是理论上的边栏,真正的问题是关于缓冲的。 最
我找到了here [最后一页] 一种有趣的通过 Linux 启动 Linux 的方法。不幸的是,它只是被提及,我在网上找不到任何有用的链接。那么有人听说过一种避免引导加载程序而使用 Linux 的方法
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 1
我试图了解 ld-linux.so 如何在 Linux 上解析对版本化符号的引用。我有以下文件: 测试.c: void f(); int main() { f(); } a.c 和 b.c:
与 RetroPie 的工作原理类似,我可以使用 Linux 应用程序作为我的桌面环境吗?我实际上并不需要像实际桌面和安装应用程序这样的东西。我只需要一种干净简单的方法来在 RaspberryPi 上
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a softwar
关闭。这个问题是off-topic .它目前不接受答案。 想改进这个问题吗? Update the question所以它是on-topic用于堆栈溢出。 关闭 10 年前。 Improve thi
有什么方法可以覆盖现有的源代码,我应该用 PyQt、PyGTK、Java 等从头开始构建吗? 最佳答案 如果您指的是软件本身而不是它所连接的存储库,那么自定义应用程序的方法就是 fork 项目。据我所
我的情况是:我在一个磁盘上安装了两个 linux。我将第一个安装在/dev/sda1 中,然后在/dev/sda2 中安装第二个然后我运行第一个系统,我写了一个脚本来在第一个系统运行时更新它。
我在 i2c-0 总线上使用地址为 0x3f 的系统监视器设备。该设备在设备树中配置有 pmbus 驱动程序。 问题是,加载 linux 内核时,这个“Sysmon”设备没有供电。因此,当我在总线 0
关闭。这个问题是off-topic .它目前不接受答案。 想改进这个问题吗? Update the question所以它是on-topic用于堆栈溢出。 关闭 11 年前。 Improve thi
我正试图在 linux 模块中分配一大块内存,而 kalloc 做不到。 我知道唯一的方法是使用 alloc_bootmem(unsigned long size) 但我只能从 linux 内核而不是
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a softwar
我有 .sh 文件来运行应用程序。在该文件中,我想动态设置服务器名称,而不是每次都配置。 我尝试了以下方法,它在 CentOS 中运行良好。 nohup /voip/java/jdk1.8.0_71/
我是在 Linux 上开发嵌入式 C++ 程序的新手。我有我的 Debian 操作系统,我在其中开发和编译了我的 C++ 项目(一个简单的控制台进程)。 我想将我的应用程序放到另一个 Debian 操
关闭。这个问题需要多问focused 。目前不接受答案。 想要改进此问题吗?更新问题,使其仅关注一个问题 editing this post . 已关闭 4 年前。 Improve this ques
我使用4.19.78版本的稳定内核,我想找到带有企鹅二进制数据的C数组。系统启动时显示。我需要在哪里搜索该内容? 我在 include/linux/linux_logo.h 文件中只找到了一些 Log
我知道可以使用 gdb 的服务器模式远程调试代码,我知道可以调试针对另一种架构交叉编译的代码,但是是否可以更进一步,从远程调试 Linux 应用程序OS X 使用 gdbserver? 最佳答案 当然
是否有任何可能的方法来运行在另一个 Linux 上编译的二进制文件?我知道当然最简单的是在另一台机器上重建它,但假设我们唯一能得到的是一个二进制文件,那么这可能与否? (我知道这可能并不容易,但我只是
我是一名优秀的程序员,十分优秀!