mrousavy / react-native-vision-camera

šŸ“ø A powerful, high-performance React Native Camera library.
https://react-native-vision-camera.com
MIT License
7.5k stars 1.09k forks source link

šŸ› Unable to build app with "#include <boost/operators.hpp>" error #977

Closed sanketkheni01 closed 2 years ago

sanketkheni01 commented 2 years ago

What were you trying to do?

Just developing the app.

Reproduceable Code

No response

What happened instead?

image This package downloads react-native boost each time. it takes so much time on each building. and also fails to build sometimes.

Relevant log output

BUILD FAILED in 3m 5s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Note: I:\Just Share\Mobile App\node_modules\react-native-gradle-plugin\src\main\java\com\facebook\react\codegen\generator\SchemaJsonParser.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: I:\Just Share\Mobile App\node_modules\@react-native-async-storage\async-storage\android\src\main\java\com\reactnativecommunity\asyncstorage\AsyncStorageModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: I:\Just Share\Mobile App\node_modules\@react-native-async-storage\async-storage\android\src\main\java\com\reactnativecommunity\asyncstorage\AsyncStoragePackage.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: I:\Just Share\Mobile App\node_modules\react-native-push-notification\android\src\main\java\com\dieam\reactnativepushnotification\modules\RNPushNotification.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: I:\Just Share\Mobile App\android\app\src\main\java\com\reactnativeboilerplate\MainApplication.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-vision-camera:buildCMakeDebug'.
> Build command failed.
  Error while executing process C:\Users\sanke\AppData\Local\Android\Sdk\cmake\3.10.2.4988404\bin\ninja.exe with arguments {-C I:\Just Share\Mobile App\node_modules\react-native-vision-camera\android\.cxx\Debug\542b6v5j\armeabi-v7a VisionCamera}
  ninja: Entering directory `I:\Just Share\Mobile App\node_modules\react-native-vision-camera\android\.cxx\Debug\542b6v5j\armeabi-v7a'
  [1/10] Building CXX object CMakeFiles/VisionCamera.dir/src/main/cpp/java-bindings/JHashMap.cpp.o
  [2/10] Building CXX object CMakeFiles/VisionCamera.dir/src/main/cpp/java-bindings/JImageProxy.cpp.o
  [3/10] Building CXX object CMakeFiles/VisionCamera.dir/src/main/cpp/java-bindings/JFrameProcessorPlugin.cpp.o
  [4/10] Building CXX object CMakeFiles/VisionCamera.dir/src/main/cpp/VisionCameraScheduler.cpp.o
  [5/10] Building CXX object CMakeFiles/VisionCamera.dir/src/main/cpp/FrameHostObject.cpp.o
  [6/10] Building CXX object CMakeFiles/VisionCamera.dir/src/main/cpp/CameraView.cpp.o
  [7/10] Building CXX object CMakeFiles/VisionCamera.dir/src/main/cpp/VisionCamera.cpp.o
  FAILED: CMakeFiles/VisionCamera.dir/src/main/cpp/VisionCamera.cpp.o
  C:\Users\sanke\AppData\Local\Android\Sdk\ndk\21.4.7075529\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=armv7-none-linux-androideabi21 --gcc-toolchain=C:/Users/sanke/AppData/Local/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=C:/Users/sanke/AppData/Local/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/sysroot  -DVisionCamera_EXPORTS -I../../../../build/fbjni-0.3.0-headers.jar -I../../../../build/third-party-ndk/boost -I../../../../build/third-party-ndk/double-conversion -I../../../../build/third-party-ndk/folly -I../../../../build/third-party-ndk/glog -I"I:/Just Share/Mobile App/node_modules/react-native/React" -I"I:/Just Share/Mobile App/node_modules/react-native/React/Base" -I"I:/Just Share/Mobile App/node_modules/react-native/ReactAndroid/src/main/jni" -I"I:/Just Share/Mobile App/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni" -I"I:/Just Share/Mobile App/node_modules/react-native/ReactCommon" -I"I:/Just Share/Mobile App/node_modules/react-native/ReactCommon/callinvoker" -I"I:/Just Share/Mobile App/node_modules/react-native/ReactCommon/jsi" -I"I:/Just Share/Mobile App/node_modules/hermes-engine/android/include" -I"I:/Just Share/Mobile App/node_modules/react-native-reanimated/Common/cpp/headers/AnimatedSensor" -I"I:/Just Share/Mobile App/node_modules/react-native-reanimated/Common/cpp/headers/Tools" -I"I:/Just Share/Mobile App/node_modules/react-native-reanimated/Common/cpp/headers/SpecTools" -I"I:/Just Share/Mobile App/node_modules/react-native-reanimated/Common/cpp/headers/SharedItems" -I"I:/Just Share/Mobile App/node_modules/react-native-reanimated/Common/cpp/headers/Registries" -I"I:/Just Share/Mobile App/node_modules/react-native-reanimated/Common/cpp/headers/LayoutAnimations" -I"I:/Just Share/Mobile App/node_modules/react-native-reanimated/Common/cpp/hidden_headers" -I../../../../src/main/cpp -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_HAVE_MEMRCHR=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -DON_ANDROID -DONANDROID -DFOR_HERMES=true -O0 -fno-limit-debug-info  -fPIC   -std=gnu++14 -MD -MT CMakeFiles/VisionCamera.dir/src/main/cpp/VisionCamera.cpp.o -MF CMakeFiles\VisionCamera.dir\src\main\cpp\VisionCamera.cpp.o.d -o CMakeFiles/VisionCamera.dir/src/main/cpp/VisionCamera.cpp.o -c ../../../../src/main/cpp/VisionCamera.cpp
  In file included from ../../../../src/main/cpp/VisionCamera.cpp:3:
  In file included from ../../../../src/main/cpp/FrameProcessorRuntimeManager.h:14:
  In file included from ../../../../src/main/cpp/reanimated-headers/AndroidScheduler.h:8:
  In file included from I:/Just Share/Mobile App/node_modules/react-native/ReactAndroid/src/main/jni\react/jni/CxxModuleWrapper.h:10:
  In file included from I:/Just Share/Mobile App/node_modules/react-native/ReactAndroid/src/main/jni\react/jni/CxxModuleWrapperBase.h:13:
  In file included from I:/Just Share/Mobile App/node_modules/react-native/ReactCommon\cxxreact/CxxModule.h:15:
  ../../../../build/third-party-ndk/folly\folly/dynamic.h:63:10: fatal error: 'boost/operators.hpp' file not found
  #include <boost/operators.hpp>
           ^~~~~~~~~~~~~~~~~~~~~
  1 error generated.
  [8/10] Building CXX object CMakeFiles/VisionCamera.dir/src/main/cpp/JSIJNIConversion.cpp.o
  FAILED: CMakeFiles/VisionCamera.dir/src/main/cpp/JSIJNIConversion.cpp.o
  C:\Users\sanke\AppData\Local\Android\Sdk\ndk\21.4.7075529\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=armv7-none-linux-androideabi21 --gcc-toolchain=C:/Users/sanke/AppData/Local/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=C:/Users/sanke/AppData/Local/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/sysroot  -DVisionCamera_EXPORTS -I../../../../build/fbjni-0.3.0-headers.jar -I../../../../build/third-party-ndk/boost -I../../../../build/third-party-ndk/double-conversion -I../../../../build/third-party-ndk/folly -I../../../../build/third-party-ndk/glog -I"I:/Just Share/Mobile App/node_modules/react-native/React" -I"I:/Just Share/Mobile App/node_modules/react-native/React/Base" -I"I:/Just Share/Mobile App/node_modules/react-native/ReactAndroid/src/main/jni" -I"I:/Just Share/Mobile App/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni" -I"I:/Just Share/Mobile App/node_modules/react-native/ReactCommon" -I"I:/Just Share/Mobile App/node_modules/react-native/ReactCommon/callinvoker" -I"I:/Just Share/Mobile App/node_modules/react-native/ReactCommon/jsi" -I"I:/Just Share/Mobile App/node_modules/hermes-engine/android/include" -I"I:/Just Share/Mobile App/node_modules/react-native-reanimated/Common/cpp/headers/AnimatedSensor" -I"I:/Just Share/Mobile App/node_modules/react-native-reanimated/Common/cpp/headers/Tools" -I"I:/Just Share/Mobile App/node_modules/react-native-reanimated/Common/cpp/headers/SpecTools" -I"I:/Just Share/Mobile App/node_modules/react-native-reanimated/Common/cpp/headers/SharedItems" -I"I:/Just Share/Mobile App/node_modules/react-native-reanimated/Common/cpp/headers/Registries" -I"I:/Just Share/Mobile App/node_modules/react-native-reanimated/Common/cpp/headers/LayoutAnimations" -I"I:/Just Share/Mobile App/node_modules/react-native-reanimated/Common/cpp/hidden_headers" -I../../../../src/main/cpp -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_HAVE_MEMRCHR=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -DON_ANDROID -DONANDROID -DFOR_HERMES=true -O0 -fno-limit-debug-info  -fPIC   -std=gnu++14 -MD -MT CMakeFiles/VisionCamera.dir/src/main/cpp/JSIJNIConversion.cpp.o -MF CMakeFiles\VisionCamera.dir\src\main\cpp\JSIJNIConversion.cpp.o.d -o CMakeFiles/VisionCamera.dir/src/main/cpp/JSIJNIConversion.cpp.o -c ../../../../src/main/cpp/JSIJNIConversion.cpp
  In file included from ../../../../src/main/cpp/JSIJNIConversion.cpp:15:
  In file included from I:/Just Share/Mobile App/node_modules/react-native/ReactAndroid/src/main/jni\react/jni/NativeMap.h:11:
  ../../../../build/third-party-ndk/folly\folly/dynamic.h:63:10: fatal error: 'boost/operators.hpp' file not found
  #include <boost/operators.hpp>
           ^~~~~~~~~~~~~~~~~~~~~
  1 error generated.
  [9/10] Building CXX object CMakeFiles/VisionCamera.dir/src/main/cpp/FrameProcessorRuntimeManager.cpp.o
  FAILED: CMakeFiles/VisionCamera.dir/src/main/cpp/FrameProcessorRuntimeManager.cpp.o
  C:\Users\sanke\AppData\Local\Android\Sdk\ndk\21.4.7075529\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=armv7-none-linux-androideabi21 --gcc-toolchain=C:/Users/sanke/AppData/Local/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=C:/Users/sanke/AppData/Local/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/sysroot  -DVisionCamera_EXPORTS -I../../../../build/fbjni-0.3.0-headers.jar -I../../../../build/third-party-ndk/boost -I../../../../build/third-party-ndk/double-conversion -I../../../../build/third-party-ndk/folly -I../../../../build/third-party-ndk/glog -I"I:/Just Share/Mobile App/node_modules/react-native/React" -I"I:/Just Share/Mobile App/node_modules/react-native/React/Base" -I"I:/Just Share/Mobile App/node_modules/react-native/ReactAndroid/src/main/jni" -I"I:/Just Share/Mobile App/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni" -I"I:/Just Share/Mobile App/node_modules/react-native/ReactCommon" -I"I:/Just Share/Mobile App/node_modules/react-native/ReactCommon/callinvoker" -I"I:/Just Share/Mobile App/node_modules/react-native/ReactCommon/jsi" -I"I:/Just Share/Mobile App/node_modules/hermes-engine/android/include" -I"I:/Just Share/Mobile App/node_modules/react-native-reanimated/Common/cpp/headers/AnimatedSensor" -I"I:/Just Share/Mobile App/node_modules/react-native-reanimated/Common/cpp/headers/Tools" -I"I:/Just Share/Mobile App/node_modules/react-native-reanimated/Common/cpp/headers/SpecTools" -I"I:/Just Share/Mobile App/node_modules/react-native-reanimated/Common/cpp/headers/SharedItems" -I"I:/Just Share/Mobile App/node_modules/react-native-reanimated/Common/cpp/headers/Registries" -I"I:/Just Share/Mobile App/node_modules/react-native-reanimated/Common/cpp/headers/LayoutAnimations" -I"I:/Just Share/Mobile App/node_modules/react-native-reanimated/Common/cpp/hidden_headers" -I../../../../src/main/cpp -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_HAVE_MEMRCHR=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -DON_ANDROID -DONANDROID -DFOR_HERMES=true -O0 -fno-limit-debug-info  -fPIC   -std=gnu++14 -MD -MT CMakeFiles/VisionCamera.dir/src/main/cpp/FrameProcessorRuntimeManager.cpp.o -MF CMakeFiles\VisionCamera.dir\src\main\cpp\FrameProcessorRuntimeManager.cpp.o.d -o CMakeFiles/VisionCamera.dir/src/main/cpp/FrameProcessorRuntimeManager.cpp.o -c ../../../../src/main/cpp/FrameProcessorRuntimeManager.cpp
  In file included from ../../../../src/main/cpp/FrameProcessorRuntimeManager.cpp:5:
  In file included from ../../../../src/main/cpp/FrameProcessorRuntimeManager.h:14:
  In file included from ../../../../src/main/cpp/reanimated-headers/AndroidScheduler.h:8:
  In file included from I:/Just Share/Mobile App/node_modules/react-native/ReactAndroid/src/main/jni\react/jni/CxxModuleWrapper.h:10:
  In file included from I:/Just Share/Mobile App/node_modules/react-native/ReactAndroid/src/main/jni\react/jni/CxxModuleWrapperBase.h:13:
  In file included from I:/Just Share/Mobile App/node_modules/react-native/ReactCommon\cxxreact/CxxModule.h:15:
  ../../../../build/third-party-ndk/folly\folly/dynamic.h:63:10: fatal error: 'boost/operators.hpp' file not found
  #include <boost/operators.hpp>
           ^~~~~~~~~~~~~~~~~~~~~
  1 error generated.
  ninja: build stopped: subcommand failed.

* 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

BUILD FAILED in 3m 5s

    at makeError (I:\Just Share\Mobile App\node_modules\execa\index.js:174:9)
    at I:\Just Share\Mobile App\node_modules\execa\index.js:278:16
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async runOnAllDevices (I:\Just Share\Mobile App\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
    at async Command.handleAction (I:\Just Share\Mobile App\node_modules\@react-native-community\cli\build\index.js:192:9)

Device

Android 12

VisionCamera Version

2.13.1

Additional information

mrousavy commented 2 years ago

Hi!

This is not a bug, I have to download boost from somewhere. This will hopefully get fixed soon in the future by react-native core once they start providing prefabs.

Jamal-Nazzal commented 2 years ago

I've been facing this issue for a while, had to remove the camera library until a fix is done somewhere. why does this happen anyway? is it a bug with the boost library?

mrousavy commented 2 years ago

Which RN version are you even on?

Jamal-Nazzal commented 2 years ago

it's 0.67.3 and could you review my answers here please? they describe the issue well enough #908 thanks

salembaira commented 2 years ago

This happens sometimes when boost have not been installed properly. Just do this :

Jamal-Nazzal commented 2 years ago

Thanks Mohamad, yeah I know the drill but this time it's different, every time boost does not install properly and you'd have to do these steps and even then the first build fails and you have to delete the build folder and build again. it's very tedious and there's something wrong here not sure where. this issue here explains the situation very clearly. #908

Jamal-Nazzal commented 2 years ago

This issue hasn't been resolved for Windows yet

salembaira commented 2 years ago

I encountered this issue a couple of times and all I had to do is what I said in my previous comment (deleting node_modules folder is key). I'm running react-native 0.68.1, latest versions of react-native-vision-camera, react-native-mmkv, realm-js, wix RNN + many others.

sanketkheni01 commented 2 years ago

This happens sometimes when boost have not been installed properly. Just do this :

  • Delete node_modules folder
  • gradlew clean
  • yarn
  • yarn react-native run-android

Do we need to do this each time we encounter this issue?

salembaira commented 2 years ago

Do we need to do this each time we encounter this issue?

Unfortunately yes. But once you fix it, you should be good. I never encountered it since I deleted node_modules folder and rebuilt project.

Also, if your project's path contains weird characters or spaces, try moving it to new clean path and rebuild.

salembaira commented 2 years ago

I just cloned and old project to start a new one and got the same error when building the app. Did yarn add react-native-vision-camera react-native-reanimated to update them to the latest version and everything worked fine without deleting node_modules or gradlew clean. The project is using react-native v0.67.4.

Hope this helps someone.

formifan2002 commented 2 years ago

see solution in: https://github.com/mrousavy/react-native-vision-camera/issues/908