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

Comments

Projects
None yet
3 participants
@sgammon

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 ios label Aug 28, 2017

@vixentael

This comment has been minimized.

Member

vixentael commented Aug 28, 2017

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

This comment has been minimized.

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

This comment has been minimized.

Contributor

gene-eu 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

This comment has been minimized.

Member

vixentael commented Aug 29, 2017

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

This comment has been minimized.

Member

vixentael commented Aug 29, 2017

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 :)

@vixentael

This comment has been minimized.

Member

vixentael commented Aug 30, 2017

@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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

sgammon commented Aug 31, 2017

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

@vixentael

This comment has been minimized.

Member

vixentael commented Aug 31, 2017

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

This comment has been minimized.

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

This comment has been minimized.

Member

vixentael commented Sep 1, 2017

I've opened PR in GRKOpenSSLFramework repo
levigroker/GRKOpenSSLFramework#3

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

@sgammon

This comment has been minimized.

sgammon commented Sep 1, 2017

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

@sgammon

This comment has been minimized.

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

This comment has been minimized.

Member

vixentael commented Sep 6, 2017

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

This comment has been minimized.

Member

vixentael commented Sep 11, 2017

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!

@vixentael vixentael closed this Sep 11, 2017

@sgammon

This comment has been minimized.

sgammon commented Sep 11, 2017

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

@vixentael

This comment has been minimized.

Member

vixentael commented Sep 13, 2017

@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