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

Android Release Build Failure: Cannot specify link libraries for target #780

Closed
ravindraguptacapgemini opened this issue Jul 8, 2023 · 1 comment

Comments

@ravindraguptacapgemini
Copy link

Bug report

Recently we migrated our app to New Architecture with React Native 0.72.1, Debug build is working fine but getting cmake error for release build with command

/bin/bash gradlew assembleRelease

Summary

Here are the build logs:

Task :app:configureCMakeRelWithDebInfo[arm64-v8a]
C/C++: CMake Error at /Users/ravindragupta/Desktop/Projects/mobilev2/native/android/app/build/generated/rncli/src/main/jni/Android-rncli.cmake:6 (add_subdirectory):
C/C++: add_subdirectory given source
C/C++: "/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@react-native-community/datetimepicker/android/build/generated/source/codegen/jni/"
C/C++: which is not an existing directory.
C/C++: Call Stack (most recent call first):
C/C++: /Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:121 (include)
C/C++: CMakeLists.txt:31 (include)
C/C++: CMake Error at /Users/ravindragupta/Desktop/Projects/mobilev2/native/android/app/build/generated/rncli/src/main/jni/Android-rncli.cmake:7 (add_subdirectory):
C/C++: add_subdirectory given source
C/C++: "/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/react-native-gesture-handler/android/build/generated/source/codegen/jni/"
C/C++: which is not an existing directory.
C/C++: Call Stack (most recent call first):
C/C++: /Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:121 (include)
C/C++: CMakeLists.txt:31 (include)
C/C++: CMake Error at /Users/ravindragupta/Desktop/Projects/mobilev2/native/android/app/build/generated/rncli/src/main/jni/Android-rncli.cmake:8 (add_subdirectory):
C/C++: add_subdirectory given source
C/C++: "/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/react-native-image-picker/android/build/generated/source/codegen/jni/"
C/C++: which is not an existing directory.
C/C++: Call Stack (most recent call first):
C/C++: /Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:121 (include)
C/C++: CMakeLists.txt:31 (include)
C/C++: CMake Error at /Users/ravindragupta/Desktop/Projects/mobilev2/native/android/app/build/generated/rncli/src/main/jni/Android-rncli.cmake:11 (add_subdirectory):
C/C++: add_subdirectory given source
C/C++: "/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/react-native-webview/android/build/generated/source/codegen/jni/"
C/C++: which is not an existing directory.
C/C++: Call Stack (most recent call first):
C/C++: /Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:121 (include)
C/C++: CMakeLists.txt:31 (include)
C/C++: CMake Error at /Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:124 (target_link_libraries):
C/C++: Cannot specify link libraries for target
C/C++: "react_codegen_RNDateTimePickerCGen" which is not built by this project.
C/C++: Call Stack (most recent call first):
C/C++: CMakeLists.txt:31 (include)

Task :app:configureCMakeRelWithDebInfo[arm64-v8a] FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:configureCMakeRelWithDebInfo[arm64-v8a]'.

[CXX1429] error when building with cmake using /Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/react-native/ReactAndroid/cmake-utils/default-app-setup/CMakeLists.txt: -- The C compiler identification is Clang 12.0.8
-- The CXX compiler identification is Clang 12.0.8
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Users/ravindragupta/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/ravindragupta/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/ravindragupta/Desktop/Projects/mobilev2/native/android/app/.cxx/RelWithDebInfo/624s2314/arm64-v8a/CMakeFiles/CMakeOutput.log".

C++ build system [configure] failed while executing:
/Users/ravindragupta/Library/Android/sdk/cmake/3.22.1/bin/cmake
-H/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/react-native/ReactAndroid/cmake-utils/default-app-setup
-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/ravindragupta/Library/Android/sdk/ndk/23.1.7779620
-DCMAKE_ANDROID_NDK=/Users/ravindragupta/Library/Android/sdk/ndk/23.1.7779620
-DCMAKE_TOOLCHAIN_FILE=/Users/ravindragupta/Library/Android/sdk/ndk/23.1.7779620/build/cmake/android.toolchain.cmake
-DCMAKE_MAKE_PROGRAM=/Users/ravindragupta/Library/Android/sdk/cmake/3.22.1/bin/ninja
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/ravindragupta/Desktop/Projects/mobilev2/native/android/app/build/intermediates/cxx/RelWithDebInfo/624s2314/obj/arm64-v8a
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/Users/ravindragupta/Desktop/Projects/mobilev2/native/android/app/build/intermediates/cxx/RelWithDebInfo/624s2314/obj/arm64-v8a
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DCMAKE_FIND_ROOT_PATH=/Users/ravindragupta/Desktop/Projects/mobilev2/native/android/app/.cxx/RelWithDebInfo/624s2314/prefab/arm64-v8a/prefab
-B/Users/ravindragupta/Desktop/Projects/mobilev2/native/android/app/.cxx/RelWithDebInfo/624s2314/arm64-v8a
-GNinja
-DPROJECT_BUILD_DIR=/Users/ravindragupta/Desktop/Projects/mobilev2/native/android/app/build
-DREACT_ANDROID_DIR=/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/react-native/ReactAndroid
-DANDROID_STL=c++_shared
-DANDROID_USE_LEGACY_TOOLCHAIN_FILE=ON
from /Users/ravindragupta/Desktop/Projects/mobilev2/native/android/app
CMake Error at /Users/ravindragupta/Desktop/Projects/mobilev2/native/android/app/build/generated/rncli/src/main/jni/Android-rncli.cmake:6 (add_subdirectory):
add_subdirectory given source
"/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@react-native-community/datetimepicker/android/build/generated/source/codegen/jni/"
which is not an existing directory.
Call Stack (most recent call first):
/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:121 (include)
CMakeLists.txt:31 (include)

CMake Error at /Users/ravindragupta/Desktop/Projects/mobilev2/native/android/app/build/generated/rncli/src/main/jni/Android-rncli.cmake:7 (add_subdirectory):
add_subdirectory given source
"/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/react-native-gesture-handler/android/build/generated/source/codegen/jni/"
which is not an existing directory.
Call Stack (most recent call first):
/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:121 (include)
CMakeLists.txt:31 (include)

CMake Error at /Users/ravindragupta/Desktop/Projects/mobilev2/native/android/app/build/generated/rncli/src/main/jni/Android-rncli.cmake:8 (add_subdirectory):
add_subdirectory given source
"/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/react-native-image-picker/android/build/generated/source/codegen/jni/"
which is not an existing directory.
Call Stack (most recent call first):
/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:121 (include)
CMakeLists.txt:31 (include)

CMake Error at /Users/ravindragupta/Desktop/Projects/mobilev2/native/android/app/build/generated/rncli/src/main/jni/Android-rncli.cmake:11 (add_subdirectory):
add_subdirectory given source
"/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/react-native-webview/android/build/generated/source/codegen/jni/"
which is not an existing directory.
Call Stack (most recent call first):
/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:121 (include)
CMakeLists.txt:31 (include)

CMake Error at /Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:124 (target_link_libraries):
Cannot specify link libraries for target
"react_codegen_RNDateTimePickerCGen" which is not built by this project.
Call Stack (most recent call first):
CMakeLists.txt:31 (include)

Reproducible sample code

Using the latest library version: 7.4.0

Steps to reproduce

  1. Build release app with: /bin/bash gradlew assembleRelease
  2. See error logs

Describe what you expected to happen:

  1. Build should create without error for datetimepicker

Environment info

npx react-native info output:

System:
  OS: macOS 13.4
  CPU: (12) arm64 Apple M2 Pro
  Memory: 102.30 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 16.20.0
    path: /usr/local/bin/node
  Yarn:
    version: 1.22.19
    path: /opt/homebrew/bin/yarn
  npm:
    version: 8.19.4
    path: /usr/local/bin/npm
  Watchman:
    version: 2023.06.26.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.12.1
    path: /Users/ravindragupta/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 22.4
      - iOS 16.4
      - macOS 13.3
      - tvOS 16.4
      - watchOS 9.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2022.2 AI-222.4459.24.2221.10121639
  Xcode:
    version: 14.3.1/14E300c
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 11.0.19
    path: /usr/bin/javac
  Ruby:
    version: 3.0.4
    path: /Users/ravindragupta/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react: Not Found
  react-native: Not Found
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: false
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

datetimepicker version: 7.4.2

iOS / Android version: 13.0

@github-actions
Copy link

👋 @ravindraguptacapgemini, sorry you're having an issue. This issue is being closed because it does not provide all information required by the issue template. As the issue template explains, we require that you provide a runnable example that reproduces your issue and your environment information. This means you need to provide a code snippet that we can copy-paste into an empty project and see the error ourselves, or provide a git repository with the issue.
The reason is that maintainers do not have time to try reproduce bugs themselves. Please try to minimize the superfluous code and focus only on reproducing the bug.
Please create a new issue with this and we'll be happy to review it!

@github-actions github-actions bot locked and limited conversation to collaborators Jul 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants