Building RMStore with OpenSSL for iOS and Errors Related to _llvm_gcov_init
Sometimes build errors are very obtuse, so here's how to fix problems with including OpenSSL in your iOS project
While building RMStore
for an app I was working on, I ran into a problem where I was getting these very obtuse errors from Xcode:
Undefined symbols for architecture x86_64:
"_llvm_gcov_init", referenced from:
___llvm_gcov_init in libRMStore.a(RMStore.o)
___llvm_gcov_init in libRMStore.a(RMStoreAppReceiptVerifier.o)
___llvm_gcov_init in libRMStore.a(RMStoreKeychainPersistence.o)
___llvm_gcov_init in libRMStore.a(RMAppReceipt.o)
"_llvm_gcda_end_file", referenced from:
___llvm_gcov_writeout in libRMStore.a(RMStore.o)
___llvm_gcov_writeout in libRMStore.a(RMStoreAppReceiptVerifier.o)
___llvm_gcov_writeout in libRMStore.a(RMStoreKeychainPersistence.o)
___llvm_gcov_writeout in libRMStore.a(RMAppReceipt.o)
"_llvm_gcda_emit_function", referenced from:
___llvm_gcov_writeout in libRMStore.a(RMStore.o)
___llvm_gcov_writeout in libRMStore.a(RMStoreAppReceiptVerifier.o)
___llvm_gcov_writeout in libRMStore.a(RMStoreKeychainPersistence.o)
___llvm_gcov_writeout in libRMStore.a(RMAppReceipt.o)
"_llvm_gcda_emit_arcs", referenced from:
___llvm_gcov_writeout in libRMStore.a(RMStore.o)
___llvm_gcov_writeout in libRMStore.a(RMStoreAppReceiptVerifier.o)
___llvm_gcov_writeout in libRMStore.a(RMStoreKeychainPersistence.o)
___llvm_gcov_writeout in libRMStore.a(RMAppReceipt.o)
"_llvm_gcda_start_file", referenced from:
___llvm_gcov_writeout in libRMStore.a(RMStore.o)
___llvm_gcov_writeout in libRMStore.a(RMStoreAppReceiptVerifier.o)
___llvm_gcov_writeout in libRMStore.a(RMStoreKeychainPersistence.o)
___llvm_gcov_writeout in libRMStore.a(RMAppReceipt.o)
"_llvm_gcda_summary_info", referenced from:
___llvm_gcov_writeout in libRMStore.a(RMStore.o)
___llvm_gcov_writeout in libRMStore.a(RMStoreAppReceiptVerifier.o)
___llvm_gcov_writeout in libRMStore.a(RMStoreKeychainPersistence.o)
___llvm_gcov_writeout in libRMStore.a(RMAppReceipt.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This was really strange, since I had successfully built RMStore
using a bitcode-enabled OpenSSL before. I immediately took to diffing the build settings for the two different apps and zeroed on the build setting Instrument Program Flow
. It had been enabled for debug builds in the bad app, but disabled on the working app. Toggling that to No
instantly fixed it.
Some perfunctory Google searches don't yield much helpful information on what this particular build setting is, except that it is related to unit testing and to turn it off.