Cannot build android opencv based on x86 NDK (Bug #2684)


Added by Yao Weifeng about 12 years ago. Updated about 12 years ago.


Status:Cancelled Start date:
Priority:Normal Due date:
Assignee:Andrey Kamaev % Done:

0%

Category:android
Target version:2.4.4
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

Sync opencv git to latest, and build Opencv4Android by following http://code.opencv.org/projects/opencv/wiki/Building_OpenCV4Android_from_trunk.

And while I configure using cmake_android_x86.sh to build NDK for x86 platform, error showed undefined reference to 'posix_memalign' as following:
"
[ 85%] Built target opencv_test_legacy
[ 85%] Building CXX object modules/java/CMakeFiles/opencv_java.dir/highgui.cpp.o
[ 85%] Building CXX object modules/java/CMakeFiles/opencv_java.dir/ml.cpp.o
[ 85%] Building CXX object modules/java/CMakeFiles/opencv_java.dir/calib3d.cpp.o
[ 85%] Building CXX object modules/java/CMakeFiles/opencv_java.dir/photo.cpp.o
[ 85%] Building CXX object modules/java/CMakeFiles/opencv_java.dir/contrib.cpp.o
Linking CXX shared library ../../lib/x86/libopencv_java.so
/workshop2/android-ndk-linux/toolchains/x86-4.6/prebuilt/linux-x86/bin/../lib/gcc/i686-linux-android/4.6/../../../../i686-linux-android/bin/ld.gold: ../../lib/x86/libopencv_contrib.a(rgbdodometry.cpp.o): in function Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >::resize(int, int):rgbdodometry.cpp(.text._ZN5Eigen15PlainObjectBaseINS_6MatrixIdLin1ELin1ELi0ELin1ELin1EEEE6resizeEii+0xaf): error: undefined reference to 'posix_memalign'
/workshop2/android-ndk-linux/toolchains/x86-4.6/prebuilt/linux-x86/bin/../lib/gcc/i686-linux-android/4.6/../../../../i686-linux-android/bin/ld.gold: ../../lib/x86/libopencv_contrib.a(rgbdodometry.cpp.o): in function void Eigen::internal::gemv_selector<2, 0, true>::run<Eigen::GeneralProduct<Eigen::Block<Eigen::Matrix<double, -1, -1, 0, -1, -1>, -1, -1, false, true>, Eigen::Block<Eigen::Matrix<double, -1, 1, 0, -1, 1>, -1, 1, false, true>, 4>, Eigen::Block<Eigen::Matrix<double, -1, -1, 0, -1, -1>, -1, 1, false, true> >(Eigen::GeneralProduct<Eigen::Block<Eigen::Matrix<double, -1, -1, 0, -1, -1>, -1, -1, false, true>, Eigen::Block<Eigen::Matrix<double, -1, 1, 0, -1, 1>, -1, 1, false, true>, 4> const&, Eigen::Block<Eigen::Matrix<double, -1, -1, 0, -1, -1>, -1, 1, false, true>&, Eigen::GeneralProduct<Eigen::Block<Eigen::Matrix<double, -1, -1, 0, -1, -1>, -1, -1, false, true>, Eigen::Block<Eigen::Matrix<double, -1, 1, 0, -1, 1>, -1, 1, false, true>, 4>::Scalar):rgbdodometry.cpp(.text._ZN5Eigen8internal13gemv_selectorILi2ELi0ELb1EE3runINS_14GeneralProductINS_5BlockINS_6MatrixIdLin1ELin1ELi0ELin1ELin1EEELin1ELin1ELb0ELb1EEENS5_INS6_IdLin1ELi1ELi0ELin1ELi1EEELin1ELi1ELb0ELb1EEELi4EEENS5_IS7_Lin1ELi1ELb0ELb1EEEEEvRKT_RT0_NSD_6ScalarE+0x108): error: undefined reference to 'posix_memalign'
/workshop2/android-ndk-linux/toolchains/x86-4.6/prebuilt/linux-x86/bin/../lib/gcc/i686-linux-android/4.6/../../../../i686-linux-android/bin/ld.gold: ../../lib/x86/libopencv_contrib.a(rgbdodometry.cpp.o): in function Eigen::LDLT<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 1>::compute(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&):rgbdodometry.cpp(.text._ZN5Eigen4LDLTINS_6MatrixIdLin1ELin1ELi0ELin1ELin1EEELi1EE7computeERKS2_+0x100): error: undefined reference to 'posix_memalign'
/workshop2/android-ndk-linux/toolchains/x86-4.6/prebuilt/linux-x86/bin/../lib/gcc/i686-linux-android/4.6/../../../../i686-linux-android/bin/ld.gold: ../../lib/x86/libopencv_contrib.a(rgbdodometry.cpp.o): in function Eigen::LDLT<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 1>::compute(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&):rgbdodometry.cpp(.text._ZN5Eigen4LDLTINS_6MatrixIdLin1ELin1ELi0ELin1ELin1EEELi1EE7computeERKS2_+0x1c5): error: undefined reference to 'posix_memalign'
collect2: ld returned 1 exit status
make2: * [lib/x86/libopencv_java.so] Error 1
make1:
[modules/java/CMakeFiles/opencv_java.dir/all] Error 2
make: *
* [all] Error 2
"

Seems it's only a x86 platform issue, since if I configure to use armeabi, it can build pass.


compile.log (3.3 kB) Yao Weifeng, 2013-01-08 06:31 am


Associated revisions

Revision 849228ac
Added by Alexander Alekhin almost 11 years ago

Merge pull request #2684 from ElenaGvozdeva:ippiDFT

History

Updated by Andrey Pavlenko about 12 years ago

I wasn't able to reproduce your problem with NDK r8c and '2.4' git branch that we recommend to use, the 'Android x86' build completed successfully.

  • Category set to android
  • Assignee set to Yao Weifeng
  • Start date deleted (2013-01-08)

Updated by Andrey Kamaev about 12 years ago

It is actually a problem of Eigen library. Pass -DWITH_EIGEN=OFF argument to cmake command to compile without Eigen and avoid this error

  • Assignee changed from Yao Weifeng to Andrey Kamaev
  • Target version set to 2.4.4
  • Status changed from Open to Cancelled

Also available in: Atom PDF