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

error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension] #6005

Closed
kien091 opened this issue May 11, 2024 · 3 comments
Labels
Platform: Android This issue is specific to Android Repro provided A reproduction with a snippet of code, snack or repo is provided

Comments

@kien091
Copy link

kien091 commented May 11, 2024

Description

I have error like this:

C:\Users\ASUS\AppData\Local\Android\Sdk\ndk\27.0.11718014\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=i686-none-linux-android23 --sysroot=C:/Users/ASUS/AppData/Local/Android/Sdk/ndk/27.0.11718014/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Dreanimated_EXPORTS -I"D:/Final Cross-Platform/ElectronicsStore/node_modules/react-native-reanimated/android/../Common/cpp/AnimatedSensor" -I"D:/Final Cross-Platform/ElectronicsStore/node_modules/react-native-reanimated/android/../Common/cpp/Fabric" -I"D:/Final Cross-Platform/ElectronicsStore/node_modules/react-native-reanimated/android/../Common/cpp/hidden_headers" -I"D:/Final Cross-Platform/ElectronicsStore/node_modules/react-native-reanimated/android/../Common/cpp/LayoutAnimations" -I"D:/Final Cross-Platform/ElectronicsStore/node_modules/react-native-reanimated/android/../Common/cpp/NativeModules" -I"D:/Final Cross-Platform/ElectronicsStore/node_modules/react-native-reanimated/android/../Common/cpp/ReanimatedRuntime" -I"D:/Final Cross-Platform/ElectronicsStore/node_modules/react-native-reanimated/android/../Common/cpp/Registries" -I"D:/Final Cross-Platform/ElectronicsStore/node_modules/react-native-reanimated/android/../Common/cpp/SharedItems" -I"D:/Final Cross-Platform/ElectronicsStore/node_modules/react-native-reanimated/android/../Common/cpp/Tools" -I"D:/Final Cross-Platform/ElectronicsStore/node_modules/react-native-reanimated/android/src/main/cpp" -I"D:/Final Cross-Platform/ElectronicsStore/node_modules/react-native/ReactAndroid/src/main/jni/react/turbomodule" -I"D:/Final Cross-Platform/ElectronicsStore/node_modules/react-native/ReactCommon" -I"D:/Final Cross-Platform/ElectronicsStore/node_modules/react-native/ReactCommon/callinvoker" -I"D:/Final Cross-Platform/ElectronicsStore/node_modules/react-native/ReactCommon/react/renderer/graphics/platform/cxx" -I"D:/Final Cross-Platform/ElectronicsStore/node_modules/react-native/ReactCommon/runtimeexecutor" -I"D:/Final Cross-Platform/ElectronicsStore/node_modules/react-native/ReactCommon/yoga" -isystem C:/Users/ASUS/.gradle/caches/transforms-4/441abbc29e7844d504dda1a0ffede014/transformed/jetified-react-android-0.74.1-debug/prefab/modules/folly_runtime/include -isystem C:/Users/ASUS/.gradle/caches/transforms-4/441abbc29e7844d504dda1a0ffede014/transformed/jetified-react-android-0.74.1-debug/prefab/modules/glog/include -isystem C:/Users/ASUS/.gradle/caches/transforms-4/441abbc29e7844d504dda1a0ffede014/transformed/jetified-react-android-0.74.1-debug/prefab/modules/jsi/include -isystem C:/Users/ASUS/.gradle/caches/transforms-4/441abbc29e7844d504dda1a0ffede014/transformed/jetified-react-android-0.74.1-debug/prefab/modules/reactnativejni/include -isystem C:/Users/ASUS/.gradle/caches/transforms-4/c7e26f7d3c2fc1a6636ff1467fc77795/transformed/jetified-fbjni-0.6.0/prefab/modules/fbjni/include -isystem C:/Users/ASUS/.gradle/caches/transforms-4/e7689cf58141a18272e612b148cefd59/transformed/jetified-hermes-android-0.74.1-debug/prefab/modules/libhermes/include -isystem C:/Users/ASUS/.gradle/caches/transforms-4/441abbc29e7844d504dda1a0ffede014/transformed/jetified-react-android-0.74.1-debug/prefab/modules/hermes_executor/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mstackrealign -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -DREACT_NATIVE_MINOR_VERSION=74 -DREANIMATED_VERSION=3.10.1 -DHERMES_ENABLE_DEBUGGER=1 -fexceptions -fno-omit-frame-pointer -frtti -fstack-protector-all -std=c++20 -Wall -Werror -DJS_RUNTIME_HERMES=1 -fno-limit-debug-info -fPIC -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_CFG_NO_COROUTINES=1 -DFOLLY_MOBILE=1 -DFOLLY_HAVE_RECVMMSG=1 -DFOLLY_HAVE_PTHREAD=1 -DFOLLY_HAVE_XSI_STRERROR_R=1 -std=gnu++20 -MD -MT CMakeFiles/reanimated.dir/baa741105af35d3bc45a19e61592e3fd/Common/cpp/ReanimatedRuntime/WorkletRuntimeDecorator.cpp.o -MF CMakeFiles\reanimated.dir\baa741105af35d3bc45a19e61592e3fd\Common\cpp\ReanimatedRuntime\WorkletRuntimeDecorator.cpp.o.d -o CMakeFiles/reanimated.dir/baa741105af35d3bc45a19e61592e3fd/Common/cpp/ReanimatedRuntime/WorkletRuntimeDecorator.cpp.o -c "D:/Final Cross-Platform/ElectronicsStore/node_modules/react-native-reanimated/Common/cpp/ReanimatedRuntime/WorkletRuntimeDecorator.cpp"

