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

[iOS] Manual installation causes building error + [Android] Build fails due to minSdkVersion #8

Closed
paolospag opened this issue Sep 20, 2019 · 14 comments

Comments

@paolospag
Copy link

paolospag commented Sep 20, 2019

Hi!
I'm experiencing some problems due to manual installation.
I followed these steps:

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-virgil-crypto and add RNVirgilCrypto.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNVirgilCrypto.a to your project's Build PhasesLink Binary With Libraries

but when I run the react-native run-ios --simulator="iPhone 8" command the build fails with the following error:

// OTHER ERRORS HERE
...
fatal error: could not build module 'Darwin'
#include <TargetConditionals.h>
 ~~~~~~~~^
...
fatal error: could not build module 'CoreFoundation'
#include <CoreFoundation/CoreFoundation.h>
 ~~~~~~~~^
...
fatal error: could not build module 'Foundation'
#include <Foundation/Foundation.h>
 ~~~~~~~~^
...
fatal error: could not build module 'QuartzCore'
#import <QuartzCore/QuartzCore.h>
 ~~~~~~~^
** BUILD FAILED **


The following build commands failed:
        CompileC /MY/APP/PATH/Build/Intermediates.noindex/RNVirgilCrypto.build/Debug-iphonesimulator/RNVirgilCrypto.build/Objects-normal/x86_64/ResponseFactory.o
/MY/APP/PATH/node_modules/react-native-virgil-crypto/ios/ResponseFactory.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

I tried to set Header Search Path in Build Setting like that:

$(SRCROOT)/../node_modules/react-native-virgil-crypto/ios            non-recursive

But the build fails anyway.

Are other manual installation steps required? 🤔

UPDATE (2019-09-23)

I didn't see this recommendation in the documentation:

The recommended option is to install the native dependency with Carthage and link the bridge (i.e. this library) manually.

build probably fails due to native dependencies missing, but I've never used Carthage.
Is there an alternative to integrate native dependencies?

@paolospag
Copy link
Author

paolospag commented Sep 20, 2019

The build fails even on Android due to the minimum version of the SDK with the following error:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library [com.virgilsecurity.crypto:pythia-android:0.10.0] /Users/apple/.gradle/caches/transforms-2/files-2.1/d8c3ea03b106e704d30f97a4fe4d405f/AndroidManifest.xml as the library might be using APIs not available in 16
        Suggestion: use a compatible library with a minSdk of at most 16,
                or increase this project's minSdk version to at least 21,
                or use tools:overrideLibrary="com.virgilsecurity.crypto.pythia" to force usage (may lead to runtime failures)

I know it's a problem specified in the documentation, but my app needs to stay on minSdkVersion:16 or at the limit on 19, what can I do to resolve that?

@paolospag paolospag changed the title [iOS] Manual installation causes building error [iOS] Manual installation causes building error + [Android] Build fails due to minSdkVersion Sep 20, 2019
@vadimavdeev
Copy link
Contributor

Alternative way to install native dependencies on iOS would be to install them using CocoaPods, but it will not work with React Native 0.60.x due to incompatibility with use_framweorks! mentioned in Readme. If you have React Native 0.59.x or less, you can add the following lines to your Podfile:

use_frameworks!

pod 'VirgilCrypto', '5.1.0'
pod 'VirgilCryptoFoundation', '~> 0.10.0'
pod 'VirgilCryptoPythia', '~> 0.10.0'

and then do pod install

As for the Android min SDK version, I'm afraid it's a requirement of the underlying crypto library and there's nothing we can do about it on this library's side

@paolospag
Copy link
Author

iOS
unfortunately, I'm already using the 0.60.x version and at this point I'll have to wait for the new version of react-native.

Android
why the underlying crypto library minSdkVersion is 21? API incompatibility?
Do you expect to release a version compatible with at least minSdkVersion:19 in the future?

All this makes the integration process difficult...

@paolospag
Copy link
Author

paolospag commented Sep 24, 2019

@vadimavdeev
In the meantime, I tried to follow the steps for installing native dependencies through Carthage but build fails anyway.

Schermata-2019-09-24-alle-13 42 04

