I tried to build with github's prebuilt cryptopp but it doesn't work, too. it occur errors like below:
Undefined symbols for architecture arm64: "CryptoPP::BufferedTransformation::ChannelFlush(std::string const&, bool, int, bool)", referenced from:
vtable for CryptoPP::SimpleProxyFilter in MYCLASSBBB.o vtable for CryptoPP::Bufferless<CryptoPP::Filter> in MYCLASSBBB.o
"CryptoPP::Filter::CopyRangeTo2(CryptoPP::BufferedTransformation&, unsigned long long&, unsigned long long, std::string const&, bool) const", referenced from:
vtable for CryptoPP::Base64Decoder in MYCLASSBBB.o vtable for CryptoPP::Unflushable<CryptoPP::Filter> in MYCLASSBBB.o vtable for CryptoPP::SimpleProxyFilter in MYCLASSBBB.o vtable for CryptoPP::Bufferless<CryptoPP::Filter> in MYCLASSBBB.o
"CryptoPP::Filter::TransferTo2(CryptoPP::BufferedTransformation&, unsigned long long&, std::string const&, bool)", referenced from:
vtable for CryptoPP::Base64Decoder in MYCLASSBBB.o vtable for CryptoPP::Unflushable<CryptoPP::Filter> in MYCLASSBBB.o vtable for CryptoPP::SimpleProxyFilter in MYCLASSBBB.o vtable for CryptoPP::Bufferless<CryptoPP::Filter> in MYCLASSBBB.o
"CryptoPP::BufferedTransformation::ChannelPut2(std::string const&, unsigned char const*, unsigned long, int, bool)", referenced from:
vtable for CryptoPP::Base64Decoder in MYCLASSBBB.o vtable for CryptoPP::Unflushable<CryptoPP::Filter> in MYCLASSBBB.o vtable for CryptoPP::SimpleProxyFilter in MYCLASSBBB.o vtable for CryptoPP::Bufferless<CryptoPP::Filter> in MYCLASSBBB.o
"CryptoPP::BufferedTransformation::ChannelCreatePutSpace(std::string const&, unsigned long&)", referenced from:
vtable for CryptoPP::Base64Decoder in MYCLASSBBB.o vtable for CryptoPP::Unflushable<CryptoPP::Filter> in MYCLASSBBB.o vtable for CryptoPP::SimpleProxyFilter in MYCLASSBBB.o vtable for CryptoPP::Bufferless<CryptoPP::Filter> in MYCLASSBBB.o
"CryptoPP::BufferedTransformation::ChannelPutModifiable2(std::string const&, unsigned char*, unsigned long, int, bool)", referenced from:
vtable for CryptoPP::Base64Decoder in MYCLASSBBB.o vtable for CryptoPP::Unflushable<CryptoPP::Filter> in MYCLASSBBB.o vtable for CryptoPP::SimpleProxyFilter in MYCLASSBBB.o vtable for CryptoPP::Bufferless<CryptoPP::Filter> in MYCLASSBBB.o
"CryptoPP::BufferedTransformation::ChannelMessageSeriesEnd(std::string const&, int, bool)", referenced from:
vtable for CryptoPP::Base64Decoder in MYCLASSBBB.o vtable for CryptoPP::Unflushable<CryptoPP::Filter> in MYCLASSBBB.o vtable for CryptoPP::SimpleProxyFilter in MYCLASSBBB.o vtable for CryptoPP::Bufferless<CryptoPP::Filter> in MYCLASSBBB.o
"CryptoPP::BufferedTransformation::SetRetrievalChannel(std::string const&)", referenced from:
vtable for CryptoPP::Base64Decoder in MYCLASSBBB.o vtable for CryptoPP::Unflushable<CryptoPP::Filter> in MYCLASSBBB.o vtable for CryptoPP::SimpleProxyFilter in MYCLASSBBB.o vtable for CryptoPP::Bufferless<CryptoPP::Filter> in MYCLASSBBB.o
"CryptoPP::StringSinkTemplate::StringSinkTemplate(std::string&)", referenced from:
encryptString(std::string const&) in MYCLASSBBB.o decryptString(std::string const&, int) in MYCLASSBBB.o MYCLASSAAA::setDeviceId() in MYCLASSAAA.o MYCLASSAAA::getSignature() in MYCLASSAAA.o
ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
the MYCLASSAAA and MYCLASSBBB are all of classes what using cryptopp lib. it using cryptlib.h, modes.h, filters.h, aes.h, base64.h, md5.h, hex.h.
I even tried to build the lib myself, but I it same errors happen. what should I do?
I hope your help. thanks.
add the xcode cmd
Ld /Users/USERNAME/Library/Developer/Xcode/DerivedData/PROJECT_NAME-aknkujyaqvqjswbhspmawywtyqee/Build/Products/Release-iphoneos/PROJECT_NAME.app/PROJECT_NAME normal arm64 cd /Users/USERNAME/Desktop/Development/Office_Projects/PROJECTROOT/root export IPHONEOS_DEPLOYMENT_TARGET=5.1.1 export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk -L/Users/USERNAME/Library/Developer/Xcode/DerivedData/PROJECT_NAME-aknkujyaqvqjswbhspmawywtyqee/Build/Products/Release-iphoneos -L/Users/USERNAME/Desktop/Development/Office_Projects/PROJECTROOT/root/PROJECT_NAME/libs/cocos2dx/platform/third_party/ios/libraries -L/Users/USERNAME/Desktop/Development/Office_Projects/PROJECTROOT/root/PROJECT_NAME/libs/EEAF-SDK7.0(i386,armv7,armv7s,arm64) -L/Users/USERNAME/Desktop/Development/Office_Projects/PROJECTROOT/root/PROJECT_NAME/libs/boost_1_57/ios -L/Users/USERNAME/Desktop/Development/Office_Projects/PROJECTROOT/root/PROJECT_NAME/Classes/cryptopp/lib -LPROJECT_NAME/cocos2dx/platform/third_party/ios/libraries -LPROJECT_NAME/EEAF-SDK7.0(i386,armv7,armv7s,arm64) -F/Users/USERNAME/Library/Developer/Xcode/DerivedData/PROJECT_NAME-aknkujyaqvqjswbhspmawywtyqee/Build/Products/Release-iphoneos -F/Users/USERNAME/Desktop/Development/Office_Projects/PROJECTROOT/root/PROJECT_NAME/libs -filelist /Users/USERNAME/Library/Developer/Xcode/DerivedData/PROJECT_NAME-aknkujyaqvqjswbhspmawywtyqee/Build/Intermediates/PROJECT_NAME.build/Release-iphoneos/PROJECT_NAME.build/Objects-normal/arm64/PROJECT_NAME.LinkFileList -dead_strip -lxml2 -lz -ObjC -lcryptopp -fobjc-link-runtime -miphoneos-version-min=5.1.1 -lc++ /Users/USERNAME/Desktop/Development/Office_Projects/PROJECTROOT/root/PROJECT_NAME/libs/boost_1_57/ios/boost.a -framework UIKit -framework CoreTelephony -lEEAF -framework FacebookSDK -framework AddressBook -framework AddressBookUI -framework AudioToolbox -framework AVFoundation -framework CFNetwork -framework CoreGraphics -framework CoreLocation -framework CoreMedia -framework CoreText -framework Foundation -framework ImageIO -framework MediaPlayer -framework MobileCoreServices -framework OpenAL -framework OpenGLES -framework QuartzCore -framework Security -framework SystemConfiguration -lsqlite3.0 -framework StoreKit -lcurl -Xlinker -dependency_info -Xlinker /Users/USERNAME/Library/Developer/Xcode/DerivedData/PROJECT_NAME-aknkujyaqvqjswbhspmawywtyqee/Build/Intermediates/PROJECT_NAME.build/Release-iphoneos/PROJECT_NAME.build/Objects-normal/arm64/PROJECT_NAME_dependency_info.dat -o /Users/USERNAME/Library/Developer/Xcode/DerivedData/PROJECT_NAME-aknkujyaqvqjswbhspmawywtyqee/Build/Products/Release-iphoneos/PROJECT_NAME.app/PROJECT_NAME
and "vtable for CRYPTOPP::~.o" always happen. with a notice :
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
I think you are not using
libc++
, which is LLVM's C++ standard library. I think that because I don't see a-stdlib=libc++
(but I don't recall if that's passed told
directly).The symbol is defined in the github's prebuilt cryptopp (that's my github, btw). Here's how to verify.
First, extract the arm64 library from the fat library:
Next, use
nm
to dump global symbols, and usec++filt
to demangle:The capitol
T
means you are searching for symbols that are defined and exported. Lowert
means its defined but not exported - i.e., private. CapitolU
means its undefined.The
__1
is whatlibc++
(LLVM) uses to differentiate fromlibstdc++
(GNU).std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >
is astring
, so that could be rewritten as:If this library was built against
libstdc++
(GNU), then the symbol from the library would be:We can repeat for the second problem child, and it follows the same pattern (
libc++
, and notlibstdc++
):This can be rewritten as:
-----
IF you need GNU's
libstdc++
, then you can build it yourself. Here are the steps:cryptopp-mobile.zip
. Unpack it right over top the Crypto++ source filesGNUmakefile
, find the iOS rule by searching for the block that begins withIS_IOS
IS_IOS
block:CXXFLAGS += -stdlib=libc++
. Change it toCXXFLAGS += -stdlib=libstdc++
-----
I downloaded Cocos2D-x and tried to look at its configuration (I'm not a Cmake guy, so I could be wrong with what follows). It has the following in
CmakeList.txt
:If Cmake is doing what I suspect, then its using LLVM's
libc++
. But its also using-std=c++11
, and the GitHub project is not using it. But I'm not sure-std=c++11
makes a difference here.Just bike shedding, but this is a bad sign:
_SCL_SECURE_NO_WARNINGS
. If they are blatantly doing that, then they probably have various degrees of of badness and brokenness. (Just my experience with auditing software).If interested, the
__1
is an inline namespace used for versioning. See What are inline namespaces for? and Where does the __1 symbol come from when using LLVM's libc++?.