> 任务:react-native-fast-opencv:configureCMakeDebug[arm64-v8a] 失败

问题描述 投票:0回答:1

我已经安装了库版本0.30.1。它在使用 Xcode 构建的 iOS 上运行良好,但是当我运行

yarn android
命令时遇到以下问题:

错误信息:

Task :react-native-fast-opencv:configureCMakeDebug[arm64-v8a] FAILED
C/C++: CMake Error at CMakeLists.txt:13 (add_library):
C/C++: Target "react-native-fast-opencv" links to target
C/C++: "ReactAndroid::folly_runtime" but the target was not found. Perhaps a
C/C++: find_package() call is missing for an IMPORTED target, or an ALIAS target
C/C++: is missing?
C/C++: CMake Error at CMakeLists.txt:13 (add_library):
C/C++: Target "react-native-fast-opencv" links to target "ReactAndroid::glog" but
C/C++: the target was not found. Perhaps a find_package() call is missing for an
C/C++: IMPORTED target, or an ALIAS target is missing?
C/C++: CMake Error at CMakeLists.txt:13 (add_library):
C/C++: Target "react-native-fast-opencv" links to target
C/C++: "ReactAndroid::reactnativejni" but the target was not found. Perhaps a
C/C++: find_package() call is missing for an IMPORTED target, or an ALIAS target
C/C++: is missing?
C/C++: CMake Generate step failed. Build files cannot be regenerated correctly.

详细错误日志:

* What went wrong:
Execution failed for task ':react-native-fast-opencv:configureCMakeDebug[arm64-v8a]'.
> [CXX1429] error when building with cmake using /Users/vrtechsol/Documents/Projects/Derm_Pro/node_modules/react-native-fast-opencv/android/CMakeLists.txt: -- The C compiler identification is Clang 17.0.2
  -- The CXX compiler identification is Clang 17.0.2
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /Users/vrtechsol/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: /Users/vrtechsol/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Configuring done
  -- Generating done
  
  C++ build system [configure] failed while executing:
      /Users/vrtechsol/Library/Android/sdk/cmake/3.22.1/bin/cmake \
        -H/Users/vrtechsol/Documents/Projects/Derm_Pro/node_modules/react-native-fast-opencv/android \
        -DCMAKE_SYSTEM_NAME=Android \
        -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
        -DCMAKE_SYSTEM_VERSION=24 \
        -DANDROID_PLATFORM=android-24 \
        -DANDROID_ABI=arm64-v8a \
        -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a \
        -DANDROID_NDK=/Users/vrtechsol/Library/Android/sdk/ndk/26.1.10909125 \
        -DCMAKE_ANDROID_NDK=/Users/vrtechsol/Library/Android/sdk/ndk/26.1.10909125 \
        -DCMAKE_TOOLCHAIN_FILE=/Users/vrtechsol/Library/Android/sdk/ndk/26.1.10909125/build/cmake/android.toolchain.cmake \
        -DCMAKE_MAKE_PROGRAM=/Users/vrtechsol/Library/Android/sdk/cmake/3.22.1/bin/ninja \
        "-DCMAKE_CXX_FLAGS=-O2 -frtti -fexceptions -Wall -fstack-protector-all" \
        -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/vrtechsol/Documents/Projects/Derm_Pro/node_modules/react-native-fast-opencv/android/build/intermediates/cxx/Debug/25j621p1/obj/arm64-v8a \
        -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/Users/vrtechsol/Documents/Projects/Derm_Pro/node_modules/react-native-fast-opencv/android/build/intermediates/cxx/Debug/25j621p1/obj/arm64-v8a \
        -DCMAKE_BUILD_TYPE=Debug \
        -DCMAKE_FIND_ROOT_PATH=/Users/vrtechsol/Documents/Projects/Derm_Pro/node_modules/react-native-fast-opencv/android/.cxx/Debug/25j621p1/prefab/arm64-v8a/prefab \
        -B/Users/vrtechsol/Documents/Projects/Derm_Pro/node_modules/react-native-fast-opencv/android/.cxx/Debug/25j621p1/arm64-v8a \
        -GNinja \
        -DANDROID_STL=c++_shared \
        -DNODE_MODULES_DIR=/Users/vrtechsol/Documents/Projects/Derm_Pro/node_modules
    from /Users/vrtechsol/Documents/Projects/Derm_Pro/node_modules/react-native-fast-opencv/android
  CMake Error at CMakeLists.txt:13 (add_library):
    Target "react-native-fast-opencv" links to target
    "ReactAndroid::folly_runtime" but the target was not found.  Perhaps a
    find_package() call is missing for an IMPORTED target, or an ALIAS target
    is missing?
  
  
  CMake Error at CMakeLists.txt:13 (add_library):
    Target "react-native-fast-opencv" links to target "ReactAndroid::glog" but
    the target was not found.  Perhaps a find_package() call is missing for an
    IMPORTED target, or an ALIAS target is missing?
  
  
  CMake Error at CMakeLists.txt:13 (add_library):
    Target "react-native-fast-opencv" links to target
    "ReactAndroid::reactnativejni" but the target was not found.  Perhaps a
    find_package() call is missing for an IMPORTED target, or an ALIAS target
    is missing?
  
  
  CMake Generate step failed.  Build files cannot be regenerated correctly. : com.android.ide.common.process.ProcessException: -- The C compiler identification is Clang 17.0.2
  -- The CXX compiler identification is Clang 17.0.2
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /Users/vrtechsol/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: /Users/vrtechsol/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Configuring done
  -- Generating done
  
  C++ build system [configure] failed while executing:
      /Users/vrtechsol/Library/Android/sdk/cmake/3.22.1/bin/cmake \
        -H/Users/vrtechsol/Documents/Projects/Derm_Pro/node_modules/react-native-fast-opencv/android \
        -DCMAKE_SYSTEM_NAME=Android \
        -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
        -DCMAKE_SYSTEM_VERSION=24 \
        -DANDROID_PLATFORM=android-24 \
        -DANDROID_ABI=arm64-v8a \
        -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a \
        -DANDROID_NDK=/Users/vrtechsol/Library/Android/sdk/ndk/26.1.10909125 \
        -DCMAKE_ANDROID_NDK=/Users/vrtechsol/Library/Android/sdk/ndk/26.1.10909125 \
        -DCMAKE_TOOLCHAIN_FILE=/Users/vrtechsol/Library/Android/sdk/ndk/26.1.10909125/build/cmake/android.toolchain.cmake \
        -DCMAKE_MAKE_PROGRAM=/Users/vrtechsol/Library/Android/sdk/cmake/3.22.1/bin/ninja \
        "-DCMAKE_CXX_FLAGS=-O2 -frtti -fexceptions -Wall -fstack-protector-all" \
        -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/vrtechsol/Documents/Projects/Derm_Pro/node_modules/react-native-fast-opencv/android/build/intermediates/cxx/Debug/25j621p1/obj/arm64-v8a \
        -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/Users/vrtechsol/Documents/Projects/Derm_Pro/node_modules/react-native-fast-opencv/android/build/intermediates/cxx/Debug/25j621p1/obj/arm64-v8a \
        -DCMAKE_BUILD_TYPE=Debug \
        -DCMAKE_FIND_ROOT_PATH=/Users/vrtechsol/Documents/Projects/Derm_Pro/node_modules/react-native-fast-opencv/android/.cxx/Debug/25j621p1/prefab/arm64-v8a/prefab \
        -B/Users/vrtechsol/Documents/Projects/Derm_Pro/node_modules/react-native-fast-opencv/android/.cxx/Debug/25j621p1/arm64-v8a \
        -GNinja \
        -DANDROID_STL=c++_shared \
        -DNODE_MODULES_DIR=/Users/vrtechsol/Documents/Projects/Derm_Pro/node_modules
    from /Users/vrtechsol/Documents/Projects/Derm_Pro/node_modules/react-native-fast-opencv/android
  CMake Error at CMakeLists.txt:13 (add_library):
    Target "react-native-fast-opencv" links to target
    "ReactAndroid::folly_runtime" but the target was not found.  Perhaps a
    find_package() call is missing for an IMPORTED target, or an ALIAS target
    is missing?
  
  
  CMake Error at CMakeLists.txt:13 (add_library):
    Target "react-native-fast-opencv" links to target "ReactAndroid::glog" but
    the target was not found.  Perhaps a find_package() call is missing for an
    IMPORTED target, or an ALIAS target is missing?
  
  
  CMake Error at CMakeLists.txt:13 (add_library):
    Target "react-native-fast-opencv" links to target
    "ReactAndroid::reactnativejni" but the target was not found.  Perhaps a
    find_package() call is missing for an IMPORTED target, or an ALIAS target
    is missing?

重现步骤:

  1. 按照react-native-fast-opencv的设置说明进行操作。
  2. 尝试使用
    npx react-native run-android
    yarn android
  3. 构建项目

附加信息

库版本:“react-native-fast-opencv”:“^0.3.1”, React Native版本:“react-native”:“0.76.1”, 节点版本:v18.18.0 纱线版本:3.6.4 Xcode 版本:16.0 版 macOS 版本:15.0.0

react-native opencv cmake
1个回答
0
投票

我能够通过

解决问题

任务:react-native-fast-opencv:configureCMakeDebug[arm64-v8a]失败

终端中 android 构建过程中出现错误。

当我运行命令

yarn android
时,问题与在调试版本期间使用react native(0.76.1)的react-native-fast-opencv版本(^0.3.1)有关。

联系库维护者后,他们指出该问题已在 v0.3.2 版本中修复。

我更新到这个新版本,错误已成功解决。

解决方案:

更新react-native-fast-opencv到v0.3.2或以上版本并运行命令

yarn android

npx react-native run-android

希望这可以帮助其他遇到同样问题的人!

© www.soinside.com 2019 - 2024. All rights reserved.