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: undefined reference to cv::dnn: 看起来找不到 cvv, std, 库, 该怎么办? #19

Open
xbeofrenz opened this issue Oct 25, 2018 · 10 comments

Comments

@xbeofrenz
Copy link

使用 Android Studio 尝试编造, 显示以下错误, 看起来找不到 cvv, std, 库, 该怎么办?

Error while executing process C:\Users\Wesley\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {--build D:\WorkingDirectory\MyStudy\Zeusee-Face-Anti-spoofing-master\Prj-Android-full-src\app.externalNativeBuild\cmake\debug\armeabi-v7a --target native-lib}
[1/1] Linking CXX shared library ........\build\intermediates\cmake\debug\obj\armeabi-v7a\libnative-lib.so
FAILED: cmd.exe /C "cd . && C:\Users\Wesley\AppData\Local\Android\Sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=armv7-none-linux-androideabi --gcc-toolchain=C:/Users/Wesley/AppData/Local/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64 --sysroot=C:/Users/Wesley/AppData/Local/Android/Sdk/ndk-bundle/sysroot -fPIC -isystem C:/Users/Wesley/AppData/Local/Android/Sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi -D__ANDROID_API__=22 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Wa,--noexecstack -Wformat -Werror=format-security -std=c++11 -std=c++11 -frtti -fexceptions -O0 -fno-limit-debug-info -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a -nostdlib++ --sysroot C:/Users/Wesley/AppData/Local/Android/Sdk/ndk-bundle/platforms/android-22/arch-arm -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--fix-cortex-a8 -Wl,--exclude-libs,libunwind.a -LC:/Users/Wesley/AppData/Local/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -shared -Wl,-soname,libnative-lib.so -o ........\build\intermediates\cmake\debug\obj\armeabi-v7a\libnative-lib.so @CMakeFiles/native-lib.rsp && cd ."
D:\WorkingDirectory\MyStudy\Zeusee-Face-Anti-spoofing-master\Prj-Android-full-src\app\src\main\cpp/AliveDetector.h:294: error: undefined reference to 'cv::dnn::experimental_dnn_v3::blobFromImages(std::__ndk1::vector<cv::Mat, std::ndk1::allocatorcv::Mat > const&, double, cv::Size, cv::Scalar const&, bool, bool)'
D:\WorkingDirectory\MyStudy\Zeusee-Face-Anti-spoofing-master\Prj-Android-full-src\app\src\main\cpp/AliveDetector.h:305: error: undefined reference to 'cv::dnn::experimental_dnn_v3::Net::forward(cv::_OutputArray const&, std::__ndk1::vector<cv::String, std::__ndk1::allocatorcv::String > const&)'
D:\WorkingDirectory\MyStudy\Zeusee-Face-Anti-spoofing-master\Prj-Android-full-src\app\src\main\cpp/AliveDetector.h:315: error: undefined reference to 'cv::dnn::experimental_dnn_v3::Net::forward(cv::_OutputArray const&, std::__ndk1::vector<cv::String, std::__ndk1::allocatorcv::String > const&)'
D:\WorkingDirectory\MyStudy\Zeusee-Face-Anti-spoofing-master\Prj-Android-full-src\app\src\main\cpp/AliveDetector.h:396: error: undefined reference to 'cv::dnn::experimental_dnn_v3::Net::forward(cv::_OutputArray const&, std::__ndk1::vector<cv::String, std::__ndk1::allocatorcv::String > const&)'

@panda-lab
Copy link

用opencv 3.4以上的版本

@xbeofrenz
Copy link
Author

我调用 opencv 3.4.3 还是一样

@panda-lab
Copy link

@xbeofrenz 根据你的错误,编译器找不到dnn模块,一个就是你opencv版本不对,你说用的3.4.3,那应该就是配置的路径不对,你搜索一下android上opencv的配置。如果还是不行留言我们协助解决。

@ZivenMan
Copy link

都没回答到点子上。

  1. 下载OpenCV3.4的android包,解压。
  2. 将/Prj-Android-full-src/app/CMakeLists.txt中的:
    set(OpenCV_DIR "/Users/yujinke/Downloads/OpenCV-android-sdk-3.4/sdk/native/jni")
    改成解压后相应的jni目录。

@wangchunkun
Copy link

按照楼上说的做了啊,还是不可以

@leeyixiang
Copy link

请问问题有解决吗?遇到同样的问题了

@panda-lab
Copy link

@yangkezun 帮忙看一下哈

@0xCTF
Copy link

0xCTF commented Feb 26, 2020

@leeyixiang i'm having the same problem, did you fixed it ? please let me know if you did
我遇到同样的问题,您解决了吗? 请让我知道你是否做了

@moshe5745
Copy link

Same here. Cant build the demo Prj-Android-full-src from the source code.

@moshe5745 moshe5745 mentioned this issue Jan 18, 2021
@moshe5745
Copy link

After i installed the right NDK => 16, I was able to build without errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants