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

undefined reference to cv::FAST when build using cmake and make #6

Open
PapaMadeleine2022 opened this issue Sep 3, 2019 · 8 comments

Comments

@PapaMadeleine2022
Copy link

hello,
when I build your code using cmake and make in app folder, it shows error:

/xxx/ORB-SLAM2-based-AR-on-Android/app/src/main/cpp/ORB/src/ORBextractor.cc:812: undefined reference to `cv::FAST(cv::_InputArray const&, std::__ndk1::vector<cv::KeyPoint, std::__ndk1::allocator<cv::KeyPoint> >&, int, bool)'
/xxx/ORB-SLAM2-based-AR-on-Android/app/src/main/cpp/ORB/src/ORBextractor.cc:817: undefined reference to `cv::FAST(cv::_InputArray const&, std::__ndk1::vector<cv::KeyPoint, std::__ndk1::allocator<cv::KeyPoint> >&, int, bool)'
libORBSLAM2.a(ORBextractor.cc.o): In function `ORB_SLAM2::ORBextractor::ComputeKeyPointsOctTree(std::__ndk1::vector<std::__ndk1::vector<cv::KeyPoint, std::__ndk1::allocator<cv::KeyPoint> >, std::__ndk1::allocator<std::__ndk1::vector<cv::KeyPoint, std::__ndk1::allocator<cv::KeyPoint> > > >&)':
/xxx/ORB-SLAM2-based-AR-on-Android/app/src/main/cpp/ORB/src/ORBextractor.cc:917: undefined reference to `cv::FAST(cv::_InputArray const&, std::__ndk1::vector<cv::KeyPoint, std::__ndk1::allocator<cv::KeyPoint> >&, int, bool)'
/xxx/ORB-SLAM2-based-AR-on-Android/app/src/main/cpp/ORB/src/ORBextractor.cc:922: undefined reference to `cv::FAST(cv::_InputArray const&, std::__ndk1::vector<cv::KeyPoint, std::__ndk1::allocator<cv::KeyPoint> >&, int, bool)'
libORBSLAM2.a(ORBextractor.cc.o): In function `ORB_SLAM2::ORBextractor::ComputeKeyPointsOld(std::__ndk1::vector<std::__ndk1::vector<cv::KeyPoint, std::__ndk1::allocator<cv::KeyPoint> >, std::__ndk1::allocator<std::__ndk1::vector<cv::KeyPoint, std::__ndk1::allocator<cv::KeyPoint> > > >&)':
/xxx/ORB-SLAM2-based-AR-on-Android/app/src/main/cpp/ORB/src/ORBextractor.cc:1045: undefined reference to `cv::FAST(cv::_InputArray const&, std::__ndk1::vector<cv::KeyPoint, std::__ndk1::allocator<cv::KeyPoint> >&, int, bool)'
libORBSLAM2.a(ORBextractor.cc.o):/search/odin/gongzhenting/work/image/slam/ORB-SLAM2-based-AR-on-Android/app/src/main/cpp/ORB/src/ORBextractor.cc:1051: more undefined references to `cv::FAST(cv::_InputArray const&, std::__ndk1::vector<cv::KeyPoint, std::__ndk1::allocator<cv::KeyPoint> >&, int, bool)' follow
libORBSLAM2.a(ORBextractor.cc.o): In function `ORB_SLAM2::ORBextractor::ComputeKeyPointsOld(std::__ndk1::vector<std::__ndk1::vector<cv::KeyPoint, std::__ndk1::allocator<cv::KeyPoint> >, std::__ndk1::allocator<std::__ndk1::vector<cv::KeyPoint, std::__ndk1::allocator<cv::KeyPoint> > > >&)':
/xxx/ORB-SLAM2-based-AR-on-Android/app/src/main/cpp/ORB/src/ORBextractor.cc:1116: undefined reference to `cv::KeyPointsFilter::retainBest(std::__ndk1::vector<cv::KeyPoint, std::__ndk1::allocator<cv::KeyPoint> >&, int)'
/xxx/ORB-SLAM2-based-AR-on-Android/app/src/main/cpp/ORB/src/ORBextractor.cc:1134: undefined reference to `cv::KeyPointsFilter::retainBest(std::__ndk1::vector<cv::KeyPoint, std::__ndk1::allocator<cv::KeyPoint> >&, int)'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [out/arm64-v8a/libnative-lib.so] Error 1

my build.sh in /xxx/ORB-SLAM2-based-AR-on-Android/app/build folder is:

NDK_PATH=/yyy/android-ndk-r19c/
BUILD_PATH="arm64-v8a"

cmake \
-H".." \
-B"$BUILD_PATH" \
-DANDROID_ABI="arm64-v8a" \
-DANDROID_NDK=$NDK_PATH \
-DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_TOOLCHAIN_FILE="$NDK_PATH/build/cmake/android.toolchain.cmake" \
-DANDROID_PLATFORM="android-21" \
-DANDROID_TOOLCHAIN="clang" \
-DCMAKE_C_FLAGS="-fpic -fexceptions -frtti" \
-DCMAKE_CXX_FLAGS="-fpic -fexceptions -frtti" \
-DANDROID_STL="c++_shared" \

cd arm64-v8a
make -j8 

And I have tried opencv-3.4.7-android-sdk or opencv-3.0.0-android-sdk.

How to fix the error?
Can you give some advises?
Thanks

@PapaMadeleine2022 PapaMadeleine2022 changed the title undefined reference to cv::FAST undefined reference to cv::FAST when build using cmake and make Sep 3, 2019
@FedorovPavel
Copy link

FedorovPavel commented Sep 3, 2019

Hello,
I'am using:
ndk v16.1.4479499
cmake 3.10.2
3.2.0 which included in project
to build an application and it is works.

I attach my "./app/build.gradle"(with "txt" format) and "./app/CMakeLists.txt" for pure project
CMakeLists.txt

build.gradle.txt

@PapaMadeleine2022
Copy link
Author

@FedorovPavel thanks for your reply. What version is the OpenCV-android-sdk you use ?

@FedorovPavel
Copy link

@IvyGongoogle 3.2.0. I tried to use 2.4.9 - on new versions android does not work.
And in newer versions are missing the necessary methods or interface has changed

@PapaMadeleine2022
Copy link
Author

@FedorovPavel Thanks. Now I also AS to build this project with gradle, and it works. But I would like to know how do compile the app code using cmake and make with the app/CMakeList.txt. Do you have any advises?

@FedorovPavel
Copy link

@IvyGongoogle Sorry, I can’t help with the build with cmake and make =(

@PapaMadeleine2022
Copy link
Author

@FedorovPavel Thank you too.

@BruceYu-Bit
Copy link

@FedorovPavel Thanks. Now I also AS to build this project with gradle, and it works. But I would like to know how do compile the app code using cmake and make with the app/CMakeList.txt. Do you have any advises?

why i am not work.i am using opencv 3.2

@maximaging
Copy link
Contributor

maximaging commented Oct 8, 2021

Hi @BruceYu-Bit , in case you are still interested, I addressed the compilation issues related to OpenCV 3.2.0 on my fork and submitted a pull request with all the changes: #16.

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

4 participants