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 build error: Task :expo-modules-core:buildCMakeDebug[arm64-v8a] FAILED #22029

Closed
matthewparavati opened this issue Apr 6, 2023 · 32 comments
Labels
needs review Issue is ready to be reviewed by a maintainer

Comments

@matthewparavati
Copy link

Minimal reproducible example

https://github.com/matthewparavati/expo-android-build-test

Summary

Unable to build android app in linked repo

Current behavior:
The build fails when running npm run android

build error
> Task :expo-modules-core:buildCMakeDebug[arm64-v8a] FAILED
C/C++: ninja: Entering directory `/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/android/.cxx/Debug/m5p3ck62/arm64-v8a'
C/C++: ld: error: undefined symbol: operator delete(void*)
C/C++: ld: error: undefined symbol: operator new(unsigned long)
C/C++: ld: error: undefined symbol: __cxa_begin_catch
C/C++: ld: error: undefined symbol: std::terminate()
C/C++: ld: error: undefined symbol: __cxa_allocate_exception
C/C++: ld: error: undefined symbol: typeinfo for std::length_error
C/C++: ld: error: undefined symbol: std::length_error::~length_error()
C/C++: ld: error: undefined symbol: __cxa_throw
C/C++: ld: error: undefined symbol: __cxa_free_exception
C/C++: ld: error: undefined symbol: std::logic_error::logic_error(char const*)
C/C++: ld: error: undefined symbol: vtable for std::length_error
C/C++: ld: error: undefined symbol: std::__ndk1::__vector_base_common<true>::__throw_length_error() const
C/C++: ld: error: undefined symbol: __gxx_personality_v0
C/C++: ld: error: undefined symbol: std::__ndk1::__shared_weak_count::__release_weak()
C/C++: ld: error: undefined symbol: std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >::compare(unsigned long, unsigned long, char const*, unsigned long) const
C/C++: ld: error: undefined symbol: std::exception::~exception()
C/C++: ld: error: undefined symbol: vtable for __cxxabiv1::__si_class_type_info
C/C++: ld: error: undefined symbol: typeinfo for std::exception
C/C++: ld: error: undefined symbol: std::exception::what() const
C/C++: ld: error: undefined symbol: std::runtime_error::runtime_error(char const*)
C/C++: ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
C/C++: clang++: error: linker command failed with exit code 1 (use -v to see invocation)

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':expo-modules-core:buildCMakeDebug[arm64-v8a]'.
> com.android.ide.common.process.ProcessException: ninja: Entering directory `/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/android/.cxx/Debug/m5p3ck62/arm64-v8a'
  [1/1] Linking CXX shared library ../../../../build/intermediates/cxx/Debug/m5p3ck62/obj/arm64-v8a/libexpo-modules-core.so
  FAILED: ../../../../build/intermediates/cxx/Debug/m5p3ck62/obj/arm64-v8a/libexpo-modules-core.so 
  : && /Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --sysroot=/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -fPIC -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fexceptions -frtti -stdlib=libc++ -DREACT_NATIVE_TARGET_VERSION=71 -g  -fno-limit-debug-info  -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--fatal-warnings -Qunused-arguments -Wl,--no-undefined -shared -Wl,-soname,libexpo-modules-core.so -o ../../../../build/intermediates/cxx/Debug/m5p3ck62/obj/arm64-v8a/libexpo-modules-core.so CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/JSIUtils.cpp.o CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/LazyObject.cpp.o CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/TypedArray.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/Exceptions.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/ExpoModulesHostObject.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/JNIFunctionBody.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/JNIInjector.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/JSIInteropModuleRegistry.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/JSReferencesCache.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaCallback.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaReferencesCache.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptModuleObject.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptObject.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptRuntime.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptTypedArray.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptValue.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/MethodMetadata.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/WeakRuntimeHolder.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/types/AnyType.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/types/ExpectedType.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/types/FrontendConverter.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/types/FrontendConverterProvider.cpp.o  /Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/aarch64-linux-android/21/liblog.so  /Users/matthewparavati/.gradle/caches/transforms-3/839e63e695132860efbc878bf673a792/transformed/jetified-fbjni-0.3.0/prefab/modules/fbjni/libs/android.arm64-v8a/libfbjni.so  /Users/matthewparavati/.gradle/caches/transforms-3/80bcec10edf7b36a7acc4848e4b58fa9/transformed/jetified-react-android-0.71.6-debug/prefab/modules/jsi/libs/android.arm64-v8a/libjsi.so  /Users/matthewparavati/.gradle/caches/transforms-3/80bcec10edf7b36a7acc4848e4b58fa9/transformed/jetified-react-android-0.71.6-debug/prefab/modules/reactnativejni/libs/android.arm64-v8a/libreactnativejni.so  /Users/matthewparavati/.gradle/caches/transforms-3/80bcec10edf7b36a7acc4848e4b58fa9/transformed/jetified-react-android-0.71.6-debug/prefab/modules/folly_runtime/libs/android.arm64-v8a/libfolly_runtime.so  /Users/matthewparavati/.gradle/caches/transforms-3/80bcec10edf7b36a7acc4848e4b58fa9/transformed/jetified-react-android-0.71.6-debug/prefab/modules/react_nativemodule_core/libs/android.arm64-v8a/libreact_nativemodule_core.so  -landroid   -latomic -lm && :
  ld: error: undefined symbol: operator delete(void*)
  >>> referenced by new:334 (/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/new:334)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/JSIUtils.cpp.o:(expo::jsiArrayToPropNameIdsVector(facebook::jsi::Runtime&, facebook::jsi::Array const&))
  >>> referenced by new:334 (/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/new:334)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/JSIUtils.cpp.o:(std::__ndk1::vector<facebook::jsi::PropNameID, std::__ndk1::allocator<facebook::jsi::PropNameID> >::reserve(unsigned long))
  >>> referenced by new:334 (/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/new:334)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/JSIUtils.cpp.o:(void std::__ndk1::vector<facebook::jsi::PropNameID, std::__ndk1::allocator<facebook::jsi::PropNameID> >::__push_back_slow_path<facebook::jsi::PropNameID>(facebook::jsi::PropNameID&&))
  >>> referenced 638 more times
  
  ld: error: undefined symbol: operator new(unsigned long)
  >>> referenced by new:253 (/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/new:253)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/JSIUtils.cpp.o:(std::__ndk1::vector<facebook::jsi::PropNameID, std::__ndk1::allocator<facebook::jsi::PropNameID> >::reserve(unsigned long))
  >>> referenced by new:253 (/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/new:253)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/JSIUtils.cpp.o:(void std::__ndk1::vector<facebook::jsi::PropNameID, std::__ndk1::allocator<facebook::jsi::PropNameID> >::__push_back_slow_path<facebook::jsi::PropNameID>(facebook::jsi::PropNameID&&))
  >>> referenced by new:253 (/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/new:253)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/TypedArray.cpp.o:(std::__ndk1::pair<std::__ndk1::__hash_iterator<std::__ndk1::__hash_node<std::__ndk1::__hash_value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, expo::TypedArrayKind>, void*>*>, bool> std::__ndk1::__hash_table<std::__ndk1::__hash_value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, expo::TypedArrayKind>, std::__ndk1::__unordered_map_hasher<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::__hash_value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, expo::TypedArrayKind>, std::__ndk1::hash<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >, true>, std::__ndk1::__unordered_map_equal<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::__hash_value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, expo::TypedArrayKind>, std::__ndk1::equal_to<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >, true>, std::__ndk1::allocator<std::__ndk1::__hash_value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, expo::TypedArrayKind> > >::__emplace_unique_key_args<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::pair<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const, expo::TypedArrayKind> const&>(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, std::__ndk1::pair<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const, expo::TypedArrayKind> const&))
  >>> referenced 145 more times
  
  ld: error: undefined symbol: __cxa_begin_catch
  >>> referenced by JSIUtils.cpp
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/JSIUtils.cpp.o:(__clang_call_terminate)
  >>> referenced by Registration-inl.h:91 (/Users/matthewparavati/.gradle/caches/transforms-3/839e63e695132860efbc878bf673a792/transformed/jetified-fbjni-0.3.0/prefab/modules/fbjni/include/fbjni/detail/Registration-inl.h:91)
  >>>               CMakeFiles/expo-modules-core.dir/src/main/cpp/JSIInteropModuleRegistry.cpp.o:(facebook::jni::detail::FunctionWrapper<facebook::jni::basic_strong_ref<facebook::jni::detail::JTypeFor<facebook::jni::detail::HybridData, facebook::jni::JObject, void>::_javaobject*, facebook::jni::LocalReferenceAllocator> (*)(facebook::jni::alias_ref<facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<expo::JSIInteropModuleRegistry, facebook::jni::detail::BaseHybridClass>::JavaPart, facebook::jni::JObject, void>::_javaobject*>), facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<expo::JSIInteropModuleRegistry, facebook::jni::detail::BaseHybridClass>::JavaPart, facebook::jni::JObject, void>::_javaobject*, facebook::jni::basic_strong_ref<facebook::jni::detail::JTypeFor<facebook::jni::detail::HybridData, facebook::jni::JObject, void>::_javaobject*, facebook::jni::LocalReferenceAllocator> >::call(_JNIEnv*, _jobject*, facebook::jni::basic_strong_ref<facebook::jni::detail::JTypeFor<facebook::jni::detail::HybridData, facebook::jni::JObject, void>::_javaobject*, facebook::jni::LocalReferenceAllocator> (*)(facebook::jni::alias_ref<facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<expo::JSIInteropModuleRegistry, facebook::jni::detail::BaseHybridClass>::JavaPart, facebook::jni::JObject, void>::_javaobject*>)))
  >>> referenced by Registration-inl.h:91 (/Users/matthewparavati/.gradle/caches/transforms-3/839e63e695132860efbc878bf673a792/transformed/jetified-fbjni-0.3.0/prefab/modules/fbjni/include/fbjni/detail/Registration-inl.h:91)
  >>>               CMakeFiles/expo-modules-core.dir/src/main/cpp/JSIInteropModuleRegistry.cpp.o:(facebook::jni::detail::FunctionWrapper<void (*)(facebook::jni::alias_ref<facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<expo::JSIInteropModuleRegistry, facebook::jni::detail::BaseHybridClass>::JavaPart, facebook::jni::JObject, void>::_javaobject*>, long&&, facebook::jni::alias_ref<facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<facebook::react::CallInvokerHolder, facebook::jni::detail::BaseHybridClass>::JavaPart, facebook::jni::JObject, void>::_javaobject*>&&, facebook::jni::alias_ref<facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<facebook::react::CallInvokerHolder, facebook::jni::detail::BaseHybridClass>::JavaPart, facebook::jni::JObject, void>::_javaobject*>&&), facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<expo::JSIInteropModuleRegistry, facebook::jni::detail::BaseHybridClass>::JavaPart, facebook::jni::JObject, void>::_javaobject*, void, long, facebook::jni::alias_ref<facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<facebook::react::CallInvokerHolder, facebook::jni::detail::BaseHybridClass>::JavaPart, facebook::jni::JObject, void>::_javaobject*>, facebook::jni::alias_ref<facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<facebook::react::CallInvokerHolder, facebook::jni::detail::BaseHybridClass>::JavaPart, facebook::jni::JObject, void>::_javaobject*> >::call(_JNIEnv*, _jobject*, long, facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<facebook::react::CallInvokerHolder, facebook::jni::detail::BaseHybridClass>::JavaPart, facebook::jni::JObject, void>::_javaobject*, facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<facebook::react::CallInvokerHolder, facebook::jni::detail::BaseHybridClass>::JavaPart, facebook::jni::JObject, void>::_javaobject*, void (*)(facebook::jni::alias_ref<facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<expo::JSIInteropModuleRegistry, facebook::jni::detail::BaseHybridClass>::JavaPart, facebook::jni::JObject, void>::_javaobject*>, long&&, facebook::jni::alias_ref<facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<facebook::react::CallInvokerHolder, facebook::jni::detail::BaseHybridClass>::JavaPart, facebook::jni::JObject, void>::_javaobject*>&&, facebook::jni::alias_ref<facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<facebook::react::CallInvokerHolder, facebook::jni::detail::BaseHybridClass>::JavaPart, facebook::jni::JObject, void>::_javaobject*>&&)))
  >>> referenced 120 more times
  
  ld: error: undefined symbol: std::terminate()
  >>> referenced by JSIUtils.cpp
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/JSIUtils.cpp.o:(__clang_call_terminate)
  
  ld: error: undefined symbol: __cxa_allocate_exception
  >>> referenced by stdexcept:258 (/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/stdexcept:258)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/JSIUtils.cpp.o:(std::__ndk1::__throw_length_error(char const*))
  >>> referenced by functional:1435 (/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/functional:1435)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/LazyObject.cpp.o:(std::__ndk1::__throw_bad_function_call())
  >>> referenced by TypedArray.cpp:50 (/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/TypedArray.cpp:50)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/TypedArray.cpp.o:(expo::TypedArray::getBuffer(facebook::jsi::Runtime&) const)
  >>> referenced 34 more times
  
  ld: error: undefined symbol: typeinfo for std::length_error
  >>> referenced by stdexcept:258 (/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/stdexcept:258)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/JSIUtils.cpp.o:(std::__ndk1::__throw_length_error(char const*))
  >>> referenced by stdexcept:258 (/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/stdexcept:258)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/JSIUtils.cpp.o:(std::__ndk1::__throw_length_error(char const*))
  
  ld: error: undefined symbol: std::length_error::~length_error()
  >>> referenced by stdexcept:258 (/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/stdexcept:258)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/JSIUtils.cpp.o:(std::__ndk1::__throw_length_error(char const*))
  >>> referenced by stdexcept:258 (/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/stdexcept:258)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/JSIUtils.cpp.o:(std::__ndk1::__throw_length_error(char const*))
  
  ld: error: undefined symbol: __cxa_throw
  >>> referenced by stdexcept:258 (/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/stdexcept:258)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/JSIUtils.cpp.o:(std::__ndk1::__throw_length_error(char const*))
  >>> referenced by functional:1435 (/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/functional:1435)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/LazyObject.cpp.o:(std::__ndk1::__throw_bad_function_call())
  >>> referenced by TypedArray.cpp:50 (/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/TypedArray.cpp:50)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/TypedArray.cpp.o:(expo::TypedArray::getBuffer(facebook::jsi::Runtime&) const)
  >>> referenced 34 more times
  
  ld: error: undefined symbol: __cxa_free_exception
  >>> referenced by stdexcept:258 (/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/stdexcept:258)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/JSIUtils.cpp.o:(std::__ndk1::__throw_length_error(char const*))
  >>> referenced by TypedArray.cpp:50 (/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/TypedArray.cpp:50)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/TypedArray.cpp.o:(expo::TypedArray::getBuffer(facebook::jsi::Runtime&) const)
  >>> referenced by stdexcept:269 (/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/stdexcept:269)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/TypedArray.cpp.o:(std::__ndk1::__throw_out_of_range(char const*))
  >>> referenced 12 more times
  
  ld: error: undefined symbol: std::logic_error::logic_error(char const*)
  >>> referenced by stdexcept:155 (/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/stdexcept:155)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/JSIUtils.cpp.o:(std::length_error::length_error(char const*))
  >>> referenced by stdexcept:167 (/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/stdexcept:167)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/TypedArray.cpp.o:(std::out_of_range::out_of_range(char const*))
  >>> referenced by stdexcept:142 (/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/stdexcept:142)
  >>>               CMakeFiles/expo-modules-core.dir/src/main/cpp/MethodMetadata.cpp.o:(std::invalid_argument::invalid_argument(char const*))
  
  ld: error: undefined symbol: vtable for std::length_error
  >>> referenced by stdexcept:155 (/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/stdexcept:155)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/JSIUtils.cpp.o:(std::length_error::length_error(char const*))
  >>> referenced by stdexcept:155 (/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/stdexcept:155)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/JSIUtils.cpp.o:(std::length_error::length_error(char const*))
  >>> the vtable symbol may be undefined because the class is missing its key function (see https://lld.llvm.org/missingkeyfunction)
  
  ld: error: undefined symbol: std::__ndk1::__vector_base_common<true>::__throw_length_error() const
  >>> referenced by vector:1027 (/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/vector:1027)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/JSIUtils.cpp.o:(void std::__ndk1::vector<facebook::jsi::PropNameID, std::__ndk1::allocator<facebook::jsi::PropNameID> >::__push_back_slow_path<facebook::jsi::PropNameID>(facebook::jsi::PropNameID&&))
  >>> referenced by vector:993 (/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/vector:993)
  >>>               CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaReferencesCache.cpp.o:(std::__ndk1::vector<std::__ndk1::pair<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >, std::__ndk1::allocator<std::__ndk1::pair<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > > > >::vector(std::initializer_list<std::__ndk1::pair<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > > >))
  >>> referenced by vector:1027 (/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/vector:1027)
  >>>               CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptModuleObject.cpp.o:(void std::__ndk1::vector<std::__ndk1::unique_ptr<expo::AnyType, std::__ndk1::default_delete<expo::AnyType> >, std::__ndk1::allocator<std::__ndk1::unique_ptr<expo::AnyType, std::__ndk1::default_delete<expo::AnyType> > > >::__push_back_slow_path<std::__ndk1::unique_ptr<expo::AnyType, std::__ndk1::default_delete<expo::AnyType> > >(std::__ndk1::unique_ptr<expo::AnyType, std::__ndk1::default_delete<expo::AnyType> >&&))
  >>> referenced 10 more times
  
  ld: error: undefined symbol: __gxx_personality_v0
  >>> referenced by JSIUtils.cpp
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/JSIUtils.cpp.o:(DW.ref.__gxx_personality_v0)
  
  ld: error: undefined symbol: std::__ndk1::__shared_weak_count::__release_weak()
  >>> referenced by memory:3549 (/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/memory:3549)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/LazyObject.cpp.o:(expo::LazyObject::~LazyObject())
  >>> referenced by memory:3549 (/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/memory:3549)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/LazyObject.cpp.o:(expo::LazyObject::~LazyObject())
  >>> referenced by memory:3549 (/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/memory:3549)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/LazyObject.cpp.o:(expo::LazyObject::get(facebook::jsi::Runtime&, facebook::jsi::PropNameID const&))
  >>> referenced 359 more times
  
  ld: error: undefined symbol: std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >::compare(unsigned long, unsigned long, char const*, unsigned long) const
  >>> referenced by string:3996 (/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/string:3996)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/LazyObject.cpp.o:(expo::LazyObject::get(facebook::jsi::Runtime&, facebook::jsi::PropNameID const&))
  
  ld: error: undefined symbol: std::exception::~exception()
  >>> referenced by functional:1435 (/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/functional:1435)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/LazyObject.cpp.o:(std::__ndk1::__throw_bad_function_call())
  >>> referenced by functional:1435 (/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/functional:1435)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/LazyObject.cpp.o:(std::__ndk1::__throw_bad_function_call())
  >>> referenced by functional:1420 (/Users/matthewparavati/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/functional:1420)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/LazyObject.cpp.o:(std::__ndk1::bad_function_call::~bad_function_call())
  >>> referenced 1 more times
  
  ld: error: undefined symbol: vtable for __cxxabiv1::__si_class_type_info
  >>> referenced by LazyObject.cpp
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/LazyObject.cpp.o:(typeinfo for expo::LazyObject)
  >>> referenced by LazyObject.cpp
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/LazyObject.cpp.o:(typeinfo for std::__ndk1::bad_function_call)
  >>> referenced by ExpoModulesHostObject.cpp
  >>>               CMakeFiles/expo-modules-core.dir/src/main/cpp/ExpoModulesHostObject.cpp.o:(typeinfo for expo::ExpoModulesHostObject)
  >>> referenced 68 more times
  >>> the vtable symbol may be undefined because the class is missing its key function (see https://lld.llvm.org/missingkeyfunction)
  
  ld: error: undefined symbol: typeinfo for std::exception
  >>> referenced by LazyObject.cpp
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/LazyObject.cpp.o:(typeinfo for std::__ndk1::bad_function_call)
  >>> referenced by JSIInteropModuleRegistry.cpp
  >>>               CMakeFiles/expo-modules-core.dir/src/main/cpp/JSIInteropModuleRegistry.cpp.o:(.data+0x0)
  >>> referenced by JavaCallback.cpp
  >>>               CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaCallback.cpp.o:(.data+0x0)
  >>> referenced 4 more times
  
  ld: error: undefined symbol: std::exception::what() const
  >>> referenced by LazyObject.cpp
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/LazyObject.cpp.o:(vtable for std::__ndk1::bad_function_call)
  
  ld: error: undefined symbol: std::runtime_error::runtime_error(char const*)
  >>> referenced by TypedArray.cpp:50 (/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/TypedArray.cpp:50)
  >>>               CMakeFiles/expo-modules-core.dir/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/common/cpp/TypedArray.cpp.o:(expo::TypedArray::getBuffer(facebook::jsi::Runtime&) const)
  >>> referenced by Exceptions.cpp:103 (/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/android/src/main/cpp/Exceptions.cpp:103)
  >>>               CMakeFiles/expo-modules-core.dir/src/main/cpp/Exceptions.cpp.o:(expo::throwPendingJniExceptionAsCppException())
  >>> referenced by MethodMetadata.cpp:36 (/Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/android/src/main/cpp/MethodMetadata.cpp:36)
  >>>               CMakeFiles/expo-modules-core.dir/src/main/cpp/MethodMetadata.cpp.o:(expo::createJavaCallbackFromJSIFunction(facebook::jsi::Function&&, std::__ndk1::weak_ptr<facebook::react::LongLivedObjectCollection>, facebook::jsi::Runtime&, expo::JSIInteropModuleRegistry*, bool))
  >>> referenced 1 more times
  
  ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
  clang++: error: linker command failed with exit code 1 (use -v to see invocation)
  ninja: build stopped: subcommand failed.
  
  C++ build system [build] failed while executing:
      /Users/matthewparavati/Library/Android/sdk/cmake/3.22.1/bin/ninja \
        -C \
        /Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/android/.cxx/Debug/m5p3ck62/arm64-v8a \
        expo-modules-core
    from /Users/matthewparavati/Code/android-build-test/node_modules/expo-modules-core/android

* 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.
==============================================================================

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings

Execution optimizations have been disabled for 1 invalid unit(s) of work during this build to ensure correctness.
Please consult deprecation warnings for more details.

BUILD FAILED in 14s
184 actionable tasks: 7 executed, 177 up-to-date
Error: /Users/matthewparavati/Code/android-build-test/android/gradlew exited with non-zero code: 1
Error: /Users/matthewparavati/Code/android-build-test/android/gradlew exited with non-zero code: 1
    at ChildProcess.completionListener (/Users/matthewparavati/Code/android-build-test/node_modules/@expo/spawn-async/build/spawnAsync.js:52:23)
    at Object.onceWrapper (node:events:628:26)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1100:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)
    ...
    at Object.spawnAsync [as default] (/Users/matthewparavati/Code/android-build-test/node_modules/@expo/spawn-async/build/spawnAsync.js:17:21)
    at spawnGradleAsync (/Users/matthewparavati/Code/android-build-test/node_modules/@expo/cli/build/src/start/platforms/android/gradle.js:72:46)
    at Object.assembleAsync (/Users/matthewparavati/Code/android-build-test/node_modules/@expo/cli/build/src/start/platforms/android/gradle.js:52:18)
    at runAndroidAsync (/Users/matthewparavati/Code/android-build-test/node_modules/@expo/cli/build/src/run/android/runAndroidAsync.js:31:24)

Expected behavior:
Build succeeds when running npm run android

In the repo, see comment in android/build.gradle but I've found that if I change the ndkVersion to 24.0.8215888 then the build works. I'm not really sure why and changing that was a complete long shot to try and solve this issue that's been blocking me for a day.

Environment

expo-env-info
    System:
      OS: macOS 13.3
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 16.19.1 - ~/.nvm/versions/node/v16.19.1/bin/node
      Yarn: 1.22.19 - /opt/homebrew/Cellar/yvm/4.1.4/shim/yarn
      npm: 8.19.3 - ~/.nvm/versions/node/v16.19.1/bin/npm
      Watchman: 2022.10.03.00 - /opt/homebrew/bin/watchman
    Managers:
      CocoaPods: 1.12.0 - /Users/matthewparavati/.rvm/gems/ruby-2.7.6/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
      Android SDK:
        API Levels: 28, 29, 30, 31, 32, 33
        Build Tools: 30.0.2, 30.0.3, 31.0.0, 33.0.0, 33.0.1, 34.0.0
        System Images: android-21 | ARM 64 v8a, android-23 | ARM 64 v8a, android-28 | ARM 64 v8a, android-30 | ARM 64 v8a, android-30 | Google APIs ARM 64 v8a, android-31 | ARM 64 v8a, android-31 | Intel x86 Atom_64, android-31 | Google APIs ARM 64 v8a, android-33 | Google APIs ARM 64 v8a
    IDEs:
      Android Studio: 2022.1 AI-221.6008.13.2211.9619390
      Xcode: 14.3/14E222b - /usr/bin/xcodebuild
    npmPackages:
      expo: ~48.0.10 => 48.0.10 
      react: 18.2.0 => 18.2.0 
      react-native: 0.71.6 => 0.71.6 
    Expo Workflow: bare
@matthewparavati matthewparavati added the needs validation Issue needs to be validated label Apr 6, 2023
@expo-bot expo-bot added needs review Issue is ready to be reviewed by a maintainer and removed needs validation Issue needs to be validated labels Apr 6, 2023
@matthewparavati
Copy link
Author

I think I solved my issue but I don't really understand how/why but hopefully it helps others. I was following this answer for reference

In android/app/build.gradle inside of android {}, I added this lines:

externalNativeBuild {
    cmake {
        version "3.22.1"
    }
}

Then I created a local.properties file inside android/ and added this line:

cmake.dir=/[your path]/Library/Android/sdk/cmake/3.22.1

Ran ./gradlew clean and then was able to build again 🤷

Strangely I've found that I can comment out those lines I added above, re-run ./gradlew clean, and the app continues to build fine.

@Kudo
Copy link
Contributor

Kudo commented Apr 11, 2023

hi there! i tried to clone your repro and it just worked for me. that might be some environment issue. as the ./gradlew clean works for you, i'm closing this issue. feel free to let us know if you have any other questions. thanks!

@Kudo Kudo closed this as completed Apr 11, 2023
@philipheinser
Copy link

@Kudo I had the same problem and had to follow the instructions in the comment. Happens for me when try to build on a m1/m2 without rosetta.

@SavinienBarbotaud
Copy link

Hi ! @Kudo I hope you will read this :)
Im still facing this issue. I just do Matthew solution ddnt work and now ./gradlew clean on android directory.

