Build issue, Build for Profiling or Release produces linker error
This happens OOTB after issue #336 was resolved:
Undefined symbols for architecture x86_64:
"_SSLClose", referenced from:
_stransport_close in libgit2.a(stransport_stream.c.o)
"_SSLCopyPeerTrust", referenced from:
_stransport_connect in libgit2.a(stransport_stream.c.o)
_stransport_certificate in libgit2.a(stransport_stream.c.o)
"_SSLCreateContext", referenced from:
_git_stransport_stream_new in libgit2.a(stransport_stream.c.o)
"_SSLHandshake", referenced from:
_stransport_connect in libgit2.a(stransport_stream.c.o)
"_SSLRead", referenced from:
_stransport_read in libgit2.a(stransport_stream.c.o)
"_SSLSetConnection", referenced from:
_git_stransport_stream_new in libgit2.a(stransport_stream.c.o)
"_SSLSetIOFuncs", referenced from:
_git_stransport_stream_new in libgit2.a(stransport_stream.c.o)
"_SSLSetPeerDomainName", referenced from:
_git_stransport_stream_new in libgit2.a(stransport_stream.c.o)
"_SSLSetProtocolVersionMax", referenced from:
_git_stransport_stream_new in libgit2.a(stransport_stream.c.o)
"_SSLSetProtocolVersionMin", referenced from:
_git_stransport_stream_new in libgit2.a(stransport_stream.c.o)
"_SSLSetSessionOption", referenced from:
_git_stransport_stream_new in libgit2.a(stransport_stream.c.o)
"_SSLWrite", referenced from:
_stransport_write in libgit2.a(stransport_stream.c.o)
"_SecCertificateCopyData", referenced from:
_stransport_certificate in libgit2.a(stransport_stream.c.o)
"_SecCopyErrorMessageString", referenced from:
_stransport_error in libgit2.a(stransport_stream.c.o)
"_SecTrustEvaluate", referenced from:
_stransport_connect in libgit2.a(stransport_stream.c.o)
"_SecTrustGetCertificateAtIndex", referenced from:
_stransport_certificate in libgit2.a(stransport_stream.c.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Additionally, I got this warning:
The file "Release.xcconfig" couldn’t be opened because its path couldn't be resolved. It may be missing.
I ran 'Xit/objective-git/script/update_libssl_ios' on a whim and the error changed to this:
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
My knowledge of build systems other than Xcode’s is extremely superficial so I have no idea why libssl can’t be found.
Me neither. Usually running bootstrap and making sure all the submodules are up to date is enough for me. I'll look into it more when I get the chance.
It looks to me like the libssl you are linking into your release builds might not be the one you think.
I think libgit2 is the only thing explicitly linking to libssl, and I don't think that is affected by release vs debug settings. What part of the build is it that's failing?
ObjectiveGit-Mac Group
It looks like the xcconfig is supposed to be something Objective Git gets from Carthage. Are you sure you have that up to date?
brew upgrade carthage followed by bootstrap didn’t resolve the issue.
A clean followed by another release build didn’t resolve it either.
The only "Release.xcconfig" I see is in /Xit/objective-git/Carthage/Checkouts/xcconfigs/Base/Configurations/. Do you have that there?
Does the debug build work okay?
I have fixed the build temporarily by adding the following paths to the “ObjectiveGit-Mac” target:
External/libssl to OTHER_LDFLAGS
openssl to HEADER_SEARCH_PATHS
Xit/objective-git/Carthage/Checkouts/xcconfigs/Base/Configurations exists and the file exists there as well. This is after the brew upgrade carthage and the bootstrap.
OK, glad you got it working. I guess the thing to do is submit a pull request to Objective Git.
I finally had a chance to test this out myself because I got an upgraded machine at work. After updating for Swift 4.1 and the latest Objective Git, I was able to build for both debug and profiling. I've pushed those changes to the master branch, cherry-picked from the splitStaging branch that's been in progress for a while.