react-native-quick-crypto
react-native-quick-crypto copied to clipboard
'base64.h' file not found in MGLUtils.cpp
After upgrading to 0.7.0-rc.2 I am receiving the following error when building iOS through eas:
[RUN_FASTLANE] › Compiling react-native-quick-crypto Pods/react-native-quick-crypto » MGLUtils.cpp
[RUN_FASTLANE]
❌ (node_modules/react-native-quick-crypto/cpp/Utils/MGLUtils.cpp:9:10)
7 | #include <string>
8 |
> 9 | #include "base64.h"
| ^ 'base64.h' file not found
10 |
11 | #ifdef ANDROID
12 | #include "JSIUtils/MGLJSIMacros.h"
Here are the relevant package versions in my package.json:
"expo": "~50.0.14",
"react-native": "0.73.6",
"react-native-quick-base64": "^2.1.2",
"react-native-quick-crypto": "0.7.0-rc.2",
Under the android folder, CMakeLists.txt
The include directories needs to be updated to:
include_directories(
"../../../node_modules/react-native-quick-base64/cpp"
)
Is that Expo-specific?
If you have properly installed RNQC deps, there should be a RNQB64 folder in node_modules one directory up from ./android, not three (i.e. in your app).
Is that Expo-specific?
@boorad Yes, a managed Expo application. We were previously on 0.6.1 with no issues until issue #241 started happening. I don't think downgrading OpenSSL, the alternate solution suggested in that issue, will work in the long term because of the issue described here.
I get that, and I am suggesting use the release candidates, not downgrade. But why does Expo need the extra ../../ on your include_directories paths? If dependencies are installed properly, that shouldn't be the case. That's what I don't understand. But I don't use Expo.
I get that, and I am suggesting use the release candidates, not downgrade. But why does Expo need the extra
../../on your include_directories paths? If dependencies are installed properly, that shouldn't be the case. That's what I don't understand. But I don't use Expo.
That was @pehkay's solution above for Android. That is not a solution I can implement though, since it is a managed Expo application so the native ios and android folders and code are not available to edit. I had not yet tested Android when creating this issue, but after just trying to build it I am getting the same error:
[RUN_GRADLEW] /private/var/folders/t8/qqvt248d71l8td83wd3ksr8c0000gp/T/eas-build-local-nodejs/97c49f93-05be-44bc-9f82-f3aa3d0b1ddc/build/node_modules/react-native-quick-crypto/cpp/Utils/MGLUtils.cpp:9:10: fatal error: 'base64.h' file not found
[RUN_GRADLEW] #include "base64.h"
[RUN_GRADLEW] ^~~~~~~~~~
[RUN_GRADLEW] 1 error generated.
Is that Expo-specific?
If you have properly installed RNQC deps, there should be a RNQB64 folder in
node_modulesone directory up from./android, not three (i.e. in your app).
No. I am not using Expo. The workaround I posted is just an, well, to give an indicator of source of the Android compilation error.
It seems that cmake's INCLUDES is using the android folder as its working folder. C:/Projects/xxxx/node_modules/react-native-quick-crypto/android/
INCLUDES = -IC:/Projects/xxxx/node_modules/react-native-quick-crypto/android/../node_modules/react-native-quick-base64/cpp
The above doesn't work because it is looking for the nodes_modules folder in /react-native-quick-crypto
INCLUDES = -IC:/Projects/xxxx/node_modules/react-native-quick-crypto/android/../../../node_modules/react-native-quick-base64/cpp
This does.
I noticed that the other INCLUDES are not being included (is it only in Window environment)?
I will suggest to change to below or something equivalent ... (as I am a C++ noob).
set(NODE_MODULES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../node_modules")
....
include_directories( "${NODE_MODULES_DIR}/react-native-quick-base64/cpp" )
Just like you have used ${NODE_MODULES_DIR} in target_includes. Because they aren't included really. But it still works :)
target_include_directories( ${PACKAGE_NAME} PRIVATE "../cpp" "src/main/cpp" "${NODE_MODULES_DIR}/react-native/ReactCommon" "${NODE_MODULES_DIR}/react-native/ReactCommon/callinvoker" "${NODE_MODULES_DIR}/react-native/ReactAndroid/src/main/jni/react/turbomodule" "${NODE_MODULES_DIR}/react-native/ReactCommon/jsi" "${NODE_MODULES_DIR}/react-native/ReactCommon/turbomodule/core" "${NODE_MODULES_DIR}/react-native/ReactCommon/react/nativemodule/core" )
Can you throw together a PR, please? I'll pull it down and test from my side, and see if this improves our build story.
Can you throw together a PR, please? I'll pull it down and test from my side, and see if this improves our build story.
https://github.com/margelo/react-native-quick-crypto/pull/297
I have the same issue on react-native 0.74.0. iOS.
I get the same issue on iOS 0.7.0-rc.4, and RN 0.74.0 new architecture enabled I tried pasting the package RNQB64 folder in node_modules inside RNQC so that the path in podspec source_files matches "node_modules/react-native-quick-base64/cpp/base64.h" but it still failed with 'base64.h' file not found, have not tried android build yet
I fixed this using the latest version of react-native-quick-base64 , I'm using [email protected]
using react-native-quick-base64 2.1.2 and thats the latest version, still doesnt work
Given that react native 0.74.0 now has native atob and btoa, should we still have react-native-quick-base64 in here?
@pehkay can you pull the branch from #303 and try that instead of your PR? @shamilovtim helped me find what is hopefully the original culprit and a good fix for it.
EDIT: that is, test it after I fix the PR. It built locally, but not in Github actions.
Given that react native 0.74.0 now has native atob and btoa, should we still have react-native-quick-base64 in here?
I think so, for at least a little while. Maybe see if they are present and use them, otherwise use RNQB64.
@pehkay can you pull the branch from #303 and try that instead of your PR? @shamilovtim helped me find what is hopefully the original culprit and a good fix for it.
EDIT: that is, test it after I fix the PR. It built locally, but not in Github actions.
Ok. I tried your branch. There needs to be a fix as the arguments are causing error in gradle build (windows) :
externalNativeBuild {
cmake {
cppFlags "-O2 -frtti -fexceptions -Wall -Wno-unused-variable -fstack-protector-all"
arguments "-DANDROID_STL=c++_shared",
"-DNODE_MODULES_DIR=" + nodeModules
abiFilters (*reactNativeArchitectures())
}
}
Other than that, it looks good :)
arguments are causing error in gradle build (windows)
This SO article seems to show that it looks correct. Maybe add a println "nodeModules: ${nodeModules}" line somewhere to check the value is what you'd expect? What is the error?
I want to get this right for Windows too 🖖
arguments are causing error in gradle build (windows)
This SO article seems to show that it looks correct. Maybe add a
println "nodeModules: ${nodeModules}"line somewhere to check the value is what you'd expect? What is the error?I want to get this right for Windows too 🖖
Just ignore me. The "nodeModules: ${nodeModules}" should works in groovy.
Weird, that I might have pull the wrong commit down. My yarn pulls the code with:
arguments '-DANDROID_STL=c++_shared' , "-DNODE_MODULES_DIR=${nodeModules}",
And punctuation matters. It should be as below: (I did check your branch in github).
arguments "-DANDROID_STL=c++_shared" , "-DNODE_MODULES_DIR=${nodeModules}",
No, the comma on the end should not be there. It throws an error about String vs List.
You may have pulled it before I took that comma out. Also, be sure to gradle clean or equivalent on your platform. It helped me catch issues.
@boorad Does #303 also fix this issue for iOS?
@boorad Does #303 also fix this issue for iOS?
The example app builds locally for me, and CI says it works... give it a whirl.
But nothing should have changed for iOS in #303.
Last change for iOS was this.
Confirmed that it not work on pure [email protected] with react-native-quick-base64@^2.1.2, react-native-quick-crypto@^0.7.0-rc.4 on iOS
/node_modules/react-native-quick-crypto/cpp/Utils/MGLUtils.cpp:9:10: fatal error: 'base64.h' file not found
#include "base64.h"
^~~~~~~~~~
4 warnings and 1 error generated.
Confirmed that it not work on pure
[email protected]withreact-native-quick-base64@^2.1.2,react-native-quick-crypto@^0.7.0-rc.4on iOS/node_modules/react-native-quick-crypto/cpp/Utils/MGLUtils.cpp:9:10: fatal error: 'base64.h' file not found #include "base64.h" ^~~~~~~~~~ 4 warnings and 1 error generated.
Can you add reanimated and see if that fixes your problem?
Confirmed that it not work on pure
[email protected]withreact-native-quick-base64@^2.1.2,react-native-quick-crypto@^0.7.0-rc.4on iOS/node_modules/react-native-quick-crypto/cpp/Utils/MGLUtils.cpp:9:10: fatal error: 'base64.h' file not found #include "base64.h" ^~~~~~~~~~ 4 warnings and 1 error generated.Can you add reanimated and see if that fixes your problem?
Does not work for me following these steps: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started/#step-1-install-the-package
I have the same setup as @longnguyen2508, essentially trying to run the package on a fresh react native install.
Confirmed that it not work on pure
[email protected]withreact-native-quick-base64@^2.1.2,react-native-quick-crypto@^0.7.0-rc.4on iOS/node_modules/react-native-quick-crypto/cpp/Utils/MGLUtils.cpp:9:10: fatal error: 'base64.h' file not found
#include "base64.h"
^~~~~~~~~~4 warnings and 1 error generated.
Can you add reanimated and see if that fixes your problem?
Does not work for me following these steps: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started/#step-1-install-the-package
I have the same setup as @longnguyen2508, essentially trying to run the package on a fresh react native install.
But to be clear using Expo fixes the issues right?
Confirmed that it not work on pure
[email protected]withreact-native-quick-base64@^2.1.2,react-native-quick-crypto@^0.7.0-rc.4on iOS/node_modules/react-native-quick-crypto/cpp/Utils/MGLUtils.cpp:9:10: fatal error: 'base64.h' file not found
#include "base64.h"
^~~~~~~~~~4 warnings and 1 error generated.
Can you add reanimated and see if that fixes your problem?
Does not work for me following these steps: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started/#step-1-install-the-package I have the same setup as @longnguyen2508, essentially trying to run the package on a fresh react native install.
But to be clear using Expo fixes the issues right?
I'm not using expo (on my actual project, yes but this fresh install is just bare RN). I should say this is now working on iOS at least locally in dev but I can' tell why - as far as Android still getting the same error.
/Users/x/node_modules/react-native-quick-crypto/cpp/Utils/MGLUtils.cpp:9:10: fatal error: 'base64.h' file not found
#include "base64.h"
^~~~~~~~~~
1 error generated.
ninja: build stopped: subcommand failed.
C++ build system [build] failed while executing:
/Users/x/Library/Android/sdk/cmake/3.22.1/bin/ninja \
-C \
/Users/x//node_modules/react-native-quick-crypto/android/.cxx/Debug/51zm2n4k/arm64-v8a \
reactnativequickcrypto
from /Users/x/node_modules/react-native-quick-crypto/android
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
BUILD FAILED in 4s
error Failed to install the app. Command failed with exit code 1: ./gradlew app:installDebug -PreactNativeDevServerPort=8081 FAILURE: Build failed with an exception. * What went wrong:
Execution failed for task ':react-native-quick-crypto:buildCMakeDebug[arm64-v8a]'
Confirmed that it not work on pure
[email protected]withreact-native-quick-base64@^2.1.2,react-native-quick-crypto@^0.7.0-rc.4on iOS/node_modules/react-native-quick-crypto/cpp/Utils/MGLUtils.cpp:9:10: fatal error: 'base64.h' file not found
#include "base64.h"
^~~~~~~~~~4 warnings and 1 error generated.
Can you add reanimated and see if that fixes your problem?
Does not work for me following these steps: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started/#step-1-install-the-package I have the same setup as @longnguyen2508, essentially trying to run the package on a fresh react native install.
But to be clear using Expo fixes the issues right?
I'm not using expo (on my actual project, yes but this fresh install is just bare RN). I should say this is now working on iOS at least locally in dev but I can' tell why - as far as Android still getting the same error.
/Users/x/node_modules/react-native-quick-crypto/cpp/Utils/MGLUtils.cpp:9:10: fatal error: 'base64.h' file not found #include "base64.h" ^~~~~~~~~~ 1 error generated. ninja: build stopped: subcommand failed. C++ build system [build] failed while executing: /Users/x/Library/Android/sdk/cmake/3.22.1/bin/ninja \ -C \ /Users/x//node_modules/react-native-quick-crypto/android/.cxx/Debug/51zm2n4k/arm64-v8a \ reactnativequickcrypto from /Users/x/node_modules/react-native-quick-crypto/android * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. BUILD FAILED in 4s error Failed to install the app. Command failed with exit code 1: ./gradlew app:installDebug -PreactNativeDevServerPort=8081 FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':react-native-quick-crypto:buildCMakeDebug[arm64-v8a]'
I don't understand. You said it didn't work after adding reanimated. What changed?
If you remove reanimated, does it stop building?
Confirmed that it not work on pure
[email protected]withreact-native-quick-base64@^2.1.2,react-native-quick-crypto@^0.7.0-rc.4on iOS/node_modules/react-native-quick-crypto/cpp/Utils/MGLUtils.cpp:9:10: fatal error: 'base64.h' file not found
#include "base64.h"
^~~~~~~~~~4 warnings and 1 error generated.
Can you add reanimated and see if that fixes your problem?
Does not work for me following these steps: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started/#step-1-install-the-package I have the same setup as @longnguyen2508, essentially trying to run the package on a fresh react native install.
But to be clear using Expo fixes the issues right?
I'm not using expo (on my actual project, yes but this fresh install is just bare RN). I should say this is now working on iOS at least locally in dev but I can' tell why - as far as Android still getting the same error.
/Users/x/node_modules/react-native-quick-crypto/cpp/Utils/MGLUtils.cpp:9:10: fatal error: 'base64.h' file not found #include "base64.h" ^~~~~~~~~~ 1 error generated. ninja: build stopped: subcommand failed. C++ build system [build] failed while executing: /Users/x/Library/Android/sdk/cmake/3.22.1/bin/ninja \ -C \ /Users/x//node_modules/react-native-quick-crypto/android/.cxx/Debug/51zm2n4k/arm64-v8a \ reactnativequickcrypto from /Users/x/node_modules/react-native-quick-crypto/android * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. BUILD FAILED in 4s error Failed to install the app. Command failed with exit code 1: ./gradlew app:installDebug -PreactNativeDevServerPort=8081 FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':react-native-quick-crypto:buildCMakeDebug[arm64-v8a]'I don't understand. You said it didn't work after adding reanimated. What changed?
If you remove reanimated, does it stop building?
No, it doesn't - its working with and without reanimated on the fresh RN install without expo. Just doesn't build on android and fails with the missing base64.h error (regardless of reanimated). That said considering I was successful in the fresh RN install with iOS I've now moved back to my actual project which uses expo and it runs on Android but it doesn't on iOS.... seemingly there's something to this but I have no idea what it is. Don't think theres any point in following my case any further - maybe others can provide a more reproducible case. Thanks @shamilovtim - I'll keep trying on my end and if I find something conclusive I'll share it.
FYI, the android fix in #303 is not yet in a release candidate. You'd have to reference main in your package.json file to see if that solves android.