facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.28k stars 24.35k forks source link

RN v0.76.1 | Issue with codegenartifactschema for brownfield application #47606

Closed sandeep36butte closed 2 days ago

sandeep36butte commented 2 days ago

Description

I added couple of dependencies react-native-vision-camera and react-native-worklets-core when building the application getting error realted to codegen folder not present.But for react-native-worklets-core even before the task:generateCodegenArtifactsFromSchema run the cmake autogerenated file trying to link it.So getting error since the codegen file is still not there in the build folder. Might I have a setup wrongly configured or missed something to schedule the codegenartifiactsschema to run before the cmake linking of files. generatecodegenartifactschema running for vision-camera fine. FYI: Same setup works fine with newArch disabled or project bootstrapped with npx react-native init

Screenshot 2024-11-14 at 3 05 03 PM Screenshot 2024-11-14 at 3 06 02 PM

Steps to reproduce

This is the brownfield app. Git clone the repo: https://github.com/sandeep36butte/RNBrownFeldApp yarn start and run on android

React Native Version

0.76.1

Affected Platforms

Runtime - Android

Output of npx react-native info

info Fetching system and libraries information...
System:
  OS: macOS 14.2.1
  CPU: (10) arm64 Apple M1 Pro
  Memory: 158.83 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.18.0
    path: ~/.nvm/versions/node/v18.18.0/bin/node
  Yarn:
    version: 1.22.22
    path: ~/.nvm/versions/node/v18.18.0/bin/yarn
  npm:
    version: 9.8.1
    path: ~/.nvm/versions/node/v18.18.0/bin/npm
  Watchman:
    version: 2024.09.09.00
    path: /usr/local/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - watchOS 10.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.1 AI-241.18034.62.2412.12266719
  Xcode:
    version: 15.1/15C65
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.12
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.0
    wanted: 15.0.0
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.1
    wanted: 0.76.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Stacktrace or Logs

2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:configureCMakeDebug[arm64-v8a]'.
> [CXX1429] error when building with cmake using /Users/sandeep/rn-packages/newHybirdapp/RNBrownFeldApp/ReactNative/node_modules/react-native/ReactAndroid/cmake-utils/default-app-setup/CMakeLists.txt: -- The C compiler identification is Clang 17.0.2
  -- The CXX compiler identification is Clang 17.0.2
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /Users/sandeep/Library/Android/sdk/ndk/26.1.10909125/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/sandeep/Library/Android/sdk/ndk/26.1.10909125/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/sandeep/rn-packages/newHybirdapp/RNBrownFeldApp/Android/app/.cxx/Debug/436n5v2g/arm64-v8a/CMakeFiles/CMakeOutput.log".

  C++ build system [configure] failed while executing:
      /Users/sandeep/Library/Android/sdk/cmake/3.22.1/bin/cmake \
        -H/Users/sandeep/rn-packages/newHybirdapp/RNBrownFeldApp/ReactNative/node_modules/react-native/ReactAndroid/cmake-utils/default-app-setup \
        -DCMAKE_SYSTEM_NAME=Android \
        -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
        -DCMAKE_SYSTEM_VERSION=24 \
        -DANDROID_PLATFORM=android-24 \
        -DANDROID_ABI=arm64-v8a \
        -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a \
        -DANDROID_NDK=/Users/sandeep/Library/Android/sdk/ndk/26.1.10909125 \
        -DCMAKE_ANDROID_NDK=/Users/sandeep/Library/Android/sdk/ndk/26.1.10909125 \
        -DCMAKE_TOOLCHAIN_FILE=/Users/sandeep/Library/Android/sdk/ndk/26.1.10909125/build/cmake/android.toolchain.cmake \
        -DCMAKE_MAKE_PROGRAM=/Users/sandeep/Library/Android/sdk/cmake/3.22.1/bin/ninja \
        -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/sandeep/rn-packages/newHybirdapp/RNBrownFeldApp/Android/app/build/intermediates/cxx/Debug/436n5v2g/obj/arm64-v8a \
        -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/Users/sandeep/rn-packages/newHybirdapp/RNBrownFeldApp/Android/app/build/intermediates/cxx/Debug/436n5v2g/obj/arm64-v8a \
        -DCMAKE_BUILD_TYPE=Debug \
        -DCMAKE_FIND_ROOT_PATH=/Users/sandeep/rn-packages/newHybirdapp/RNBrownFeldApp/Android/app/.cxx/Debug/436n5v2g/prefab/arm64-v8a/prefab \
        -B/Users/sandeep/rn-packages/newHybirdapp/RNBrownFeldApp/Android/app/.cxx/Debug/436n5v2g/arm64-v8a \
        -GNinja \
        -DPROJECT_BUILD_DIR=/Users/sandeep/rn-packages/newHybirdapp/RNBrownFeldApp/Android/app/build \
        -DREACT_ANDROID_DIR=/Users/sandeep/rn-packages/newHybirdapp/RNBrownFeldApp/ReactNative/node_modules/react-native/ReactAndroid \
        -DANDROID_STL=c++_shared \
        -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=ON
    from /Users/sandeep/rn-packages/newHybirdapp/RNBrownFeldApp/Android/app
  CMake Error at /Users/sandeep/rn-packages/newHybirdapp/RNBrownFeldApp/Android/app/build/generated/autolinking/src/main/jni/Android-autolinking.cmake:10 (add_subdirectory):
    add_subdirectory given source
    "/Users/sandeep/rn-packages/newHybirdapp/RNBrownFeldApp/ReactNative/node_modules/react-native-worklets-core/android/build/generated/source/codegen/jni/"
    which is not an existing directory.
  Call Stack (most recent call first):
    /Users/sandeep/rn-packages/newHybirdapp/RNBrownFeldApp/ReactNative/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:86 (include)
    CMakeLists.txt:31 (include)

Reproducer

https://github.com/sandeep36butte/RNBrownFeldApp/tree/main

Screenshots and Videos

No response

sandeep36butte commented 2 days ago

My Bad was setting the newArchEnabled and hermesEnabled in boolenformat in rootproject. Beacuse of which inside the buildscripts of the rn-worklets-core package the newArchEnable checking is getting false and falling bvack to old architecture build.

Setting these in string format have resolved the issue.