react-native-reanimated icon indicating copy to clipboard operation
react-native-reanimated copied to clipboard

[CXX1429] error when building with cmake using

Open sebasg0 opened this issue 1 year ago • 38 comments

Description

[CXX1429] error when building with cmake using /Users/sebastiangarcia/Desktop/work/flm/this/AwesomeProject/node_modules/react-native-reanimated/android/CMakeLists.txt: -- Android: Targeting API '21' with architecture 'arm64', ABI 'arm64-v8a', and processor 'aarch64' -- Android: Selected unified Clang toolchain -- 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 - failed -- Check for working C compiler: /Users/sebastiangarcia/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang -- Check for working C compiler: /Users/sebastiangarcia/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang - broken -- Configuring incomplete, errors occurred! See also "/Users/sebastiangarcia/Desktop/work/flm/this/AwesomeProject/node_modules/react-native-reanimated/android/.cxx/Debug/2m5o5448/arm64-v8a/CMakeFiles/CMakeOutput.log". See also "/Users/sebastiangarcia/Desktop/work/flm/this/AwesomeProject/node_modules/react-native-reanimated/android/.cxx/Debug/2m5o5448/arm64-v8a/CMakeFiles/CMakeError.log".

C++ build system [configure] failed while executing: /Users/sebastiangarcia/Library/Android/sdk/cmake/3.22.1/bin/cmake
-H/Users/sebastiangarcia/Desktop/work/flm/this/AwesomeProject/node_modules/react-native-reanimated/android
-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/sebastiangarcia/Library/Android/sdk/ndk/23.1.7779620
-DCMAKE_ANDROID_NDK=/Users/sebastiangarcia/Library/Android/sdk/ndk/23.1.7779620
-DCMAKE_TOOLCHAIN_FILE=/Users/sebastiangarcia/Library/Android/sdk/ndk/23.1.7779620/build/cmake/android.toolchain.cmake
-DCMAKE_MAKE_PROGRAM=/Users/sebastiangarcia/Library/Android/sdk/cmake/3.22.1/bin/ninja
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/sebastiangarcia/Desktop/work/flm/this/AwesomeProject/node_modules/react-native-reanimated/android/build/intermediates/cxx/Debug/2m5o5448/obj/arm64-v8a
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/Users/sebastiangarcia/Desktop/work/flm/this/AwesomeProject/node_modules/react-native-reanimated/android/build/intermediates/cxx/Debug/2m5o5448/obj/arm64-v8a
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_FIND_ROOT_PATH=/Users/sebastiangarcia/Desktop/work/flm/this/AwesomeProject/node_modules/react-native-reanimated/android/.cxx/Debug/2m5o5448/prefab/arm64-v8a/prefab
-B/Users/sebastiangarcia/Desktop/work/flm/this/AwesomeProject/node_modules/react-native-reanimated/android/.cxx/Debug/2m5o5448/arm64-v8a
-GNinja
-DANDROID_STL=c++_shared
-DREACT_NATIVE_MINOR_VERSION=72
-DANDROID_TOOLCHAIN=clang
-DCMAKE_C_FLAGS=-march=armv8-a
-DCMAKE_CXX_FLAGS=-march=armv8-a
-DCMAKE_EXE_LINKER_FLAGS=-Wl,--no-dead-strip-dylibs
-DREACT_NATIVE_DIR=/Users/sebastiangarcia/Desktop/work/flm/this/AwesomeProject/node_modules/react-native
-DJS_RUNTIME=hermes
-DJS_RUNTIME_DIR=/Users/sebastiangarcia/Desktop/work/flm/this/AwesomeProject/node_modules/react-native/sdks/hermes
-DCLIENT_SIDE_BUILD=true
-DIS_NEW_ARCHITECTURE_ENABLED=false
-DIS_REANIMATED_EXAMPLE_APP=false
-DPLAYGROUND_APP_NAME=AwesomeProject
-DREANIMATED_PACKAGE_BUILD=null
-DREANIMATED_VERSION=3.4.2
-DHERMES_ENABLE_DEBUGGER=1 from /Users/sebastiangarcia/Desktop/work/flm/this/AwesomeProject/node_modules/react-native-reanimated/android CMake Error at /Users/sebastiangarcia/Library/Android/sdk/cmake/3.22.1/share/cmake-3.22/Modules/CMakeTestCCompiler.cmake:69 (message): Change Dir: /Users/sebastiangarcia/Desktop/work/flm/this/AwesomeProject/node_modules/react-native-reanimated/android/.cxx/Debug/2m5o5448/arm64-v8a/CMakeFiles/CMakeTmp

Run Build Command(s):/Users/sebastiangarcia/Library/Android/sdk/cmake/3.22.1/bin/ninja cmTC_7cd0f && [1/2] Building C object CMakeFiles/cmTC_7cd0f.dir/testCCompiler.c.o
[2/2] Linking C executable cmTC_7cd0f
FAILED: cmTC_7cd0f 
: && /Users/sebastiangarcia/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang --target=aarch64-none-linux-android21 --sysroot=/Users/sebastiangarcia/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -march=armv8-a  -O2 -g -DNDEBUG -Wl,--no-dead-strip-dylibs CMakeFiles/cmTC_7cd0f.dir/testCCompiler.c.o -o cmTC_7cd0f  -latomic -lm && :
ld: error: unknown argument '--no-dead-strip-dylibs'
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.


"/Users/sebastiangarcia/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /Users/sebastiangarcia/Desktop/work/flm/this/AwesomeProject/node_modules/react-native-reanimated/android/.cxx/Debug/2m5o5448/arm64-v8a/CMakeFiles/CMakeTmp

Run Build Command(s):/Users/sebastiangarcia/Library/Android/sdk/cmake/3.22.1/bin/ninja cmTC_7cd0f && [1/2] Building C object CMakeFiles/cmTC_7cd0f.dir/testCCompiler.c.o
[2/2] Linking C executable cmTC_7cd0f
FAILED: cmTC_7cd0f 
: && /Users/sebastiangarcia/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang --target=aarch64-none-linux-android21 --sysroot=/Users/sebastiangarcia/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -march=armv8-a  -O2 -g -DNDEBUG -Wl,--no-dead-strip-dylibs CMakeFiles/cmTC_7cd0f.dir/testCCompiler.c.o -o cmTC_7cd0f  -latomic -lm && :
ld: error: unknown argument '--no-dead-strip-dylibs'
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:1 (project)

Steps to reproduce

  1. Create a new project with latest RN version
  2. install reanimated
  3. run build in android
  4. observe compilation issue

Snack or a link to a repository

https://github.com/software-mansion/react-native-reanimated/

Reanimated version

3.4.2

React Native version

0.72.4

Platforms

Android

JavaScript runtime

None

Workflow

None

Architecture

Paper (Old Architecture)

Build type

None

Device

None

Device model

No response

Acknowledgements

Yes

sebasg0 avatar Aug 23 '23 16:08 sebasg0

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

github-actions[bot] avatar Aug 23 '23 16:08 github-actions[bot]

I'm on an m1 chip with macos Ventura 13.5.1 (22G90)

sebasg0 avatar Aug 23 '23 18:08 sebasg0

Any update on this, I am also facing this issue

manoj-createBytes avatar Aug 24 '23 12:08 manoj-createBytes

THe same on me, only work when use sudo

nth-zik avatar Aug 25 '23 11:08 nth-zik

Hey 👋 First thing: Could you provide a reproduction of your issue? Second thing: Do you have installed Rosetta on your computer?

piaskowyk avatar Aug 28 '23 08:08 piaskowyk

First thing: Fail when I init new project too, just use react native init with template typescript Second thing: yes. The library will work fine if I run

sudo yarn android

Work well for iOS

nth-zik avatar Aug 28 '23 08:08 nth-zik

I'm still facing the same issue with rn 0.72.4

a-tokyo avatar Aug 29 '23 09:08 a-tokyo

I'm am also facing the same issue with rn 0.72.4

On windows 11 core i7 8th gen

anopaishemeki avatar Aug 30 '23 11:08 anopaishemeki

I solved this issue by installing ninja-build using sudo apt-get ninja-build

We use CircleCI and RN 0.72.4

I am not sure if this solution will work for everyone, but it's worth a try. It will solve the issue if: ninja is missing or outdadted

a-tokyo avatar Aug 30 '23 11:08 a-tokyo

`ninja: build stopped: subcommand failed.

C++ build system [build] failed while executing: /Users/hung/Library/Android/sdk/cmake/3.22.1/bin/ninja
-C
/Users/hung/Code/pm-apartment/pma/node_modules/react-native-reanimated/android/.cxx/Debug/5y2j84a3/arm64-v8a
reanimated from /Users/hung/Code/pm-apartment/pma/node_modules/react-native-reanimated/android`

This is my stack trace.

Note: run success when use sudo

nth-zik avatar Aug 31 '23 08:08 nth-zik

I'm having the same [CXX1429] issue in windows. And I notice that it happends due to the Android Gradle plugin version in my project. Reanimated version 3.4.2

React Native version 0.68.2

android/build.gradle

buildscript {
    ext {
        buildToolsVersion = "33.0.0"
        minSdkVersion = 21
        compileSdkVersion = 33
        targetSdkVersion = 33
        ndkVersion = '23.1.7779620'
        kotlinVersion = '1.6.21'
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.4.0'
        classpath 'com.google.gms:google-services:4.3.14'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
    }
}

If I change to com.android.tools.build:gradle:7.0.4 it works fine but I need the update to 7.4.0 so that my application targets Android 13, requirement by google play store. Any solution ?

PS: I even try with the lastest version, at the moment, of react-native-reanimated 3.5.4 and it does not build, get the same [CXX1429] error

Andres0101 avatar Sep 27 '23 12:09 Andres0101

I am facing the same issue any help will be appreciated

dilawer-dev avatar Oct 02 '23 17:10 dilawer-dev

I am facing the same issue too, and I need deploy our .aab file with fastlane.

Did anyone get any fixes?

Sergiohcp avatar Oct 03 '23 15:10 Sergiohcp

On android studio you need to install CMake

buuhvprojects avatar Oct 03 '23 21:10 buuhvprojects

On android studio you need to install CMake

So, currently I am using bitrise with fastlane to deploy .aab direct to google play console.

The problem occurs in build phase (gradle) of fastlane.

Sergiohcp avatar Oct 03 '23 23:10 Sergiohcp

fix this problem you have to set a Kotlin version on your project-level build grade android/build.gradle for example:

buildscript {
    ext {
        // ...
        kotlin_version = '1.6.10' // <- add this line
    }

    dependencies {
        // ...
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // <- add this line
        // ...
    }
}

sidm033 avatar Oct 18 '23 09:10 sidm033

I solve this issue by add SUDO to command sudo yarn run android On MacOS 14

nth-zik avatar Oct 19 '23 05:10 nth-zik

I ama facing the same issue on 0.72.6 with react native reanimated version 3.5.4? This is the error message from android studio: from /Users/apple/Desktop/projectpath/node_modules/react-native-reanimated/android CMake Error at CMakeLists.txt:48 (find_package): Could not find a package configuration file provided by "fbjni" with any of the following names:

fbjniConfig.cmake
fbjni-config.cmake

Add the installation prefix of "fbjni" to CMAKE_PREFIX_PATH or set "fbjni_DIR" to a directory containing one of the above files. If "fbjni" provides a separate development package or SDK, be sure it has been installed.

usmanabid94 avatar Oct 27 '23 05:10 usmanabid94

i fixed it by follow this guide but after a while, when i opened the project and build again, i faced it again and now have no clue to fix it. https://github.com/KhronosGroup/OpenXR-SDK-Source/blob/main/BUILDING.md

BichThien avatar Nov 01 '23 02:11 BichThien

@BichThien i am facing this issue as i have updated my react native project form 0.66 to 0.72.6 version the issue mentioned appears on the react native version when buidling the app for android app only the IOS app compiles fine this issue only appears in android studio when the project is being synced or being build. node_modules/react-native-reanimated/android CMake Error at CMakeLists.txt:48 (find_package): Could not find a package configuration file provided by "fbjni" with any of the following names:

fbjniConfig.cmake fbjni-config.cmake Add the installation prefix of "fbjni" to CMAKE_PREFIX_PATH or set "fbjni_DIR" to a directory containing one of the above files. If "fbjni" provides a separate development package or SDK, be sure it has been installed.

usmanabid94 avatar Nov 01 '23 05:11 usmanabid94

Any update I've been trying to solve the issue for the last 2 days but no luck so far... React-native v0.72.6 with react-native-reanimated v3.5.4 and CMake 3.22.1 installed

This is the actual error message: `FAILURE: Build failed with an exception.

What went wrong: Execution failed for task ':react-native-reanimated:configureCMakeDebug[arm64-v8a]'. [CXX1429] error when building with cmake using D:\Coding\React-Native-Projects\MyProject\node_modules\react-native-reanimated\android\CMakeLists.txt: C++ build system [configure] failed while executing: @echo off "C:\Users\user\AppData\Local\Android\Sdk\cmake\3.22.1\bin\cmake.exe" ^ "-HD:\Coding\React-Native-Projects\MyProject\node_modules\react-native-reanimated\android" ^ "-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" ^`

Digital-Human-BK avatar Nov 16 '23 10:11 Digital-Human-BK

@Digital-Human-BK, I figure out that Cmake ver 3.22.1 is error, the simple solution to fix it is make the version down, 3.10.3 fine to work.

BichThien avatar Nov 16 '23 10:11 BichThien

I finally managed to get it working. It turned out to be the JDK version in my case. I was with version 11.0.18 (RN Docs recommend JDK11 for development).

A simple update to JDK version 11.0.20 solved all the problems.

