Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bitcode #529

Closed
aral opened this issue Oct 22, 2015 · 4 comments
Closed

Bitcode #529

aral opened this issue Oct 22, 2015 · 4 comments

Comments

@aral
Copy link
Contributor

aral commented Oct 22, 2015

Linker failure when compiling for device with iPhoneOS9.1.sdk:

ld: '/Users/aral/Ind.ie/products/blockdown/apps/Carthage/Build/iOS/ObjectiveGit
.framework/ObjectiveGit' does not contain bitcode. You must rebuild it with bit code
enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the 
vendor, or disable bitcode for this target. for architecture arm64

The workaround, as stated in the error message, is to disable bitcode for your target:

bitcode

Thoughts?

@phatblat
Copy link
Member

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.

@phatblat
Copy link
Member

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.

@pietbrauer
Copy link
Member

TIL this is also required to build a tvOS Framework. nerdishbynature#2

@pietbrauer
Copy link
Member

Resolved by #553

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants