![](/img/trans.png)
[英]How to be sure if a processor is 32bits or 64bits ? Are dual core processors 32 or 64 bits?
[英]Makefile, how to link 32bits library and 64bits library at the same time
我有兩個庫,一個叫做liblits.so
,它是32位,另一個叫做liblinx.a
,它是liblinx.a
位。 我需要在我的Makefile中鏈接它們,在添加CFLAGS += "-m32"
,我收到錯誤:
skipping incompatible liblinx.a when searching for -llinx
但是liblits.so
沒有錯誤。 如果我刪除CFLAGS += "-m32"
(我的機器是64位),我收到錯誤:
skipping incompatible liblits.so when searching for -llits
但是liblinx.a
沒有錯誤。 如何同時鏈接32位庫和64位庫? 或者我必須有兩個一致的庫?
我的Makefile:
CFLAGS = -I.
CFLAGS += "-m32"
LDFLAGS = -Llinx -llinx -Llib -llits -lrt -lpthread -Wl,-R,'lib'
server:server.c
gcc -o server $(CFLAGS) $(LDFLAGS) server.c
您需要一致的庫。 32位和64位庫中的機器代碼是不兼容的 - 例如,您具有不同的指針大小,導致對虛擬地址空間大小和類似問題的不同期望。
你如何使一個32GB指針以外的對象可以解決但是64位庫中的函數可以創建32位庫中的函數已知? 這是不可能的,並且由於這些和許多其他原因,將32位和64位庫鏈接到相同的二進制文件也是如此。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.