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

Can't build via CocoaPods on macOS High Sierra #219

Closed
sgammon opened this issue Aug 26, 2017 · 18 comments
Closed

Can't build via CocoaPods on macOS High Sierra #219

sgammon opened this issue Aug 26, 2017 · 18 comments
Assignees
Labels
O-iOS 📱 Operating system: iOS

Comments

@sgammon
Copy link

sgammon commented Aug 26, 2017

hey there,

i found your pod and it looks really great, i'd love to use it but cocoapods reports:

[...]
Installing themis (0.9.4)
[!] The 'Pods-Phone-Bloom' target has transitive dependencies that include static binaries: (/Volumes/PROPHET/Vault/Code/bloom-ios-prototype/Pods/OpenSSL-Universal/lib-ios/libcrypto.a and /Volumes/PROPHET/Vault/Code/bloom-ios-prototype/Pods/OpenSSL-Universal/lib-ios/libssl.a)

i would be happy to help submit a PR or help test if someone can point me in the right direction
i've tried with themis 0.9.4, and with master

@vixentael vixentael self-assigned this Aug 28, 2017
@vixentael vixentael added the O-iOS 📱 Operating system: iOS label Aug 28, 2017
@vixentael
Copy link
Contributor

Hi @sgammon!

Thank you for pointing this out!

Challenge we face

Themis depends on the OpenSSL pod, that is shipped as static library. As you know, it's quite difficult to use both static libraries and frameworks in your Podfile since CocoaPods 1.0.0 (large discussions were happen here: CocoaPods/CocoaPods#2926, CocoaPods/CocoaPods#3583 and CocoaPods/CocoaPods#3729)

Also there's an open issue in OpenSSL repo krzyzanowskim/OpenSSL#9 according switching to frameworks.

Our plan

One of the best options for Themis would be using OpenSSL as dynamic framework, that is discussed here #128. However, building and supporting dynamic frameworks for static libs is quite messy. Maybe one day we will switch to BoringSSL instead, as grpc maintainers did when they came across the same problem (grpc/grpc#4121).

Workaround to make it work now

As workaround I can suggest you to add these lines to your Podfile:

pre_install do |installer|
    def installer.verify_no_static_framework_transitive_dependencies; end
end

Please let me know if it helped!

@sgammon
Copy link
Author

sgammon commented Aug 29, 2017

i'm sorry but i've tried the fix you mention and it no longer seems to work. i get the same error. if it helps, i'm on cocoapods 1.3.1

i do understand the conundrum, but this is of course a show stopper bug for people already using dynamic frameworks in their code. i really like themis and the ecosystem of other software around it but i'm afraid this prevents us from being able to consider it for adoption at all.

BoringSSL would make me very happy as a user both because it is solid software and because it would fix this issue.

i'm familiar with it and i understand that it largely replaces similar interfaces exposed by OpenSSL, but i've also heard that code is rather nuanced.

is there a plan to actually implement BoringSSL, or is it really a "maybe someday" kind of thing?

as i mentioned earlier, i would be glad to help if my skillset has any value for solving this problem

edit: also, as an upcoming adoptee of gRPC as well, it would be great to share dependencies here rather than ship both.

@gene-eu-zz
Copy link

gene-eu-zz commented Aug 29, 2017

We're migrated some other versions of Themis to BoringSSL already (I'm pretty sure about Android, and I recon hearing we wanted to do so for Linux as well at some point), so this is rather a question of replicating that experience on iOS, shouldn't be too problematic.

@vixentael
Copy link
Contributor

I found this

https://github.com/levigroker/GRKOpenSSLFramework

This is pod with dynamic frameworks based on https://github.com/krzyzanowskim/OpenSSL repo and discussions I mentioned earlier. I'll try to link podspec to this dependency instead.

Give me some time, I'll be back.

@vixentael
Copy link
Contributor

Hi @sgammon

I've updated podspec to use GRKOpenSSLFramework as dependency in separate branch. You shouldn't have 'transitive dependencies' error right now.

Can you please update your podfile and link to the podspec directly, like this:

  pod 'themis', :podspec => 'https://raw.githubusercontent.com/cossacklabs/themis/podspec_dynamic_frameworks_GRKOpenSSLFramework/themis.podspec'

