繁体   English   中英

Autotools:使用单个Makefile创建32位和64位库吗?

[英]Autotools: create a 32-bit and 64-bit library with a single makefile?

我正在尝试将项目转换为自动工具。 我的项目包括一个程序和一个库。 该库与程序链接。 相反,该库将与其他程序链接以与我的程序进行通信。 我的程序是64位的,但是我需要32位和64位的库,以确保可以被任何程序使用。 我不知道该怎么做-似乎自动工具仅支持整个软件包的一种主机体系结构。

我尝试将-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。

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

暂无
暂无

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

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