software-mansion / react-native-reanimated

React Native's Animated library reimplemented
https://docs.swmansion.com/react-native-reanimated/
MIT License
8.61k stars 1.26k forks source link

[Android] Build failed for task buildCMakeDebug during upgrading v3 #3741

Open batuhansahan opened 1 year ago

batuhansahan commented 1 year ago

Description

I did upgrade react native reanimated from 2.9.1 to 3.0.0-rc.4 react native version 0.67.4 IOS is working but android is not

Here is error

* What went wrong:
Execution failed for task ':react-native-reanimated:buildCMakeDebug[arm64-v8a]'.
> Build command failed.
  Error while executing process /Users/userm1/Library/Android/sdk/cmake/3.18.1/bin/ninja with arguments {-C /Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/android/.cxx/Debug/1w723312/arm64-v8a reanimated}
  ninja: Entering directory `/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/android/.cxx/Debug/1w723312/arm64-v8a'
  [0/2] Re-checking globbed directories...
  [1/8] Building CXX object CMakeFiles/reanimated.dir/src/main/cpp/AndroidErrorHandler.cpp.o
  [2/8] Building CXX object CMakeFiles/reanimated.dir/src/main/cpp/AndroidScheduler.cpp.o
  [3/8] Building CXX object CMakeFiles/reanimated.dir/src/main/cpp/LayoutAnimations.cpp.o
  [4/8] Building CXX object CMakeFiles/reanimated.dir/src/main/cpp/JNIHelper.cpp.o
  [5/8] Building CXX object CMakeFiles/reanimated.dir/src/main/cpp/OnLoad.cpp.o
  [6/8] Building CXX object CMakeFiles/reanimated.dir/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/Tools/JSIStoreValueUser.cpp.o
  [7/8] Building CXX object CMakeFiles/reanimated.dir/src/main/cpp/NativeProxy.cpp.o
  [8/8] Linking CXX shared library ../../../../build/intermediates/cxx/Debug/1w723312/obj/arm64-v8a/libreanimated.so
  FAILED: ../../../../build/intermediates/cxx/Debug/1w723312/obj/arm64-v8a/libreanimated.so
  : && /Users/userm1/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/Users/userm1/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64 --sysroot=/Users/userm1/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -fPIC -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_HAVE_MEMRCHR=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -DFOLLY_HAVE_RECVMMSG=1 -DFOLLY_HAVE_PTHREAD=1 -DANDROID -DREACT_NATIVE_MINOR_VERSION=67 -DHERMES_ENABLE_DEBUGGER=1 -fexceptions -fno-omit-frame-pointer -frtti -Wno-sign-compare -std=c++17 -Wall -Werror -DDEBUG -DJS_RUNTIME_HERMES=1 -O0 -fno-limit-debug-info  -g  -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -Wl,--build-id -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,libreanimated.so -o ../../../../build/intermediates/cxx/Debug/1w723312/obj/arm64-v8a/libreanimated.so CMakeFiles/reanimated.dir/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/AnimatedSensor/AnimatedSensorModule.cpp.o CMakeFiles/reanimated.dir/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/Fabric/FabricUtils.cpp.o CMakeFiles/reanimated.dir/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/Fabric/ReanimatedUIManagerBinding.cpp.o CMakeFiles/reanimated.dir/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/Fabric/ShadowTreeCloner.cpp.o CMakeFiles/reanimated.dir/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.cpp.o CMakeFiles/reanimated.dir/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/NativeModules/NativeReanimatedModule.cpp.o CMakeFiles/reanimated.dir/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp.o CMakeFiles/reanimated.dir/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.cpp.o CMakeFiles/reanimated.dir/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/ReanimatedRuntime/ReanimatedRuntime.cpp.o CMakeFiles/reanimated.dir/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/Registries/EventHandlerRegistry.cpp.o CMakeFiles/reanimated.dir/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/Registries/MapperRegistry.cpp.o CMakeFiles/reanimated.dir/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/Registries/NewestShadowNodesRegistry.cpp.o CMakeFiles/reanimated.dir/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/Registries/WorkletsCache.cpp.o CMakeFiles/reanimated.dir/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/SharedItems/FrozenObject.cpp.o CMakeFiles/reanimated.dir/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/SharedItems/MutableValue.cpp.o CMakeFiles/reanimated.dir/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/SharedItems/MutableValueSetterProxy.cpp.o CMakeFiles/reanimated.dir/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/SharedItems/RemoteObject.cpp.o CMakeFiles/reanimated.dir/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/SharedItems/ShareableValue.cpp.o CMakeFiles/reanimated.dir/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/Tools/FeaturesConfig.cpp.o CMakeFiles/reanimated.dir/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/Tools/JSIStoreValueUser.cpp.o CMakeFiles/reanimated.dir/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/Tools/Mapper.cpp.o CMakeFiles/reanimated.dir/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/Tools/RuntimeDecorator.cpp.o CMakeFiles/reanimated.dir/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/Tools/Scheduler.cpp.o CMakeFiles/reanimated.dir/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/Tools/WorkletEventHandler.cpp.o CMakeFiles/reanimated.dir/src/main/cpp/AndroidErrorHandler.cpp.o CMakeFiles/reanimated.dir/src/main/cpp/AndroidLogger.cpp.o CMakeFiles/reanimated.dir/src/main/cpp/AndroidScheduler.cpp.o CMakeFiles/reanimated.dir/src/main/cpp/JNIHelper.cpp.o CMakeFiles/reanimated.dir/src/main/cpp/LayoutAnimations.cpp.o CMakeFiles/reanimated.dir/src/main/cpp/NativeProxy.cpp.o CMakeFiles/reanimated.dir/src/main/cpp/OnLoad.cpp.o CMakeFiles/reanimated.dir/src/main/cpp/TurboModule.cpp.o -L/Users/userm1/projects/AwesomeApp/node_modules/react-native/ReactAndroid/src/main/jni/first-party/react/jni/arm64-v8a   -L/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/android/build/third-party-ndk/hermes/jni/arm64-v8a -llog  -ljsi  -lglog  -lfbjni  -lfolly_json  -lreactnativejni  -landroid  -lhermes-executor-debug  -lhermes  -latomic -lm && :
  CMakeFiles/reanimated.dir/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.cpp.o: In function `ReanimatedHermesRuntime':
  /Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.cpp:75: undefined reference to `facebook::hermes::inspector::chrome::enableDebugging(std::__ndk1::unique_ptr<facebook::hermes::inspector::RuntimeAdapter, std::__ndk1::default_delete<facebook::hermes::inspector::RuntimeAdapter> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)'
  CMakeFiles/reanimated.dir/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.cpp.o: In function `~ReanimatedHermesRuntime':
  /Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.cpp:87: undefined reference to `facebook::hermes::inspector::chrome::disableDebugging(facebook::hermes::HermesRuntime&)'
  CMakeFiles/reanimated.dir/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.cpp.o: In function `RuntimeAdapter':
  /Users/userm1/projects/AwesomeApp/node_modules/react-native/ReactCommon/hermes/inspector/RuntimeAdapter.h:(.text._ZN8facebook6hermes9inspector14RuntimeAdapterC2Ev[_ZN8facebook6hermes9inspector14RuntimeAdapterC2Ev]+0x4): undefined reference to `vtable for facebook::hermes::inspector::RuntimeAdapter'
  /Users/userm1/projects/AwesomeApp/node_modules/react-native/ReactCommon/hermes/inspector/RuntimeAdapter.h:(.text._ZN8facebook6hermes9inspector14RuntimeAdapterC2Ev[_ZN8facebook6hermes9inspector14RuntimeAdapterC2Ev]+0x8): undefined reference to `vtable for facebook::hermes::inspector::RuntimeAdapter'
  CMakeFiles/reanimated.dir/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.cpp.o: In function `~HermesExecutorRuntimeAdapter':
  /Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.cpp:42: undefined reference to `facebook::hermes::inspector::RuntimeAdapter::~RuntimeAdapter()'
  /Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.cpp:42: undefined reference to `facebook::hermes::inspector::RuntimeAdapter::~RuntimeAdapter()'
  CMakeFiles/reanimated.dir/Users/userm1/projects/AwesomeApp/node_modules/react-native-reanimated/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.cpp.o:(.data.rel.ro._ZTIN10reanimated28HermesExecutorRuntimeAdapterE[_ZTIN10reanimated28HermesExecutorRuntimeAdapterE]+0x10): undefined reference to `typeinfo for facebook::hermes::inspector::RuntimeAdapter'
  clang++: error: linker command failed with exit code 1 (use -v to see invocation)
  ninja: build stopped: subcommand failed.