Digital-Human-BK avatar Nov 16 '23 16:11 Digital-Human-BK

@BichThien i am facing this issue as i have updated my react native project form 0.66 to 0.72.6 version the issue mentioned appears on the react native version when buidling the app for android app only the IOS app compiles fine this issue only appears in android studio when the project is being synced or being build. node_modules/react-native-reanimated/android CMake Error at CMakeLists.txt:48 (find_package): Could not find a package configuration file provided by "fbjni" with any of the following names:

fbjniConfig.cmake fbjni-config.cmake Add the installation prefix of "fbjni" to CMAKE_PREFIX_PATH or set "fbjni_DIR" to a directory containing one of the above files. If "fbjni" provides a separate development package or SDK, be sure it has been installed.

@Digital-Human-BK @BichThien I was facing this isssue but i have deleted the android folder and created it again and then the dependencies were installed correctly i guess it has something to do wiht the latest version of react native with the android project of react native by using the command mentioned and turns out that the things are working fine till now: npx react-native eject

usmanabid94 avatar Nov 24 '23 05:11 usmanabid94

if you have tried all the possible solutions ad still facing CXX[1429] or CXX[1405] for cMake

Make Sure to following C++ extensions in visual studio code C/C++ C/C++ Theme C/C++ Extensions Pack CMake CMake Tools Gradle for Java

Main Thing, install "Visual C++ Redistributable for Visual Studio 2015" from the following link: https://www.microsoft.com/en-us/download/confirmation.aspx?id=48145&6B49FDFB-8E5B-4B07-BC31-15695C5A2143=1

Restart your vs code or your System

Shahzaib114 avatar Dec 03 '23 18:12 Shahzaib114

It's funny and absurd, but the issue is due to the project path being too long. I recommend copying or moving your project to c:\ or desktop. Delete the node_modules folder, run npm i, cd android & ./gradlew clean, and then build.

GaboRocker1992 avatar Dec 12 '23 20:12 GaboRocker1992

if you have tried all the possible solutions ad still facing CXX[1429] or CXX[1405] for cMake, it's because you do not have C++ configurations in project. For that follow below instructions

Make Sure to following C++ extensions in visual studio code C/C++ C/C++ Theme C/C++ Extensions Pack CMake CMake Tools Gradle for Java

Main Thing, install "Visual C++ Redistributable for Visual Studio 2015" from the following link: https://www.microsoft.com/en-us/download/confirmation.aspx?id=48145&6B49FDFB-8E5B-4B07-BC31-15695C5A2143=1

Restart your vs code or your System

This thing resolve my issue in windows pc

Thanks @Shahzaib114

RONAKDHOLARIYA avatar Dec 14 '23 10:12 RONAKDHOLARIYA

if you have tried all the possible solutions ad still facing CXX[1429] or CXX[1405] for cMake

Make Sure to following C++ extensions in visual studio code C/C++ C/C++ Theme C/C++ Extensions Pack CMake CMake Tools Gradle for Java

Main Thing, install "Visual C++ Redistributable for Visual Studio 2015" from the following link: https://www.microsoft.com/en-us/download/confirmation.aspx?id=48145&6B49FDFB-8E5B-4B07-BC31-15695C5A2143=1

Restart your vs code or your System

Just downloaded this, and it worked like magic. Thanks

david10191 avatar Dec 16 '23 10:12 david10191

if you have tried all the possible solutions ad still facing CXX[1429] or CXX[1405] for cMake

Make Sure to following C++ extensions in visual studio code C/C++ C/C++ Theme C/C++ Extensions Pack CMake CMake Tools Gradle for Java

Main Thing, install "Visual C++ Redistributable for Visual Studio 2015" from the following link: https://www.microsoft.com/en-us/download/confirmation.aspx?id=48145&6B49FDFB-8E5B-4B07-BC31-15695C5A2143=1

Restart your vs code or your System

Thank you for being my savior

MasterAlex233 avatar Dec 21 '23 04:12 MasterAlex233

if you have tried all the possible solutions ad still facing CXX[1429] or CXX[1405] for cMake

Make Sure to following C++ extensions in visual studio code C/C++ C/C++ Theme C/C++ Extensions Pack CMake CMake Tools Gradle for Java

Main Thing, install "Visual C++ Redistributable for Visual Studio 2015" from the following link: https://www.microsoft.com/en-us/download/confirmation.aspx?id=48145&6B49FDFB-8E5B-4B07-BC31-15695C5A2143=1

Restart your vs code or your System

installing "Visual C++ Redistributable for Visual Studio 2015" seems to be the main issue for my Windows 11 system.

amitjha329 avatar Jan 08 '24 09:01 amitjha329