Repository navigation
Android Fabric component fails to build in CMake step #876
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Description
I'm using interfaceOnly: true so I can provide custom shadow node and measurements managers. When I do this, yarn android fails due to some CMakeLists issues deep inside react-native. I've copied much of my set up from Callstack's slider component.
Steps to reproduce:
- Download the minimal reproducible example
- Run
yarn - Run
yarn example android
I've tried to document everything through the commit history.
Full error log:
Execution failed for task ':app:configureCMakeDebug[arm64-v8a]'.
> [CXX1429] error when building with cmake using /Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/cmake-utils/default-app-setup/CMakeLists.txt: -- The C compiler identification is Clang 18.0.2
-- The CXX compiler identification is Clang 18.0.2
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Users/andrew/Library/Android/sdk/ndk/27.1.12297006/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/andrew/Library/Android/sdk/ndk/27.1.12297006/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/andrew/Practice/test/example/android/app/.cxx/Debug/31694e5q/arm64-v8a/CMakeFiles/CMakeOutput.log".
See also "/Users/andrew/Practice/test/example/android/app/.cxx/Debug/31694e5q/arm64-v8a/CMakeFiles/CMakeError.log".
C++ build system [configure] failed while executing:
/Users/andrew/Library/Android/sdk/cmake/3.22.1/bin/cmake \
-H/Users/andrew/Practice/test/example/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/andrew/Library/Android/sdk/ndk/27.1.12297006 \
-DCMAKE_ANDROID_NDK=/Users/andrew/Library/Android/sdk/ndk/27.1.12297006 \
-DCMAKE_TOOLCHAIN_FILE=/Users/andrew/Library/Android/sdk/ndk/27.1.12297006/build/cmake/android.toolchain.cmake \
-DCMAKE_MAKE_PROGRAM=/Users/andrew/Library/Android/sdk/cmake/3.22.1/bin/ninja \
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/andrew/Practice/test/example/android/app/build/intermediates/cxx/Debug/31694e5q/obj/arm64-v8a \
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/Users/andrew/Practice/test/example/android/app/build/intermediates/cxx/Debug/31694e5q/obj/arm64-v8a \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_FIND_ROOT_PATH=/Users/andrew/Practice/test/example/android/app/.cxx/Debug/31694e5q/prefab/arm64-v8a/prefab \
-B/Users/andrew/Practice/test/example/android/app/.cxx/Debug/31694e5q/arm64-v8a \
-GNinja \
-DPROJECT_BUILD_DIR=/Users/andrew/Practice/test/example/android/app/build \
-DPROJECT_ROOT_DIR=/Users/andrew/Practice/test/example/android \
-DREACT_ANDROID_DIR=/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid \
-DANDROID_STL=c++_shared \
-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON
from /Users/andrew/Practice/test/example/android/app
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:40 (add_subdirectory):
add_subdirectory given source "/third-party-ndk/glog" which is not an
existing directory.
Call Stack (most recent call first):
/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:44 (add_react_build_subdir)
/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:57 (add_react_third_party_ndk_subdir)
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:40 (add_subdirectory):
add_subdirectory given source "/third-party-ndk/boost" which is not an
existing directory.
Call Stack (most recent call first):
/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:44 (add_react_build_subdir)
/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:58 (add_react_third_party_ndk_subdir)
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:40 (add_subdirectory):
add_subdirectory given source "/third-party-ndk/double-conversion" which is
not an existing directory.
Call Stack (most recent call first):
/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:44 (add_react_build_subdir)
/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:59 (add_react_third_party_ndk_subdir)
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:40 (add_subdirectory):
add_subdirectory given source "/third-party-ndk/fast_float" which is not an
existing directory.
Call Stack (most recent call first):
/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:44 (add_react_build_subdir)
/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:60 (add_react_third_party_ndk_subdir)
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:40 (add_subdirectory):
add_subdirectory given source "/third-party-ndk/fmt" which is not an
existing directory.
Call Stack (most recent call first):
/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:44 (add_react_build_subdir)
/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:61 (add_react_third_party_ndk_subdir)
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:40 (add_subdirectory):
add_subdirectory given source "/third-party-ndk/folly" which is not an
existing directory.
Call Stack (most recent call first):
/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:44 (add_react_build_subdir)
/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:62 (add_react_third_party_ndk_subdir)
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactCommon/jsi/CMakeLists.txt:17 (add_library):
add_library cannot create target "jsi" because an alias with the same name
already exists.
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactCommon/jsi/CMakeLists.txt:19 (target_include_directories):
target_include_directories can not be used on an ALIAS target.
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactCommon/jsi/CMakeLists.txt:21 (target_link_libraries):
target_link_libraries can not be used on an ALIAS target.
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactCommon/cmake-utils/react-native-flags.cmake:30 (target_compile_options):
target_compile_options can not be used on an ALIAS target.
Call Stack (most recent call first):
/Users/andrew/Practice/test/example/node_modules/react-native/ReactCommon/jsi/CMakeLists.txt:25 (target_compile_reactnative_options)
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactCommon/jsi/CMakeLists.txt:26 (target_compile_options):
target_compile_options can not be used on an ALIAS target.
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:40 (add_subdirectory):
add_subdirectory given source "/generated/source/codegen/jni" which is not
an existing directory.
Call Stack (most recent call first):
/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:134 (add_react_build_subdir)
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:162 (add_library):
add_library cannot create target "reactnative" because an alias with the
same name already exists.
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/first-party/jni-lib-merge/SoMerging-utils.cmake:21 (target_compile_options):
target_compile_options can not be used on an ALIAS target.
Call Stack (most recent call first):
/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:238 (target_merge_so)
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:240 (target_link_libraries):
target_link_libraries can not be used on an ALIAS target.
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactCommon/cmake-utils/react-native-flags.cmake:30 (target_compile_options):
target_compile_options can not be used on an ALIAS target.
Call Stack (most recent call first):
/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:252 (target_compile_reactnative_options)
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:254 (target_include_directories):
target_include_directories can not be used on an ALIAS target.
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:97 (target_link_libraries):
Cannot specify link libraries for target "react_codegen_Test" which is not
built by this project.
Call Stack (most recent call first):
CMakeLists.txt:31 (include) : com.android.ide.common.process.ProcessException: -- The C compiler identification is Clang 18.0.2
-- The CXX compiler identification is Clang 18.0.2
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Users/andrew/Library/Android/sdk/ndk/27.1.12297006/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/andrew/Library/Android/sdk/ndk/27.1.12297006/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/andrew/Practice/test/example/android/app/.cxx/Debug/31694e5q/arm64-v8a/CMakeFiles/CMakeOutput.log".
See also "/Users/andrew/Practice/test/example/android/app/.cxx/Debug/31694e5q/arm64-v8a/CMakeFiles/CMakeError.log".
C++ build system [configure] failed while executing:
/Users/andrew/Library/Android/sdk/cmake/3.22.1/bin/cmake \
-H/Users/andrew/Practice/test/example/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/andrew/Library/Android/sdk/ndk/27.1.12297006 \
-DCMAKE_ANDROID_NDK=/Users/andrew/Library/Android/sdk/ndk/27.1.12297006 \
-DCMAKE_TOOLCHAIN_FILE=/Users/andrew/Library/Android/sdk/ndk/27.1.12297006/build/cmake/android.toolchain.cmake \
-DCMAKE_MAKE_PROGRAM=/Users/andrew/Library/Android/sdk/cmake/3.22.1/bin/ninja \
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/andrew/Practice/test/example/android/app/build/intermediates/cxx/Debug/31694e5q/obj/arm64-v8a \
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/Users/andrew/Practice/test/example/android/app/build/intermediates/cxx/Debug/31694e5q/obj/arm64-v8a \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_FIND_ROOT_PATH=/Users/andrew/Practice/test/example/android/app/.cxx/Debug/31694e5q/prefab/arm64-v8a/prefab \
-B/Users/andrew/Practice/test/example/android/app/.cxx/Debug/31694e5q/arm64-v8a \
-GNinja \
-DPROJECT_BUILD_DIR=/Users/andrew/Practice/test/example/android/app/build \
-DPROJECT_ROOT_DIR=/Users/andrew/Practice/test/example/android \
-DREACT_ANDROID_DIR=/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid \
-DANDROID_STL=c++_shared \
-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON
from /Users/andrew/Practice/test/example/android/app
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:40 (add_subdirectory):
add_subdirectory given source "/third-party-ndk/glog" which is not an
existing directory.
Call Stack (most recent call first):
/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:44 (add_react_build_subdir)
/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:57 (add_react_third_party_ndk_subdir)
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:40 (add_subdirectory):
add_subdirectory given source "/third-party-ndk/boost" which is not an
existing directory.
Call Stack (most recent call first):
/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:44 (add_react_build_subdir)
/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:58 (add_react_third_party_ndk_subdir)
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:40 (add_subdirectory):
add_subdirectory given source "/third-party-ndk/double-conversion" which is
not an existing directory.
Call Stack (most recent call first):
/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:44 (add_react_build_subdir)
/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:59 (add_react_third_party_ndk_subdir)
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:40 (add_subdirectory):
add_subdirectory given source "/third-party-ndk/fast_float" which is not an
existing directory.
Call Stack (most recent call first):
/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:44 (add_react_build_subdir)
/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:60 (add_react_third_party_ndk_subdir)
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:40 (add_subdirectory):
add_subdirectory given source "/third-party-ndk/fmt" which is not an
existing directory.
Call Stack (most recent call first):
/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:44 (add_react_build_subdir)
/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:61 (add_react_third_party_ndk_subdir)
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:40 (add_subdirectory):
add_subdirectory given source "/third-party-ndk/folly" which is not an
existing directory.
Call Stack (most recent call first):
/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:44 (add_react_build_subdir)
/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:62 (add_react_third_party_ndk_subdir)
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactCommon/jsi/CMakeLists.txt:17 (add_library):
add_library cannot create target "jsi" because an alias with the same name
already exists.
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactCommon/jsi/CMakeLists.txt:19 (target_include_directories):
target_include_directories can not be used on an ALIAS target.
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactCommon/jsi/CMakeLists.txt:21 (target_link_libraries):
target_link_libraries can not be used on an ALIAS target.
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactCommon/cmake-utils/react-native-flags.cmake:30 (target_compile_options):
target_compile_options can not be used on an ALIAS target.
Call Stack (most recent call first):
/Users/andrew/Practice/test/example/node_modules/react-native/ReactCommon/jsi/CMakeLists.txt:25 (target_compile_reactnative_options)
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactCommon/jsi/CMakeLists.txt:26 (target_compile_options):
target_compile_options can not be used on an ALIAS target.
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:40 (add_subdirectory):
add_subdirectory given source "/generated/source/codegen/jni" which is not
an existing directory.
Call Stack (most recent call first):
/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:134 (add_react_build_subdir)
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:162 (add_library):
add_library cannot create target "reactnative" because an alias with the
same name already exists.
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/first-party/jni-lib-merge/SoMerging-utils.cmake:21 (target_compile_options):
target_compile_options can not be used on an ALIAS target.
Call Stack (most recent call first):
/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:238 (target_merge_so)
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:240 (target_link_libraries):
target_link_libraries can not be used on an ALIAS target.
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactCommon/cmake-utils/react-native-flags.cmake:30 (target_compile_options):
target_compile_options can not be used on an ALIAS target.
Call Stack (most recent call first):
/Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:252 (target_compile_reactnative_options)
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/src/main/jni/CMakeLists.txt:254 (target_include_directories):
target_include_directories can not be used on an ALIAS target.
CMake Error at /Users/andrew/Practice/test/example/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:97 (target_link_libraries):
Cannot specify link libraries for target "react_codegen_Test" which is not
built by this project.
Packages
- create-react-native-library
- react-native-builder-bob
Selected options
Fabric component
Link to repro
https://github.com/sidorchukandrew/test
Environment
System:
OS: macOS 15.5
CPU: (8) arm64 Apple M1 Pro
Memory: 128.48 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 20.19.0
path: ~/.nvm/versions/node/v20.19.0/bin/node
Yarn:
version: 3.6.1
path: /usr/local/bin/yarn
npm:
version: 10.8.2
path: ~/.nvm/versions/node/v20.19.0/bin/npm
Watchman: Not Found
Managers:
CocoaPods:
version: 1.14.3
path: /Users/andrew/.gem/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.5
- iOS 18.5
- macOS 15.5
- tvOS 18.5
- visionOS 2.5
- watchOS 11.5
Android SDK:
Android NDK: 21.4.7075529
IDEs:
Android Studio: 2025.1 AI-251.26094.121.2512.13840223
Xcode:
version: 16.4/16F6
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.15
path: /usr/bin/javac
Ruby:
version: 3.2.2
path: /Users/andrew/.rbenv/shims/ruby
npmPackages:
"@react-native-community/cli":
installed: 18.0.0
wanted: 18.0.0
react:
installed: 19.0.0
wanted: 19.0.0
react-native:
installed: 0.81.0-rc.3
wanted: 0.81.0-rc.3
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: Not found
newArchEnabled: false
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Activity
sidorchukandrew commentedon Aug 7, 2025
Part of the error log says
add_subdirectory given source "/third-party-ndk/boost" which is not an existing directory. This is true because if you look underexample/node_modules/react-native/ReactAndroid/src/main/jni, the directory is actually calledthird-party.[-]Android Fabric component fails to build[/-][+]Android Fabric component fails to build in CMake step[/+]sidorchukandrew commentedon Aug 11, 2025
I'm closing this issue in favor of a discussion around adding support for Fabric components with custom C++ files (like shadow nodes or measurement managers)
tunm1228 commentedon Sep 25, 2025
after upgrade to 0.81.4, build works for me.
tholh0205 commentedon Nov 18, 2025
Add this code to your app/build.gradle to fix this error.