Steps to reproduce

1.Upgrade with npm or yarn 2.Clear android project with gradle 3.Build

Snack or a link to a repository

there is no

Reanimated version

3.0.0-rc.4

React Native version

0.67.4

Platforms

Android

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Paper (Old Architecture)

Build type

Debug mode

Device

Android emulator

Device model

No response

Acknowledgements

Yes

github-actions[bot] commented 1 year ago

Hey! 👋

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

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

tomekzaw commented 1 year ago

Hey @batuhansahan, thanks for submitting the issue.

I was able to reproduce the error with the following commands:

npx react-native@next init AwesomeApp --version 0.67.4
cd AwesomeApp
yarn add react-native-reanimated@3.0.0-rc.4
code android/app/build.gradle  # enableHermes: true
yarn react-native run-android
batuhansahan commented 1 year ago

hello @tomekzaw haven't tried but in rn 0.70 there is a if state for ndkVersion

i was using by default 21.4.7075529 with 0.67.4 maybe this will fix it. when i try i will let you know.

        if (System.properties['os.arch'] == "aarch64") {
            // For M1 Users we need to use the NDK 24 which added support for aarch64
            ndkVersion = "24.0.8215888"
        } else {
            // Otherwise we default to the side-by-side NDK version from AGP.
            ndkVersion = "21.4.7075529"
        }
tomekzaw commented 1 year ago

Honestly, I don't think that changing NDK version will help in this case. It should work if you upgrade RN to 0.68+, though.

batuhansahan commented 1 year ago

@tomekzaw thanks its working with +68 i know. for now i will keep going with current(old) rn and reanimated versions because there is a lot of issues to solve when upgrade react native on my side.

ngoctran5596 commented 1 year ago

hello @tomekzaw. Can you give me a solution other than converting rn 0.70.0 to 0.68+.

tomekzaw commented 1 year ago

Can you give me a solution other than converting rn 0.70.0 to 0.68+.

Just for the record, 0.68+ means any version greater or equal to 68, so currently 0.69 or 0.70.

It should work fine with 0.70.x, it just doesn't work on 0.67.x.

safin-ghoghabori commented 1 year ago

Just for the record, 0.68+ means any version greater or equal to 68, so currently 0.69 or 0.70. It should work fine with 0.70.x, it just doesn't work on 0.67.x.

I'm using React Native 0.68.0. but still facing this error.

EvertV commented 1 year ago

Upgrading to react-native-reanimated 3.0.2 seems to have solved this issue for me

Mr-Rith commented 12 months ago
image

I got an error when I try to build with android studio, it take too long to download the boost file every build.

ywanhzy commented 1 month ago
image

I got an error when I try to build with android studio, it take too long to download the boost file every build.

I had the exact same problem