D:/Final Cross-Platform/ElectronicsStore/node_modules/react-native-reanimated/Common/cpp/ReanimatedRuntime/WorkletRuntimeDecorator.cpp:115:29: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension]
115 | jsi::Value args[argsSize]; // NOLINT(runtime/arrays)
| ^~~~~~~~
D:/Final Cross-Platform/ElectronicsStore/node_modules/react-native-reanimated/Common/cpp/ReanimatedRuntime/WorkletRuntimeDecorator.cpp:115:29: note: read of non-const variable 'argsSize' is not allowed in a constant expression
D:/Final Cross-Platform/ElectronicsStore/node_modules/react-native-reanimated/Common/cpp/ReanimatedRuntime/WorkletRuntimeDecorator.cpp:112:18: note: declared here
112 | auto argsSize = argsArray.size(rt);
| ^

. I'm newbie in react native & i try to make drawer navigation. When i install react-native-reanimated I see this error. I spend 2 days for this. How can i fix it?

Steps to reproduce

  1. I'm install react-native-reanimated to make drawer navigation but i see this error
  2. Just run with metro like npx react-native run-android i will see this error
  3. I try to fix it in 2 days and i can't fix it.

Snack or a link to a repository

https://github.com/kien091/electronics-app.git

Reanimated version

3.11.0

React Native version

0.74.1

Platforms

Android

JavaScript runtime

None

Workflow

React Native

Architecture

Paper

Build type

None

Device

Android emulator

Device model

No response

Acknowledgements

Yes

@github-actions github-actions bot added Repro provided A reproduction with a snippet of code, snack or repo is provided Platform: Android This issue is specific to Android labels May 11, 2024
@szydlovsky
Copy link
Contributor

Hey @kien091, first off - you don't have reanimated babel plugin in your repro's babel.config.js Please follow Reanimated installation guide and make sure it is there. Let me know if it changes anything

@Malik-Adil
Copy link

@szydlovsky I am facing the same issue and this is my babel.config.js
module.exports = {
presets: ['module:@react-native/babel-preset'],
plugins: [
'react-native-reanimated/plugin',
],
};

@szydlovsky
Copy link
Contributor

Hey @kien091 @Malik-Adil I think I got the fix and it is not connected to Reanimated whatsoever. The NDK version in your linked project is ndkVersion = "27.0.11718014", which is way too high for react native. Try changing it to, for example, NDK 23.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: Android This issue is specific to Android Repro provided A reproduction with a snippet of code, snack or repo is provided
Projects
None yet
Development

No branches or pull requests

3 participants