0

Build settings in my project:

Architectures: armv7,arm64

Build Active architectures only: NO

Valid Architectures: armv7 armv7s arm64 arm6

I downloaded a prebuilt version of the library from Marek Kotewicz's GitHub which supports 64-bit architecture which I verified by terminal as with the help of this link:

file libcryptopp.a

Output:

libcryptopp.a: Mach-O universal binary with 5 architectures
libcryptopp.a (for architecture i386):  current ar archive random library
libcryptopp.a (for architecture armv7): current ar archive random library
libcryptopp.a (for architecture armv7s):    current ar archive random library
libcryptopp.a (for architecture x86_64):    current ar archive random library
libcryptopp.a (for architecture arm64): current ar archive random library

I tried to clean and build the project and it resulted in errors in the project with a message

Undefined symbols for architecture arm64:

I have tried each and every answer present on the SO posts and now I am unable to solve this problem, I have to submit my app to App store ASAP.Can someone help me out?

P.S Setting Build active architectures to YES will not solve the problem.

Community
  • 1
  • 1
SandeepAggarwal
  • 1,273
  • 3
  • 14
  • 38
  • When you see the error in compiler output, which symbols does the compiler complain for undefined symbols? You need to first understand which library is responsible for the undefined symbols, then you can inspect more at the problematic library. – utogaria Aug 10 '15 at 16:22
  • "CryptoPP::IteratedHashBase::Update(unsigned char const*, unsigned long)", referenced from: vtable for CryptoPP::IteratedHashWithStaticTransform, 128u, 64u, CryptoPP::SHA512, 64u, false> in CryptoppHash.o – SandeepAggarwal Aug 10 '15 at 16:23

2 Answers2

1

Change your Architecture's settings to this :

enter image description here

Munahil
  • 2,381
  • 1
  • 14
  • 24
  • Nops it doesn't work and btw why it will work when everything is same as I mentioned in the settings except removal of arm6 arch and that too from Valid archs? – SandeepAggarwal Aug 10 '15 at 17:02
  • Did you clean the build after making these changes? It should work.. My all projects have this configuration – Munahil Aug 10 '15 at 17:20
  • No, just this error multiple times for the different symbols. – SandeepAggarwal Aug 10 '15 at 17:27
  • See if http://stackoverflow.com/questions/28043785/undefined-symbols-for-architecture-x86-64-when-building-for-arm64 or http://stackoverflow.com/questions/28311795/undefined-symbols-in-cryptopp-at-ios-64-bit-project answer is any helpful – Munahil Aug 10 '15 at 17:30
1

This is likely to be caused by wrong build script which created the libcryptopp.a without the correct architecture for some symbols/objects. You can use the following commands to verify this:

$ lipo -thin arm64 libcryptopp.a -output libcryptopp_arm64.a
$ mkdir objects
$ mv libcryptopp_arm64.a objects
$ cd objects
$ ar -x libcryptopp_arm64.a

Find CryptoPP.o in the extract object files, then, execute this in command line:

nm CryptoPP.o > CryptoPP_symbols.txt

In the output file, namely CryptoPP_symbols.txt, check if you can find symboles like:

Update
EnumToType

I suppose you won't find them, because that's what the problem is. If you have source code for libcryptopp.a, you should find what's wrong with the build script. If you don't have source code, what you can do is quite limited, i.e, ask the provider of the libcryptopp.a to correct this issue for you.

utogaria
  • 3,662
  • 2
  • 14
  • 12
  • I couldn't find even CryptoPP.o file , but source code is available and I myself converted those files into static library – SandeepAggarwal Aug 10 '15 at 17:14
  • Cool, then, it's much easier to fix the problem by yourself. Have you tried the answer given by Munahil already? And how's the outcome? – utogaria Aug 10 '15 at 17:16
  • No, it didn't solved the problem as I mentioned in the comment – SandeepAggarwal Aug 10 '15 at 17:17
  • Ok, no worries, it will be solved. Could you give me the URL where you download the library's source from? I'll try it myself first. – utogaria Aug 10 '15 at 17:18
  • Ok, I've tried it by myself, everything worked as expected. So, here's a list of things to check: 1. Update the builder.sh: `ARCHS="i386 armv7 arm64" SDK_VERSION="8.4"` 2. Make sure in your Xcode project, all .m files which uses functionalities from libcryptopp has .mm instead of .m as file extension, this makes sure these files are compiled as objective-C++. 3. in build settings, make sure the architecture is $(ARCHS_STANDARD), valid architectures is arm64 and armv7. 4. C++ Language Dialet should be GNU++11, and C++ Standard Library should be libc++ Try this, and see if it works now. – utogaria Aug 10 '15 at 18:35
  • Update builder.sh to the following, so that it builds an universal lib that work with simulator and device: `line 4: ARCHS="x86_64 i386 armv7 arm64" line 5: SDK_VERSION="8.4" line 11: if [ "${ARCH}" == "i386" ] || [ "${ARCH}" == "x86_64" ]; then` – utogaria Aug 10 '15 at 19:16
  • Do I have to remake everything ? – SandeepAggarwal Aug 11 '15 at 05:21
  • Can u pls tell me steps to make library from that github code? – SandeepAggarwal Aug 11 '15 at 05:21
  • In the directory "cryptopp", there's a build script, namely "builder.sh", modify this script as I mentioned above. In terminal, run `sh builder.sh`, after the build is complete, go to "crypto/bin" directory, there you have the universal library. – utogaria Aug 11 '15 at 05:24
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/86667/discussion-between-utogaria-and-sandeepaggarwal). – utogaria Aug 11 '15 at 07:02