react-native-website: New arch build followed per guide fails in Step 4 on running codegen for Android
Description
Following the guide by the letter at https://reactnative.dev/docs/the-new-architecture/cxx-cxxturbomodules breaks in step4 - codegen
I’ve made uploaded the code to a public repo - https://github.com/ArindamRayMukherjee/NewArchErrorRepro
It works fine for ios, with RCT_NEW_ARCH_ENABLED=1 pod install
I can see the C++ files (AppSpecsJSI.h and AppSpecsJSI-generated.cpp)
The project is set up to a place where yarn android
should do the codegen.
However it fails with
BUILD FAILED in 25s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:configureCMakeDebug[arm64-v8a]'.
> [CXX1405] error when building with cmake using /Users/arindamray/IdeaProjects/temp/NewArchErrorRepro/android/app/src/main/jni/CMakeLists.txt: -- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Users/arindamray/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Users/arindamray/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring incomplete, errors occurred!
See also "/Users/arindamray/IdeaProjects/temp/NewArchErrorRepro/android/app/.cxx/Debug/3h1z6k1h/arm64-v8a/CMakeFiles/CMakeOutput.log".
C++ build system [configure] failed while executing:
/Users/arindamray/Library/Android/sdk/cmake/3.18.1/bin/cmake \
-H/Users/arindamray/IdeaProjects/temp/NewArchErrorRepro/android/app/src/main/jni \
-DCMAKE_SYSTEM_NAME=Android \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_SYSTEM_VERSION=21 \
-DANDROID_PLATFORM=android-21 \
-DANDROID_ABI=arm64-v8a \
-DCMAKE_ANDROID_ARCH_ABI=arm64-v8a \
-DANDROID_NDK=/Users/arindamray/Library/Android/sdk/ndk/23.1.7779620 \
-DCMAKE_ANDROID_NDK=/Users/arindamray/Library/Android/sdk/ndk/23.1.7779620 \
-DCMAKE_TOOLCHAIN_FILE=/Users/arindamray/Library/Android/sdk/ndk/23.1.7779620/build/cmake/android.toolchain.cmake \
-DCMAKE_MAKE_PROGRAM=/Users/arindamray/Library/Android/sdk/cmake/3.18.1/bin/ninja \
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/arindamray/IdeaProjects/temp/NewArchErrorRepro/android/app/build/intermediates/cxx/Debug/3h1z6k1h/obj/arm64-v8a \
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/Users/arindamray/IdeaProjects/temp/NewArchErrorRepro/android/app/build/intermediates/cxx/Debug/3h1z6k1h/obj/arm64-v8a \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_FIND_ROOT_PATH=/Users/arindamray/IdeaProjects/temp/NewArchErrorRepro/android/app/.cxx/Debug/3h1z6k1h/prefab/arm64-v8a/prefab \
-B/Users/arindamray/IdeaProjects/temp/NewArchErrorRepro/android/app/.cxx/Debug/3h1z6k1h/arm64-v8a \
-GNinja \
-DPROJECT_BUILD_DIR=/Users/arindamray/IdeaProjects/temp/NewArchErrorRepro/android/app/build \
-DREACT_ANDROID_DIR=/Users/arindamray/IdeaProjects/temp/NewArchErrorRepro/node_modules/react-native/ReactAndroid \
-DANDROID_STL=c++_shared
from /Users/arindamray/IdeaProjects/temp/NewArchErrorRepro/android/app
CMake Warning at /Users/arindamray/Library/Android/sdk/ndk/23.1.7779620/build/cmake/android-legacy.toolchain.cmake:416 (message):
An old version of CMake is being used that cannot automatically detect
compiler attributes. Compiler identification is being bypassed. Some
values may be wrong or missing. Update to CMake 3.19 or newer to use
CMake's built-in compiler identification.
Call Stack (most recent call first):
/Users/arindamray/Library/Android/sdk/ndk/23.1.7779620/build/cmake/android.toolchain.cmake:55 (include)
/Users/arindamray/Library/Android/sdk/cmake/3.18.1/share/cmake-3.18/Modules/CMakeDetermineSystem.cmake:93 (include)
CMakeLists.txt:28 (project)
CMake Warning at /Users/arindamray/Library/Android/sdk/ndk/23.1.7779620/build/cmake/android-legacy.toolchain.cmake:416 (message):
An old version of CMake is being used that cannot automatically detect
compiler attributes. Compiler identification is being bypassed. Some
values may be wrong or missing. Update to CMake 3.19 or newer to use
CMake's built-in compiler identification.
Call Stack (most recent call first):
/Users/arindamray/Library/Android/sdk/ndk/23.1.7779620/build/cmake/android.toolchain.cmake:55 (include)
/Users/arindamray/IdeaProjects/temp/NewArchErrorRepro/android/app/.cxx/Debug/3h1z6k1h/arm64-v8a/CMakeFiles/3.18.1-g262b901/CMakeSystem.cmake:6 (include)
/Users/arindamray/IdeaProjects/temp/NewArchErrorRepro/android/app/.cxx/Debug/3h1z6k1h/arm64-v8a/CMakeFiles/CMakeTmp/CMakeLists.txt:2 (project)
CMake Warning at /Users/arindamray/Library/Android/sdk/ndk/23.1.7779620/build/cmake/android-legacy.toolchain.cmake:416 (message):
An old version of CMake is being used that cannot automatically detect
compiler attributes. Compiler identification is being bypassed. Some
values may be wrong or missing. Update to CMake 3.19 or newer to use
CMake's built-in compiler identification.
Call Stack (most recent call first):
/Users/arindamray/Library/Android/sdk/ndk/23.1.7779620/build/cmake/android.toolchain.cmake:55 (include)
/Users/arindamray/IdeaProjects/temp/NewArchErrorRepro/android/app/.cxx/Debug/3h1z6k1h/arm64-v8a/CMakeFiles/3.18.1-g262b901/CMakeSystem.cmake:6 (include)
/Users/arindamray/IdeaProjects/temp/NewArchErrorRepro/android/app/.cxx/Debug/3h1z6k1h/arm64-v8a/CMakeFiles/CMakeTmp/CMakeLists.txt:2 (project)
CMake Error at /Users/arindamray/IdeaProjects/temp/NewArchErrorRepro/tm/CMakeLists.txt:13 (target_include_directories):
Cannot specify include directories for target "react_codegen_AppSpecs"
which is not built by this project.
* 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.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
java.lang.StackOverflowError (no error message)
* 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.
==============================================================================
React Native Version
0.71.4
Output of npx react-native info
System: OS: macOS 13.0 CPU: (10) arm64 Apple M1 Max Memory: 571.34 MB / 64.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.16.0 - /usr/local/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 9.4.2 - /usr/local/bin/npm Watchman: Not Found Managers: CocoaPods: 1.11.3 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1 Android SDK: Not Found IDEs: Android Studio: 2021.3 AI-213.7172.25.2113.9123335 Xcode: 14.1/14B47b - /usr/bin/xcodebuild Languages: Java: 11.0.14 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: 0.71.4 => 0.71.4 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
Steps to reproduce
Download the project - https://github.com/ArindamRayMukherjee/NewArchErrorRepro
Run yarn android
Snack, code example, screenshot, or link to a repository
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 1
- Comments: 19 (5 by maintainers)
@IanBallinger You are a lifesaver! I already had that section in my
package.json
, but your comment forced me to look at it more carefully, and I noticed I had a typo in there (jsSrcDir
instead ofjsSrcsDir
) which was giving some really weird errors. Thank you!I was having the same issue while migrating a working app into a new monorepo. inspecting the differences revealed the problem. I had forgotten to add the required section into the app’s package.json, as instructed in the docs here. This is also absent in the OPs public repo for the thread.
I believe it’s a docs issue yes. The failure is on CMakeLists.txt only which is used only by Android