One thing I don't really like is that I disabled CLANG modules to make project built. This feels wrong and prevents running pod spec lint successfully (more discussion --> #128).

Please let me know if this themis spec works for you :)

@cossacklabs cossacklabs deleted a comment from gene-eu-zz Aug 29, 2017
@vixentael
Copy link
Contributor

@sgammon

I know how to switch to OpenSSL dynamic frameworks without a "CLANG modules mess" 😄
I described our next steps here --> #128 (comment)

I'll keep you updated when merge that changes into release branch.

@sgammon
Copy link
Author

sgammon commented Aug 31, 2017

I will try it with these changes tonight and report back. it would still be the preferred route IMO though to build off of boringSSL which has a shorter patch cycle than openSSL, although i will take what i can get :)

thank you for posting this change

@sgammon
Copy link
Author

sgammon commented Aug 31, 2017

ld: '/Volumes/PROPHET/Vault/Code/bloom-ios-prototype/Pods/GRKOpenSSLFramework/OpenSSL-iOS/bin/openssl.framework/openssl' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. file '/Volumes/PROPHET/Vault/Code/bloom-ios-prototype/Pods/GRKOpenSSLFramework/OpenSSL-iOS/bin/openssl.framework/openssl' for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

😞

@sgammon
Copy link
Author

sgammon commented Aug 31, 2017

Perhaps we could fork that and re-build w/bitcode?

@vixentael
Copy link
Contributor

Currently i've update podspec to disable bitcode :)
https://github.com/cossacklabs/themis/blob/release_0.9.5/themis.podspec

Will google tomorrow what are the best options to re-build frameworks

@sgammon
Copy link
Author

sgammon commented Aug 31, 2017

Ok, disabling bitcode (temporarily) in my project and all pods has it building with the modified Podspec for themis.

@vixentael
Copy link
Contributor

I've opened PR in GRKOpenSSLFramework repo
https://github.com/levigroker/GRKOpenSSLFramework/pull/3

I think we'll have bitcode support quite soon :)

@sgammon
Copy link
Author

sgammon commented Sep 1, 2017

thanks @vixentael. looking forward to it! right on.

@sgammon
Copy link
Author

sgammon commented Sep 2, 2017

hey @vixentael - one small issue. i get this warning when building with themis now. i'm sure you'll fix it before release, just wanted to make sure you were aware :)

let me know if I can help in any way. thank you again!

screen shot 2017-09-02 at 10 16 45 am

@vixentael
Copy link
Contributor

Thank you @sgammon

Unfortunately this happens because it's unreal to preserve the folder structure using CocoaPods. Themis core has two different files with the same name error.h files inside different folders: themis and soter. After integrating Pod, the folder structure is 'flat' and both files are situated on the same level of depth (that's why Xcode complains).

The only way to preserve folder structure is to create subspec inside podspec, however it's not an option for us: soter is not a separate part of the project and shouldn't be moved into separate subspec.

If you believe that this warning is crucial, please open a separate Issue, we'll try to use magic renaming technique: rename error.h inside themis-core!

However I can't promise that it's a quick solution: need to make sure that all wrappers are not affected :)

@vixentael
Copy link
Contributor

Dear @sgammon

After long days of fixing-updating-trying-repeating-again, I can say that branch https://github.com/cossacklabs/themis/tree/release_0.9.5 contains Themis podspec that fully supports bitcode.

Please link Themis to your project as
pod 'themis', :git => "https://github.com/cossacklabs/themis.git", :branch => 'release_0.9.5'

Consider this as pre-release version :)

We will publish release very soon (need to update other wrappers as well).

Please re-open this issue if you still experience difficulties.

Thank you a lot for your help and patience!

@sgammon
Copy link
Author

sgammon commented Sep 11, 2017

Thank you @vixentael!! Very excited to get started with themis

@vixentael
Copy link
Contributor

@sgammon Themis 0.9.5 is officially out!

Now you can write in your podfile pod 'themis', '0.9.5' 💪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-iOS 📱 Operating system: iOS
Projects
None yet
Development

No branches or pull requests

3 participants