FredericJacobs / OpenSSL-Pod

Unmaintained - please fork. Email me to take over the CocoaPod
74 stars 112 forks source link

Can't pod install on OS X 10.11 / Xcode 7 #35

Closed lazerwalker closed 8 years ago

lazerwalker commented 8 years ago

I've been trying to pod install a project that requires this (Signal-iOS), but it's consistently failing to build for me on my machine (OS X 10.11.4, Xcode 7). Relevant failure in the log:

/Applications/Xcode.app/Contents/Developer/usr/bin/gcc -arch i386 -miphoneos-version-min=7.0 -I. -I.. -I../include  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk  -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk -fomit-frame-pointer -fno-common   -c -o mem_clr.o mem_clr.c
ar  r ../libcrypto.a cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o cpt_err.o ebcdic.o uid.o o_time.o o_str.o o_dir.o o_fips.o o_init.o fips_ers.o mem_clr.o
ar: ../libcrypto.a is a fat file (use libtool(1) or lipo(1) and ar(1) on it)
ar: ../libcrypto.a: Inappropriate file type or format
make[1]: *** [../libcrypto.a] Error 1
make: *** [build_crypto] Error 1

Steps to reproduce:

  1. git clone http://github.com/whispersystems/signal-ios
  2. pod install (or pod install --verbose, for more fun)

There are a couple GitHub Issues on the Signal-iOS repo that indicate this isn't just a "my machine is broken" problem, but it also pretty clearly seems like an OpenSSL issue rather than a Signal-iOS issue.

The way I've solved this in my own personal development environment is switching to the "OpenSSL-Universal" pod (which solves the problem by just including prebuilt binaries), but since it's a full minor point release behind your pod that's presumably not a viable option.

Googling around, this seems to be a relatively common issue (e.g. http://stackoverflow.com/questions/37063202/getting-libcrypto-ar-error-while-compiling-openssl-for-mac), the solution to which is usually to switch from ar to libtool. While I'm pretty confident I could kluge together some fix by manually modifying the Makefile on my machine, that doesn't really seem like a scalable solution, given that presumably most (or at least many) people trying to install this pod are going to run into that problem.

Not sure what the viable solution is – assuming the issue is in fact solved by updating the Makefile, and assuming OpenSSL isn't actually interested in making those changes upstream, maybe modifying the podspec install script to modify the Makefile itself? Just an addition to the README for this pod that outlines what needs to be done?

Happy to help in any way that I can, but I figured first would be to see if this is an issue you've encountered and/or solved before.

Thanks!

lazerwalker commented 8 years ago

(Checking off a few "did I RTFM?" questions: as per #32, I both nuked /tmp/openssl and tried again, and ensured that my default Xcode binary is sensible)

lazerwalker commented 8 years ago

And now it's working. Literally turned the computer off and on again. Computers, am I right?

Carry on.