簡體   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