Xit icon indicating copy to clipboard operation
Xit copied to clipboard

Build issue, Build for Profiling or Release produces linker error

Open JanX2 opened this issue 7 years ago • 11 comments

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.

JanX2 avatar Jan 22 '18 21:01 JanX2

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.

JanX2 avatar Jan 23 '18 08:01 JanX2

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.

Uncommon avatar Jan 23 '18 14:01 Uncommon

It looks to me like the libssl you are linking into your release builds might not be the one you think.

JanX2 avatar Jan 24 '18 09:01 JanX2

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?

Uncommon avatar Jan 24 '18 14:01 Uncommon

ObjectiveGit-Mac Group

JanX2 avatar Jan 24 '18 16:01 JanX2

It looks like the xcconfig is supposed to be something Objective Git gets from Carthage. Are you sure you have that up to date?

Uncommon avatar Jan 24 '18 16:01 Uncommon

brew upgrade carthage followed by bootstrap didn’t resolve the issue.

A clean followed by another release build didn’t resolve it either.

JanX2 avatar Jan 25 '18 18:01 JanX2

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?

Uncommon avatar Jan 25 '18 18:01 Uncommon

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.

JanX2 avatar Jan 25 '18 19:01 JanX2

OK, glad you got it working. I guess the thing to do is submit a pull request to Objective Git.

Uncommon avatar Jan 25 '18 19:01 Uncommon

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.

Uncommon avatar May 08 '18 20:05 Uncommon