gpt4 book ai didi

linux - Autotools:使用单个 makefile 创建 32 位和 64 位库?

转载 作者:太空宇宙 更新时间:2023-11-04 04:15:21 25 4
gpt4 key购买 nike

我正在尝试将项目转换为自动工具。我的项目由一个程序和一个库组成。该库与程序链接。相反,该库将与其他程序链接以与我的程序进行通信。我的程序是 64 位的,但我需要 32 位和 64 位库以确保它可以被任何程序使用。我不知道如何做到这一点 - 似乎 autotools 只支持整个包的一种主机架构。

我尝试设置 -m32 标志来获取 32 位库,但这不起作用,因为链接器尝试链接到/usr/lib 而不是/usr/lib32。即使我将/usr/lib32 添加到链接器标志中,我仍然会收到如下错误:

/usr/bin/ld: i386:x86-64 architecture of input file `/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../lib/crti.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/crtbeginS.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/crtendS.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../lib/crtn.o' is incompatible with i386 output

所以我想这不是正确的方法。当然,我可以为库创建一个单独的包,但我想避免这种情况。是否可以将所有内容都放在一个包中?

该解决方案不必是跨平台的,该程序仅适用于 Linux。

最佳答案

据我所知,大多数支持 64 位的 Linux 发行版的每个 lib 软件包都有 2 个版本:32 位和 64 位。由于 autotools 仅支持一种主机架构,因此最容易进行两次构建。

关于linux - Autotools:使用单个 makefile 创建 32 位和 64 位库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16698438/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com