As you can see from the screenshot,

  • I imported the frameworks along with libRNVirgilCrypto.a
  • I created a "New Run Script Phase" and listed the "Input files"

but I'm not able to build with this configuration:

"@virgilsecurity/key-storage-rn": "^0.2.0-alpha.0",
"react-native": "0.60.5",
"react-native-virgil-crypto": "0.3.0",
"virgil-sdk": "^6.0.0-alpha.1"

@vadimavdeev
Copy link
Contributor

vadimavdeev commented Sep 24, 2019

@paolospag Do you have any 'VirgilCrypto' pods in your Podfile? If so, try removing them and running pod install again. You can also try to clean Derived Data in XCode. If that doesn't help, another possible solution would be to remove all of the dependencies (i.e. node_modules, ios/Pods and ios/Carthage folders) and install them again.

@paolospag
Copy link
Author

I had no VirgilCrypto pods in my Podfile.

However, I tried to do both clean Derived Data and clean/reinstall all dependencies but the build continues to fail with the same errors shown above.

Could it be caused by the fact that react-native dependencies are also installed via pods?

In addition I am experiencing errors related to CachingJwtProvider class of virgil-sdk-javascript I'm testing with Android, soon I will open an issue in the appropriate repo.

This migration / integration is proving more difficult than expected...

@vadimavdeev
Copy link
Contributor

@paolospag please check if removing $(SRCROOT)/../../../ios/Pods/Headers line in HEADER_SEARCH_PATHS of the RNVirgilCrypto.xcodeproj fixes the problem

Screenshot 2019-09-24 17 12 41

@paolospag
Copy link
Author

@vadimavdeev with your suggestion I reduce the amount of errors to one

Schermata 2019-09-24 alle 16 44 33

but build fails anyway...

@vadimavdeev
Copy link
Contributor

@paolospag could you create a sample project and share it with me so I can debug it locally? If not, I'll need at least your package.json, ios/Podfile, ios/Cartfile and <YOUR_APP>.xcodeproj files, and the output of react-native info command

@vadimavdeev
Copy link
Contributor

@paolospag actually, just making sure that HEADER_SEARCH_PATHS in your project Build Settings do not include any recursive entries under the Pods directory may fix the issue. It should look like this

Screenshot 2019-09-24 18 49 21

See this comment in a similar issue in firebase-ios-sdk.

Note that you'll need to revert the workaround that I suggested earlier

@paolospag
Copy link
Author

@vadimavdeev I have a simular situation, I don't include any recursive entries

Schermata 2019-09-24 alle 18 09 49
Schermata 2019-09-24 alle 18 10 07
Schermata 2019-09-24 alle 18 10 23

but at the RNVirgilCrypto.xcodeproj level, switch from recursive to non-recursive could solve the problem?

@vadimavdeev
Copy link
Contributor

vadimavdeev commented Sep 24, 2019

@paolospag yes, I think changing $(SRCROOT)/../../../ios/Pods/Headers recursive to $(SRCROOT)/../../../ios/Pods/Headers/Public/React-Core non-recursive at the RNVirgilCrypto.xcodeproj level can fix the problem.

EDIT: apparently, you'll need two non-recursive entries:

$(SRCROOT)/../../../ios/Pods/Headers/Public
$(SRCROOT)/../../../ios/Pods/Headers/Public/React-Core

instead of recursive $(SRCROOT)/../../../ios/Pods/Headers

@paolospag
Copy link
Author

paolospag commented Sep 25, 2019

@vadimavdeev
so, if I understand, at RNVirgilCrypto.xcodeproj level I should replace this recursive entry:
Schermata-2019-09-25-alle-12 14 54

with these two non-recursive entries:

$(SRCROOT)/../../../ios/Pods/Headers/Public
$(SRCROOT)/../../../ios/Pods/Headers/Public/React-Core

Correct?

EDIT:
the above workaround has definitely solved the problem, I suggest you put it in README if it can help other users with manual installation.


P.S. react-native@0.61 is out, when are you planning to release an update with CocoaPods support?

@vadimavdeev
Copy link
Contributor

vadimavdeev commented Sep 25, 2019

Great news. Glad it solved the issue. We'll start working on CocoaPods support in a week or two. We're in the middle of adding group encryption capability into E3kit.

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

2 participants