2014-03-01 17 views
2

我一直在拉我的頭髮,試圖將我的iOS應用程序與arm64庫鏈接。圖書館無法爲特定體系結構鏈接的可能原因?

有問題的庫是Crypto ++。我試過了wiki中的預編譯fat庫:http://www.cryptopp.com/wiki/IOS_(Command_Line)。我試過編譯庫自己,但我不斷收到以下類型的鏈接錯誤:

"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long, unsigned long)", referenced from: 
     std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const*) in libcryptopp.a(randpool.o) 
     std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const*) in libcryptopp.a(modes.o) 

的libcryptopp.a似乎是罰款的ARMv7,但不適合arm64出於某種原因。如果我從鏈接過程中排除libcryptopp.a的64位版本,則會產生更多錯誤。

他們都使用-stdlib彙編= ++的libstdc

這是怎麼回事?

(我需要的,因爲TWEAK發展的原因arm64支持)

更新對不起所有的 - 事實證明它是使用舊libcryptopp.a,而無法正常找到libcryptopp.a。 .a源自其他地方,已經修復。

+2

在'libC++'命名空間中找到用於連接字符串的'+運算符'時遇到問題..您需要鏈接到libC++。 '-stdlib = libC++'NOT'-stdlib = libstdC++'我知道它看起來像一個小細節,但它發生的事情比它應該的多得多。 – Brandon

+0

@CantChooseUsernames但指令說-stdlib = libstdC++,並且在使用libstdC++編譯庫時不會與libC++鏈接導致錯誤? – kamziro

+0

你不是在建造它嗎?也許你也可以直接鏈接到它,看看會發生什麼。爲什麼要使用'-stdlib = libC++':http://stackoverflow.com/questions/16352833/linking-with-clang-on-os-x-generates-lots-of-symbol-not-found-errors和http://stackoverflow.com/questions/9000816/libc-stop-std-renaming-to-std-1 – Brandon

回答

1

「std :: __ 1 :: basic_string,std :: __ 1 :: allocator> :: __ init(char const *,unsigned long,unsigned long)」,引用自:... libcryptopp.a(randpool的.o)

這個庫已經建成,並取決於LLVM的C++運行時libc++ GNU C++運行時libstdc++

他們都使用-stdlib彙編=的libstdC++

您需要要麼重建libcryptopp.alibstdc++鏈路與-stdlib=libc++(並建立您對libc++代碼的其餘部分,以及)。


如果感興趣,__1是用於版本控制的內聯命名空間。請參閱What are inline namespaces for?Where does the __1 symbol come from when using LLVM's libc++?

+0

引用的wiki頁面提供了[Xcode Project](http://www.cryptopp.com)下的解決方案之一/維基/ IOS_(COMMAND_LINE)#Xcode_Project)。 – jww

+0

實際上,我自己編譯庫,並確保它們使用-libstdC++,以便該語句沒有錯。我之前嘗試過預編譯的庫,但沒有工作(我猜是因爲它與libC++鏈接) – kamziro