More detailled stacktrace :

 Task :expo-modules-core:buildCMakeDebug[arm64-v8a] FAILED

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':expo-modules-core:buildCMakeDebug[arm64-v8a]'.
> com.android.ide.common.process.ProcessException: ninja: Entering directory `/home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android/.cxx/Debug/382l4f2d/arm64-v8a'
  [1/23] Building CXX object CMakeFiles/expo-modules-core.dir/home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/common/cpp/JSIUtils.cpp.o
  [2/23] Building CXX object CMakeFiles/expo-modules-core.dir/home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/common/cpp/LazyObject.cpp.o
  [3/23] Building CXX object CMakeFiles/expo-modules-core.dir/home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/common/cpp/TypedArray.cpp.o
  [4/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JSReferencesCache.cpp.o
  [5/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JNIInjector.cpp.o
  [6/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JNIFunctionBody.cpp.o
  [7/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaReferencesCache.cpp.o
  [8/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/types/ExpectedType.cpp.o
  [9/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaCallback.cpp.o
  [10/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/ExpoModulesHostObject.cpp.o
  [11/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/Exceptions.cpp.o
  [12/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptModuleObject.cpp.o
  FAILED: CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptModuleObject.cpp.o 
  /home/savinien/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android24 --sysroot=/home/savinien/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot -Dexpo_modules_core_EXPORTS -I/home/savinien/.gradle/caches/transforms-3/6ac6e41ab38ef231e88c9df85ae5bb5f/transformed/jetified-react-android-0.72.3-debug/prefab/modules/reactnativejni/include/react -I/home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/react-native/ReactAndroid/src/main/jni/react/turbomodule -I/home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android/../common/cpp -I/home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android/src/fabric -isystem /home/savinien/.gradle/caches/transforms-3/e34348509d4115f5295bdc4936110f32/transformed/jetified-fbjni-0.3.0/prefab/modules/fbjni/include -isystem /home/savinien/.gradle/caches/transforms-3/6ac6e41ab38ef231e88c9df85ae5bb5f/transformed/jetified-react-android-0.72.3-debug/prefab/modules/jsi/include -isystem /home/savinien/.gradle/caches/transforms-3/6ac6e41ab38ef231e88c9df85ae5bb5f/transformed/jetified-react-android-0.72.3-debug/prefab/modules/reactnativejni/include -isystem /home/savinien/.gradle/caches/transforms-3/6ac6e41ab38ef231e88c9df85ae5bb5f/transformed/jetified-react-android-0.72.3-debug/prefab/modules/folly_runtime/include -isystem /home/savinien/.gradle/caches/transforms-3/6ac6e41ab38ef231e88c9df85ae5bb5f/transformed/jetified-react-android-0.72.3-debug/prefab/modules/react_nativemodule_core/include -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fexceptions -frtti -stdlib=libc++ -DREACT_NATIVE_TARGET_VERSION=72 -g  -fno-limit-debug-info -fPIC -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -DFOLLY_HAVE_RECVMMSG=1 -DFOLLY_HAVE_PTHREAD=1 -DFOLLY_HAVE_XSI_STRERROR_R=1 -O2 -frtti -fexceptions -Wall -fstack-protector-all -DUSE_HERMES=0 -DUNIT_TEST=0 -std=gnu++17 -MD -MT CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptModuleObject.cpp.o -MF CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptModuleObject.cpp.o.d -o CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptModuleObject.cpp.o -c /home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android/src/main/cpp/JavaScriptModuleObject.cpp
  In file included from /home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android/src/main/cpp/JavaScriptModuleObject.cpp:3:
  In file included from /home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android/src/main/cpp/JavaScriptModuleObject.h:5:
  In file included from /home/savinien/.gradle/caches/transforms-3/e34348509d4115f5295bdc4936110f32/transformed/jetified-fbjni-0.3.0/prefab/modules/fbjni/include/fbjni/fbjni.h:21:
  In file included from /home/savinien/.gradle/caches/transforms-3/e34348509d4115f5295bdc4936110f32/transformed/jetified-fbjni-0.3.0/prefab/modules/fbjni/include/fbjni/detail/Environment.h:18:
  In file included from /home/savinien/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/functional:504:
  /home/savinien/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:4434:5: error: static_assert failed due to requirement 'is_constructible<facebook::react::LongLivedObjectCollection>::value' "Can't construct object in make_shared"
      static_assert(is_constructible<_Tp, _Args...>::value, "Can't construct object in make_shared");
      ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android/src/main/cpp/JavaScriptModuleObject.cpp:238:37: note: in instantiation of function template specialization 'std::make_shared<facebook::react::LongLivedObjectCollection>' requested here
    longLivedObjectCollection_ = std::make_shared<react::LongLivedObjectCollection>();
                                      ^
  In file included from /home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android/src/main/cpp/JavaScriptModuleObject.cpp:3:
  In file included from /home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android/src/main/cpp/JavaScriptModuleObject.h:5:
  In file included from /home/savinien/.gradle/caches/transforms-3/e34348509d4115f5295bdc4936110f32/transformed/jetified-fbjni-0.3.0/prefab/modules/fbjni/include/fbjni/fbjni.h:21:
  In file included from /home/savinien/.gradle/caches/transforms-3/e34348509d4115f5295bdc4936110f32/transformed/jetified-fbjni-0.3.0/prefab/modules/fbjni/include/fbjni/detail/Environment.h:18:
  In file included from /home/savinien/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/functional:504:
  /home/savinien/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:2260:46: error: field of type 'facebook::react::LongLivedObjectCollection' has private default constructor
    __compressed_pair_elem(__value_init_tag) : __value_() {}
                                               ^
  /home/savinien/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:2353:42: note: in instantiation of member function 'std::__compressed_pair_elem<facebook::react::LongLivedObjectCollection, 1, false>::__compressed_pair_elem' requested here
        : _Base1(std::forward<_U1>(__t1)), _Base2(std::forward<_U2>(__t2)) {}
                                           ^
  /home/savinien/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:3628:12: note: in instantiation of function template specialization 'std::__compressed_pair<std::allocator<facebook::react::LongLivedObjectCollection>, facebook::react::LongLivedObjectCollection>::__compressed_pair<std::allocator<facebook::react::LongLivedObjectCollection>, std::__value_init_tag>' requested here
          :  __data_(_VSTD::move(__a), __value_init_tag()) {}
             ^
  /home/savinien/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:4441:26: note: in instantiation of member function 'std::__shared_ptr_emplace<facebook::react::LongLivedObjectCollection, std::allocator<facebook::react::LongLivedObjectCollection>>::__shared_ptr_emplace' requested here
      ::new(__hold2.get()) _CntrlBlk(__a2, _VSTD::forward<_Args>(__args)...);
                           ^
  /home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android/src/main/cpp/JavaScriptModuleObject.cpp:238:37: note: in instantiation of function template specialization 'std::make_shared<facebook::react::LongLivedObjectCollection>' requested here
    longLivedObjectCollection_ = std::make_shared<react::LongLivedObjectCollection>();
                                      ^
  /home/savinien/.gradle/caches/transforms-3/6ac6e41ab38ef231e88c9df85ae5bb5f/transformed/jetified-react-android-0.72.3-debug/prefab/modules/react_nativemodule_core/include/react/bridging/LongLivedObject.h:52:3: note: declared private here
    LongLivedObjectCollection() = default;
    ^
  2 errors generated.
  [13/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/WeakRuntimeHolder.cpp.o
  [14/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptObject.cpp.o
  [15/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JSIInteropModuleRegistry.cpp.o
  [16/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptTypedArray.cpp.o
  [17/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptRuntime.cpp.o
  [18/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptValue.cpp.o
  [19/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/types/AnyType.cpp.o
  [20/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/MethodMetadata.cpp.o
  FAILED: CMakeFiles/expo-modules-core.dir/src/main/cpp/MethodMetadata.cpp.o 
  /home/savinien/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android24 --sysroot=/home/savinien/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot -Dexpo_modules_core_EXPORTS -I/home/savinien/.gradle/caches/transforms-3/6ac6e41ab38ef231e88c9df85ae5bb5f/transformed/jetified-react-android-0.72.3-debug/prefab/modules/reactnativejni/include/react -I/home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/react-native/ReactAndroid/src/main/jni/react/turbomodule -I/home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android/../common/cpp -I/home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android/src/fabric -isystem /home/savinien/.gradle/caches/transforms-3/e34348509d4115f5295bdc4936110f32/transformed/jetified-fbjni-0.3.0/prefab/modules/fbjni/include -isystem /home/savinien/.gradle/caches/transforms-3/6ac6e41ab38ef231e88c9df85ae5bb5f/transformed/jetified-react-android-0.72.3-debug/prefab/modules/jsi/include -isystem /home/savinien/.gradle/caches/transforms-3/6ac6e41ab38ef231e88c9df85ae5bb5f/transformed/jetified-react-android-0.72.3-debug/prefab/modules/reactnativejni/include -isystem /home/savinien/.gradle/caches/transforms-3/6ac6e41ab38ef231e88c9df85ae5bb5f/transformed/jetified-react-android-0.72.3-debug/prefab/modules/folly_runtime/include -isystem /home/savinien/.gradle/caches/transforms-3/6ac6e41ab38ef231e88c9df85ae5bb5f/transformed/jetified-react-android-0.72.3-debug/prefab/modules/react_nativemodule_core/include -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fexceptions -frtti -stdlib=libc++ -DREACT_NATIVE_TARGET_VERSION=72 -g  -fno-limit-debug-info -fPIC -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -DFOLLY_HAVE_RECVMMSG=1 -DFOLLY_HAVE_PTHREAD=1 -DFOLLY_HAVE_XSI_STRERROR_R=1 -O2 -frtti -fexceptions -Wall -fstack-protector-all -DUSE_HERMES=0 -DUNIT_TEST=0 -std=gnu++17 -MD -MT CMakeFiles/expo-modules-core.dir/src/main/cpp/MethodMetadata.cpp.o -MF CMakeFiles/expo-modules-core.dir/src/main/cpp/MethodMetadata.cpp.o.d -o CMakeFiles/expo-modules-core.dir/src/main/cpp/MethodMetadata.cpp.o -c /home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android/src/main/cpp/MethodMetadata.cpp
  /home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android/src/main/cpp/MethodMetadata.cpp:40:57: error: too many arguments to function call, expected 3, have 4
                                                          std::move(jsInvoker));
                                                          ^~~~~~~~~~~~~~~~~~~~
  /home/savinien/.gradle/caches/transforms-3/6ac6e41ab38ef231e88c9df85ae5bb5f/transformed/jetified-react-android-0.72.3-debug/prefab/modules/react_nativemodule_core/include/react/bridging/CallbackWrapper.h:34:41: note: 'createWeak' declared here
    static std::weak_ptr<CallbackWrapper> createWeak(
                                          ^
  1 error generated.
  [21/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/types/FrontendConverter.cpp.o
  ninja: build stopped: subcommand failed.
  
  C++ build system [build] failed while executing:
      /usr/bin/ninja \
        -C \
        /home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android/.cxx/Debug/382l4f2d/arm64-v8a \
        expo-modules-core
    from /home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android

I also find https://stackoverflow.com/questions/74420630/execution-failed-for-task-expo-modules-corebuildcmakedebugarm64-v8a this issue.
Trying to delete node_modules/ repo and package.lock othing changed.
Thanks for your help.

@neibips
Copy link

neibips commented Sep 4, 2023

Hi ! @Kudo I hope you will read this :) Im still facing this issue. I just do Matthew solution ddnt work and now ./gradlew clean on android directory.

More detailled stacktrace :

 Task :expo-modules-core:buildCMakeDebug[arm64-v8a] FAILED

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':expo-modules-core:buildCMakeDebug[arm64-v8a]'.
> com.android.ide.common.process.ProcessException: ninja: Entering directory `/home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android/.cxx/Debug/382l4f2d/arm64-v8a'
  [1/23] Building CXX object CMakeFiles/expo-modules-core.dir/home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/common/cpp/JSIUtils.cpp.o
  [2/23] Building CXX object CMakeFiles/expo-modules-core.dir/home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/common/cpp/LazyObject.cpp.o
  [3/23] Building CXX object CMakeFiles/expo-modules-core.dir/home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/common/cpp/TypedArray.cpp.o
  [4/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JSReferencesCache.cpp.o
  [5/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JNIInjector.cpp.o
  [6/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JNIFunctionBody.cpp.o
  [7/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaReferencesCache.cpp.o
  [8/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/types/ExpectedType.cpp.o
  [9/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaCallback.cpp.o
  [10/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/ExpoModulesHostObject.cpp.o
  [11/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/Exceptions.cpp.o
  [12/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptModuleObject.cpp.o
  FAILED: CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptModuleObject.cpp.o 
  /home/savinien/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android24 --sysroot=/home/savinien/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot -Dexpo_modules_core_EXPORTS -I/home/savinien/.gradle/caches/transforms-3/6ac6e41ab38ef231e88c9df85ae5bb5f/transformed/jetified-react-android-0.72.3-debug/prefab/modules/reactnativejni/include/react -I/home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/react-native/ReactAndroid/src/main/jni/react/turbomodule -I/home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android/../common/cpp -I/home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android/src/fabric -isystem /home/savinien/.gradle/caches/transforms-3/e34348509d4115f5295bdc4936110f32/transformed/jetified-fbjni-0.3.0/prefab/modules/fbjni/include -isystem /home/savinien/.gradle/caches/transforms-3/6ac6e41ab38ef231e88c9df85ae5bb5f/transformed/jetified-react-android-0.72.3-debug/prefab/modules/jsi/include -isystem /home/savinien/.gradle/caches/transforms-3/6ac6e41ab38ef231e88c9df85ae5bb5f/transformed/jetified-react-android-0.72.3-debug/prefab/modules/reactnativejni/include -isystem /home/savinien/.gradle/caches/transforms-3/6ac6e41ab38ef231e88c9df85ae5bb5f/transformed/jetified-react-android-0.72.3-debug/prefab/modules/folly_runtime/include -isystem /home/savinien/.gradle/caches/transforms-3/6ac6e41ab38ef231e88c9df85ae5bb5f/transformed/jetified-react-android-0.72.3-debug/prefab/modules/react_nativemodule_core/include -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fexceptions -frtti -stdlib=libc++ -DREACT_NATIVE_TARGET_VERSION=72 -g  -fno-limit-debug-info -fPIC -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -DFOLLY_HAVE_RECVMMSG=1 -DFOLLY_HAVE_PTHREAD=1 -DFOLLY_HAVE_XSI_STRERROR_R=1 -O2 -frtti -fexceptions -Wall -fstack-protector-all -DUSE_HERMES=0 -DUNIT_TEST=0 -std=gnu++17 -MD -MT CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptModuleObject.cpp.o -MF CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptModuleObject.cpp.o.d -o CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptModuleObject.cpp.o -c /home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android/src/main/cpp/JavaScriptModuleObject.cpp
  In file included from /home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android/src/main/cpp/JavaScriptModuleObject.cpp:3:
  In file included from /home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android/src/main/cpp/JavaScriptModuleObject.h:5:
  In file included from /home/savinien/.gradle/caches/transforms-3/e34348509d4115f5295bdc4936110f32/transformed/jetified-fbjni-0.3.0/prefab/modules/fbjni/include/fbjni/fbjni.h:21:
  In file included from /home/savinien/.gradle/caches/transforms-3/e34348509d4115f5295bdc4936110f32/transformed/jetified-fbjni-0.3.0/prefab/modules/fbjni/include/fbjni/detail/Environment.h:18:
  In file included from /home/savinien/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/functional:504:
  /home/savinien/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:4434:5: error: static_assert failed due to requirement 'is_constructible<facebook::react::LongLivedObjectCollection>::value' "Can't construct object in make_shared"
      static_assert(is_constructible<_Tp, _Args...>::value, "Can't construct object in make_shared");
      ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android/src/main/cpp/JavaScriptModuleObject.cpp:238:37: note: in instantiation of function template specialization 'std::make_shared<facebook::react::LongLivedObjectCollection>' requested here
    longLivedObjectCollection_ = std::make_shared<react::LongLivedObjectCollection>();
                                      ^
  In file included from /home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android/src/main/cpp/JavaScriptModuleObject.cpp:3:
  In file included from /home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android/src/main/cpp/JavaScriptModuleObject.h:5:
  In file included from /home/savinien/.gradle/caches/transforms-3/e34348509d4115f5295bdc4936110f32/transformed/jetified-fbjni-0.3.0/prefab/modules/fbjni/include/fbjni/fbjni.h:21:
  In file included from /home/savinien/.gradle/caches/transforms-3/e34348509d4115f5295bdc4936110f32/transformed/jetified-fbjni-0.3.0/prefab/modules/fbjni/include/fbjni/detail/Environment.h:18:
  In file included from /home/savinien/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/functional:504:
  /home/savinien/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:2260:46: error: field of type 'facebook::react::LongLivedObjectCollection' has private default constructor
    __compressed_pair_elem(__value_init_tag) : __value_() {}
                                               ^
  /home/savinien/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:2353:42: note: in instantiation of member function 'std::__compressed_pair_elem<facebook::react::LongLivedObjectCollection, 1, false>::__compressed_pair_elem' requested here
        : _Base1(std::forward<_U1>(__t1)), _Base2(std::forward<_U2>(__t2)) {}
                                           ^
  /home/savinien/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:3628:12: note: in instantiation of function template specialization 'std::__compressed_pair<std::allocator<facebook::react::LongLivedObjectCollection>, facebook::react::LongLivedObjectCollection>::__compressed_pair<std::allocator<facebook::react::LongLivedObjectCollection>, std::__value_init_tag>' requested here
          :  __data_(_VSTD::move(__a), __value_init_tag()) {}
             ^
  /home/savinien/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:4441:26: note: in instantiation of member function 'std::__shared_ptr_emplace<facebook::react::LongLivedObjectCollection, std::allocator<facebook::react::LongLivedObjectCollection>>::__shared_ptr_emplace' requested here
      ::new(__hold2.get()) _CntrlBlk(__a2, _VSTD::forward<_Args>(__args)...);
                           ^
  /home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android/src/main/cpp/JavaScriptModuleObject.cpp:238:37: note: in instantiation of function template specialization 'std::make_shared<facebook::react::LongLivedObjectCollection>' requested here
    longLivedObjectCollection_ = std::make_shared<react::LongLivedObjectCollection>();
                                      ^
  /home/savinien/.gradle/caches/transforms-3/6ac6e41ab38ef231e88c9df85ae5bb5f/transformed/jetified-react-android-0.72.3-debug/prefab/modules/react_nativemodule_core/include/react/bridging/LongLivedObject.h:52:3: note: declared private here
    LongLivedObjectCollection() = default;
    ^
  2 errors generated.
  [13/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/WeakRuntimeHolder.cpp.o
  [14/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptObject.cpp.o
  [15/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JSIInteropModuleRegistry.cpp.o
  [16/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptTypedArray.cpp.o
  [17/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptRuntime.cpp.o
  [18/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptValue.cpp.o
  [19/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/types/AnyType.cpp.o
  [20/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/MethodMetadata.cpp.o
  FAILED: CMakeFiles/expo-modules-core.dir/src/main/cpp/MethodMetadata.cpp.o 
  /home/savinien/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android24 --sysroot=/home/savinien/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot -Dexpo_modules_core_EXPORTS -I/home/savinien/.gradle/caches/transforms-3/6ac6e41ab38ef231e88c9df85ae5bb5f/transformed/jetified-react-android-0.72.3-debug/prefab/modules/reactnativejni/include/react -I/home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/react-native/ReactAndroid/src/main/jni/react/turbomodule -I/home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android/../common/cpp -I/home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android/src/fabric -isystem /home/savinien/.gradle/caches/transforms-3/e34348509d4115f5295bdc4936110f32/transformed/jetified-fbjni-0.3.0/prefab/modules/fbjni/include -isystem /home/savinien/.gradle/caches/transforms-3/6ac6e41ab38ef231e88c9df85ae5bb5f/transformed/jetified-react-android-0.72.3-debug/prefab/modules/jsi/include -isystem /home/savinien/.gradle/caches/transforms-3/6ac6e41ab38ef231e88c9df85ae5bb5f/transformed/jetified-react-android-0.72.3-debug/prefab/modules/reactnativejni/include -isystem /home/savinien/.gradle/caches/transforms-3/6ac6e41ab38ef231e88c9df85ae5bb5f/transformed/jetified-react-android-0.72.3-debug/prefab/modules/folly_runtime/include -isystem /home/savinien/.gradle/caches/transforms-3/6ac6e41ab38ef231e88c9df85ae5bb5f/transformed/jetified-react-android-0.72.3-debug/prefab/modules/react_nativemodule_core/include -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fexceptions -frtti -stdlib=libc++ -DREACT_NATIVE_TARGET_VERSION=72 -g  -fno-limit-debug-info -fPIC -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -DFOLLY_HAVE_RECVMMSG=1 -DFOLLY_HAVE_PTHREAD=1 -DFOLLY_HAVE_XSI_STRERROR_R=1 -O2 -frtti -fexceptions -Wall -fstack-protector-all -DUSE_HERMES=0 -DUNIT_TEST=0 -std=gnu++17 -MD -MT CMakeFiles/expo-modules-core.dir/src/main/cpp/MethodMetadata.cpp.o -MF CMakeFiles/expo-modules-core.dir/src/main/cpp/MethodMetadata.cpp.o.d -o CMakeFiles/expo-modules-core.dir/src/main/cpp/MethodMetadata.cpp.o -c /home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android/src/main/cpp/MethodMetadata.cpp
  /home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android/src/main/cpp/MethodMetadata.cpp:40:57: error: too many arguments to function call, expected 3, have 4
                                                          std::move(jsInvoker));
                                                          ^~~~~~~~~~~~~~~~~~~~
  /home/savinien/.gradle/caches/transforms-3/6ac6e41ab38ef231e88c9df85ae5bb5f/transformed/jetified-react-android-0.72.3-debug/prefab/modules/react_nativemodule_core/include/react/bridging/CallbackWrapper.h:34:41: note: 'createWeak' declared here
    static std::weak_ptr<CallbackWrapper> createWeak(
                                          ^
  1 error generated.
  [21/23] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/types/FrontendConverter.cpp.o
  ninja: build stopped: subcommand failed.
  
  C++ build system [build] failed while executing:
      /usr/bin/ninja \
        -C \
        /home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android/.cxx/Debug/382l4f2d/arm64-v8a \
        expo-modules-core
    from /home/savinien/Documents/apiRTC/reactAPIRTC/apiRTC_Conference/node_modules/expo-modules-core/android

I also find https://stackoverflow.com/questions/74420630/execution-failed-for-task-expo-modules-corebuildcmakedebugarm64-v8a this issue. Trying to delete node_modules/ repo and package.lock othing changed. Thanks for your help.

Bro did you find fix?

@AtulDubeyy
Copy link

AtulDubeyy commented Sep 9, 2023

hi! @Kudo i am also having the same issue can u help me out with this

@neibips
Copy link

neibips commented Sep 10, 2023

hi! @Kudo i am also having the same issue can u help me out with this

Buddy I fixed it by adding "react-native-gesture-handler": "^2.9.0" this way

@Yandamuri
Copy link

hi! @Kudo i am also having the same issue can u help me out with this

Buddy I fixed it by adding "react-native-gesture-handler": "^2.9.0" this way

How come react-native-gesture-handler is related to expo-modules-core issue?

@Yandamuri
Copy link

Neither @matthewparavati 's nor @Kudo 's solution worked for me. I am facing this issue brand new react-native project. This is my configuration

"react": "18.2.0",
"react-native": "0.72.6",
 "expo": "^49.0.0"

I am surprised to see this issue is closed without any proper solution. I can confirm that ./gradlew clean is not working

@gabrielyotoo
Copy link

still an issue

@jaypee-0
Copy link

jaypee-0 commented Nov 9, 2023

please can someone help me solve this issue, thanks

@dlinds
Copy link

dlinds commented Nov 9, 2023

I've been struggling with this error for a bit and finally resolved it today. For me it ended up not being an issue with Expo at all actually but with how the /android/local.properties was being generated. I had to use an absolute path to cmake in local.properties

I changed ~/Library/Android/sdk/cmake => /Users/me/Library/Android/sdk/cmake

On a Mac so your mileage will obviously vary

@nguu0123
Copy link

Has this issue on Pop!_Os 22.04 with:
"react": "18.2.0",
"react-native": "0.72.4",
"expo": "~49.0.11",
I tried to use Cmake 3.18.1 and it can be built with a lot of warning

@RahulSinghIIITK
Copy link

RahulSinghIIITK commented Dec 5, 2023

Facing same issue tried downgrading cmake version to 3.18.1, deleting gradle cache and deleting node-modules nothing worked. All the library which depends on cmake are failing

@gabrielyotoo
Copy link

Only thing that worked for me was moving my project directly to my HD, changing its path to something like D:\my-project

@paramp07
Copy link

I had this issue and couldnt figure out why for the life of me but I was able to fix this by updating cmake in android studio. I followed these steps:

  1. Open Android Studio
  2. Access SDK MANAGER
  3. Access tools and found CMake
  4. Click Show Package details
  5. Then install the version 3.18.1

After I installed it, I created a local.properties files in my android folder and added my cmake location:
cmake.dir=C:/Users/{Name}/AppData/Local/Android/Sdk/cmake/3.18.1
After updating cmake and running npm start again, it worked.
I'm not sure this will work on Mac though.

@LuisCo123
Copy link

Hello, after some time searching for a solution, as deleting the node modules and cleaning the gradlew didn't work, I noticed that the issue could be related to the project path. Since the project was located in many subfolders, it ended up crashing at this point. I moved it to a folder directly on the C: drive and without any special characters in the folder names, and it worked.

@olawalejuwonm
Copy link

Please I'm having this issue. How can it be resolved?

@sahiljena
Copy link

it works when changing ndk version to 26.2.11394342 and specifying ndk.dir in android/local.properties to ndk.dir=/Users/{username}/Library/Android/sdk/ndk/26.2.11394342 , also clean gradle and re-install nodemodules before building

@rmatos1
Copy link

rmatos1 commented Apr 22, 2024

I tried every solution listed above, and nothing worked, because I'm still receiving the same error message present in the title of this section whenever I try to run or build the Android app.

@anfinil
Copy link

anfinil commented May 13, 2024

Upgrading NDK to 26.3.11579264 solves the issue

@olawalejuwonm
Copy link

olawalejuwonm commented May 13, 2024 via email

@AnatoliiRudenko
Copy link

How do I make ndk upgrade please?

open build.gradle file in android folder. Find ndkVersion parameter and change its value

@oussamabenkortbi
Copy link

Upgrading NDK to 26.3.11579264 solves the issue

Thank you so much !

nop33 added a commit to alephium/alephium-frontend that referenced this issue May 29, 2024
@Nucletic
Copy link

Nucletic commented Jun 8, 2024

Upgrading NDK to 26.3.11579264 solves the issue

unfortunately did not work for me umm..

@Nucletic
Copy link

Nucletic commented Jun 9, 2024

Upgrading NDK to 26.3.11579264 solves the issue

unfortunately did not work for me umm..

Only thing that worked for me was moving my project directly to my HD, changing its path to something like D:\my-project

Thanks it worked for me don't know how but if it works I don't care How ?, and you all guys try this once i was also stuck on this problem around form 2 weeks and at the end I tried this way which was not supposed to work as per me but it worked.

@douglasfelc
Copy link

The problem probably occurs when there is an incompatibility between the NDK and CMake versions.
In my case, I was trying to use NDK 27.0.11902837 with CMake 3.22.1.
I downgraded the NDK to 26.1.10909125 and it fixed the problem.

@albertonsc
Copy link

My problem was resolved with this it:

The problem probably occurs when there is an incompatibility between the NDK and CMake versions. In my case, I was trying to use NDK 27.0.11902837 with CMake 3.22.1. I downgraded the NDK to 26.1.10909125 and it fixed the problem.

and ignoring this point (including, removing it made it work):

I think I solved my issue but I don't really understand how/why but hopefully it helps others. I was following this answer for reference

In android/app/build.gradle inside of android {}, I added this lines:

externalNativeBuild {
    cmake {
        version "3.22.1"
    }
}

Then I created a local.properties file inside android/ and added this line:

cmake.dir=/[your path]/Library/Android/sdk/cmake/3.22.1

Ran ./gradlew clean and then was able to build again 🤷

Strangely I've found that I can comment out those lines I added above, re-run ./gradlew clean, and the app continues to build fine.

@jorgezerpa
Copy link

hey Devs!

For me, the solution was to upgrade the NDK to 26.3.11579264 (downloading it from Android Studio).
Then I have to go into each build.gradle file that has the project, and change the ndkVersion to 26.3.11579264

@Joshua-W-Adams
Copy link

Hey guys, I was having this issue, and it turned out for me I was using the incorrect version of the jdk on my system, I needed to install a version compatible with apple silicon (M1 etc.). So i installed the version recommended in this expo document (https://docs.expo.dev/get-started/set-up-your-environment/?platform=android&device=simulated&mode=development-build&buildEnv=local#install-watchman-and-jdk) and also deleted all other jdk versions installed via brew package manager on my system to make sure expo was building the application with the correct jdk version.

@CyxouD
Copy link

CyxouD commented Aug 14, 2024

After updating RN bare project with Expo (RN from 0.72 to 0.74.5, Expo SDK from 49 to 51 and using NDK "26.1.10909125" which is specified in RN 0.74.5 upgrade guide), the issue has been resolved. Before I used "26.3.11579264" and specified it in local.properties, now I used "26.1.10909125" and removed ndk properties from local.properties

@Nesril
Copy link

Nesril commented Aug 16, 2024

@CyxouD I did same like you, but still getting the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review Issue is ready to be reviewed by a maintainer
Projects
None yet
Development

No branches or pull requests