问题
I have a project which uses libcurl.all.a. It builds, links and runs perfectly on Xcode 4.6.3. But in Xcode5, it throws linker errors on undefined symbols. The error log is as follows.
Undefined symbols for architecture i386:
"_SSLCopyPeerCertificates", referenced from:
_darwinssl_connect_common in libcurl.all.a(libcurl_la-curl_darwinssl.o)
"_SSLDisposeContext", referenced from:
_Curl_darwinssl_close in libcurl.all.a(libcurl_la-curl_darwinssl.o)
_Curl_darwinssl_shutdown in libcurl.all.a(libcurl_la-curl_darwinssl.o)
_darwinssl_connect_common in libcurl.all.a(libcurl_la-curl_darwinssl.o)
"_SSLNewContext", referenced from:
_darwinssl_connect_common in libcurl.all.a(libcurl_la-curl_darwinssl.o)
"_SSLSetEnableCertVerify", referenced from:
_darwinssl_connect_common in libcurl.all.a(libcurl_la-curl_darwinssl.o)
"_SSLSetProtocolVersionEnabled", referenced from:
_darwinssl_connect_common in libcurl.all.a(libcurl_la-curl_darwinssl.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
SecurityFramework is already there in the project, and i have set Build Active Architecture Only to No. And since it compiles in Xcode 4.6.3, I don't think it got anything to do with missing target membership.
Is there any way to resolve this? Or a possible workaround, Its very essential to have this library working with Xcode5, since it needs to be used in an iOS7 application.
回答1:
So, am posting the answer so that it could be useful for anyone who might face a similar situation. I was able to sort out the issue from the comments of @deltheli and @sergio, so many thanks to them for helping out.
So, I had to run
lipo -info
to know the supported architectures, and
found that armv7s and arm64 was not supported, so i tried compiling it in armv7, which failed and explains the problem why it works perfectly in Xcode 4.6 and not in 5. My libcurl was outdated! And the version I used didn't support some of the DarwinSSL
symbols. Using a recent enough version fixed the issue for me.
来源:https://stackoverflow.com/questions/19294737/libcurl-linker-error-on-xcode5-but-working-fine-on-xcode-4-6