2011-12-19 55 views
0

我想要編譯libpcap的和靜態的libssl(用-static)和鏈接給我拿這些錯誤:爲什麼我收到用gcc未定義引用錯誤 - 靜態鏈接

more undefined references to `ASN1_const_check_infinite_end' follow myprogram  line 0, external location: /lib64/libssl.a(ssl_asn1.o) 
more undefined references to `BIO_test_flags' follow myprogram line 0, external location: /lib64/libssl.a(ssl_lib.o) 
------------------------truncated for brevity---------------------------------- 

我使用Ubuntu 11.4 i686_64和libssl.a上的nm結果與BIO_test_flags進行比較,結果如下:U BIO_test_flags 這意味着此符號是未定義的符號,並且所有未定義符號處於相同狀態。

我該如何解決這個鏈接問題? (歡迎任何想法或方法) [請注意,靜態編譯對我來說是必須的]

+0

我認爲這是Ubuntu 11.04和x86_64? – 2011-12-19 17:03:05

+0

是Ubuntu 11.04和x86_64。 – user1106291 2011-12-19 17:06:48

回答

0

推測其中一個靜態庫丟失。也許你可以通過查看來判斷,但如果沒有,可以通過以下幾種方法來確定:

-t添加到您的鏈接命令中,看看是否有幫助。

嘗試strace鏈接命令(請注意,gcc將鏈接器作爲子進程調用,因此您需要遵循叉子)並查看它沒有找到的庫文件以及它在哪裏找它們。

相關問題