Closed aral closed 8 years ago
Yeah, disable bitcode in your app. We probably need to add this to the readme as well.
There are some significant changes necessary to support bitcode. I should open an issue just to document the research I've done on this so far.
The holdback to supporting Bitcode in ObjectiveGit is the C libraries it depends on:
While it is possible to build these libraries with bitcode, it doesn't look like that can be added to the current build process easily. For iOS, each of these libraries is built using make
(libssh2 & OpenSSL) or cmake
(libgit2). The build scripts run the complete build for each requested architecture in series and then the binaries are glued together with lipo
at the end to create a fat binary. While some flags can be passed to clang
to output the LLVM IR (bitcode), lipo
drops these "slices" when gluing the binaries together. The current approach to build each architecture in series would need to change to build them at once, but it looks like bugs in cmake
were the reason for the current approach. Whether these cmake
issues are still present is unknown, but this could block taking this approach to add bitcode to the libraries.
For Mac, libssh2 and OpenSSL pre-built binaries are installed through Homebrew, but these binaries do not include bitcode as far as I know.
Another approach to adding bitcode support is to step away from the current library builds and create Xcode projects to do the build. The bitcode side is easy with this approach, but the entire build process has to be recreated in order to make this work. A big risk to this approach is that as files are added, moved, removed and renamed in the respective projects or build flags change, these changes have to be mirrored in the corresponding Xcode project to keep the build working. For a big library such as OpenSSL, this could entail a great deal of work. (@pietbrauer has already gotten a jump on this in https://github.com/nerdishbynature/openssl)
On the bright side, libgit2 has already dropped OpenSSL as a dependency on Apple platforms. It is only libssh2 that still requires OpenSSL. There is some work going on in keithduncan/libssh2#2 to remove that dependency, but it hasn't progressed in several months.
Work has started in #542 to create an Xcode project build for libgit2 which I think makes sense to address other issues with Xcode.
TIL this is also required to build a tvOS Framework. https://github.com/nerdishbynature/objective-git/pull/2
Resolved by #553
Linker failure when compiling for device with iPhoneOS9.1.sdk:
The workaround, as stated in the error message, is to disable bitcode for your target:
Thoughts?