兵马逐浪去,将象入海流。炮声震心动,惊起卧龙游。
我的博客园主页 --------- 我的知乎主页 --------- 我的github主页 --------- 我的csdn主页 --------- 我的新浪微博

build opencv in termux, when build opencv_waldboost_detector error in undefined reference to '__android_log_print' #2172

 

build opencv in termux, when build opencv_waldboost_detector error in undefined reference to '__android_log_print' #2172

 Open
 
 
wahyubram82 opened this issue on 30 Jun 2019 · 6 comments
 
 

Comments

@wahyubram82
 
 

wahyubram82 commented on 30 Jun 2019

i cannot build opencv in termux error when reach time to 'waldboost' part.
i copy the result with make VERBOSE=1, hope someone can told me how to fix it

make[2]: Entering directory '/data/data/com.termux/files/home/opencv/build'
[ 82%] Linking CXX executable ../../../../bin/opencv_waldboost_detector                                       cd /data/data/com.termux/files/home/opencv/build/modules/xobjdetect/tools/waldboost_detector && /data/data/com.termux/files/usr/bin/cmake -E cmake_link_script CMakeFiles/opencv_waldboost_detector.dir/link.txt --verbose=1
/data/data/com.termux/files/usr/bin/c++     -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -pthread -Qunused-arguments -ffunction-sections -fdata-sections    -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG    -Wl,--gc-sections   CMakeFiles/opencv_waldboost_detector.dir/waldboost_detector.cpp.o  -o ../../../../bin/opencv_waldboost_detector -Wl,-rpath,::::::::::::::::::::::::::::::::::::: ../../../../lib/libopencv_core.a ../../../../lib/libopencv_imgproc.a ../../../../lib/libopencv_imgcodecs.a ../../../../lib/libopencv_videoio.a ../../../../lib/libopencv_highgui.a ../../../../lib/libopencv_xobjdetect.a ../../../../lib/libopencv_videoio.a /data/data/com.termux/files/usr/lib/libavcodec.so /data/data/com.termux/files/usr/lib/libavformat.so /data/data/com.termux/files/usr/lib/libavutil.so /data/data/com.termux/files/usr/lib/libswscale.so /data/data/com.termux/files/usr/lib/libgthread-2.0.so /data/data/com.termux/files/usr/lib/libglib-2.0.so ../../../../lib/libopencv_imgcodecs.a /data/data/com.termux/files/usr/lib/libjpeg.so ../../../../3rdparty/lib/liblibwebp.a /data/data/com.termux/files/usr/lib/libpng.so /data/data/com.termux/files/usr/lib/libtiff.so ../../../../3rdparty/lib/liblibjasper.a ../../../../3rdparty/lib/libIlmImf.a ../../../../lib/libopencv_objdetect.a ../../../../lib/libopencv_calib3d.a ../../../../lib/libopencv_features2d.a ../../../../lib/libopencv_imgproc.a ../../../../lib/libopencv_flann.a ../../../../lib/libopencv_core.a /data/data/com.termux/files/usr/lib/libz.so /data/data/com.termux/files/usr/lib/libopenblas.so -ldl -lm -lpthread -lrt ../../../../3rdparty/lib/libtegra_hal.a ../../../../3rdparty/lib/libquirc.a
/data/data/com.termux/files/usr/bin/aarch64-linux-android-ld: ../../../../lib/libopencv_core.a(system.cpp.o): in function `cv::error(cv::Exception const&)':                                                                system.cpp:(.text._ZN2cv5errorERKNS_9ExceptionE+0x1ac): undefined reference to `__android_log_print'
/data/data/com.termux/files/usr/bin/aarch64-linux-android-ld: ../../../../lib/libopencv_core.a(logger.cpp.o): in function `cv::utils::logging::internal::writeLogMessage(cv::utils::logging::LogLevel, char const*)':       logger.cpp:(.text._ZN2cv5utils7logging8internal15writeLogMessageENS1_8LogLevelEPKc+0x4ec): undefined reference to `__android_log_print'                                                                                     clang-8: error: linker command failed with exit code 1 (use -v to see invocation)                             make[2]: *** [modules/xobjdetect/tools/waldboost_detector/CMakeFiles/opencv_waldboost_detector.dir/build.make:114: bin/opencv_waldboost_detector] Error 1
make[2]: Leaving directory '/data/data/com.termux/files/home/opencv/build'
make[1]: *** [CMakeFiles/Makefile2:4661: modules/xobjdetect/tools/waldboost_detector/CMakeFiles/opencv_waldboost_detector.dir/all] Error 2
make[1]: Leaving directory '/data/data/com.termux/files/home/opencv/build'
make: *** [Makefile:163: all] Error 2

 
 
@alalek alalek transferred this issue from opencv/opencv on 30 Jun 2019
@alalek
 
Contributor

alalek commented on 30 Jun 2019

if you don need that, then disable it here (comment or remove.


Unfortunately, we don't have builds (or environment setup) with mentioned configuration so we can't help with problem investigation.

Anyway, we can take a look on the clear reason of the problem and suggest some fix/workaround.
But please ensure that you are working with fresh code base (use latest releases).

 
 
@alalek alalek added the incomplete label on 30 Jun 2019
@wahyubram82
 
Author

wahyubram82 commented on 30 Jun 2019 • 

edited 

for a temporary, i comment the CMakefile.txt
then the make process continue until show another error. this is the result with VERBOSE=1

make[2]: Entering directory '/data/data/com.termux/files/home/opencv/build' [100%] Linking CXX executable ../../bin/opencv_annotation cd /data/data/com.termux/files/home/opencv/build/apps/annotation && /data/data/com.termux/files/usr/bin/cmake -E cmake_link_script CMakeFiles/opencv_annotation.dir/link.txt --verbose=1 /data/data/com.termux/files/usr/bin/c++ -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -pthread -Qunused-arguments -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG -Wl,--gc-sections CMakeFiles/opencv_annotation.dir/opencv_annotation.cpp.o -o ../../bin/opencv_annotation -Wl,-rpath,::::::::::::::::::::::::::::::::::::: -ldl -lm -lpthread -lrt ../../lib/libopencv_core.a ../../lib/libopencv_highgui.a ../../lib/libopencv_imgproc.a ../../lib/libopencv_imgcodecs.a ../../lib/libopencv_videoio.a ../../lib/libopencv_imgcodecs.a ../../lib/libopencv_imgproc.a ../../lib/libopencv_core.a -ldl -lm -lpthread -lrt /data/data/com.termux/files/usr/lib/libopenblas.so /data/data/com.termux/files/usr/lib/libjpeg.so /data/data/com.termux/files/usr/lib/libwebp.so /data/data/com.termux/files/usr/lib/libpng.so /data/data/com.termux/files/usr/lib/libtiff.so ../../3rdparty/lib/liblibjasper.a ../../3rdparty/lib/libIlmImf.a /data/data/com.termux/files/usr/lib/libz.so /data/data/com.termux/files/usr/lib/libavcodec.so /data/data/com.termux/files/usr/lib/libavformat.so /data/data/com.termux/files/usr/lib/libavutil.so /data/data/com.termux/files/usr/lib/libswscale.so ../../3rdparty/lib/libtegra_hal.a /data/data/com.termux/files/usr/lib/libgthread-2.0.so /data/data/com.termux/files/usr/lib/libglib-2.0.so /data/data/com.termux/files/usr/bin/aarch64-linux-android-ld: ../../lib/libopencv_core.a(system.cpp.o): in function cv::error(cv::Exception const&)': system.cpp:(.text._ZN2cv5errorERKNS_9ExceptionE+0x1ac): undefined reference to __android_log_print' /data/data/com.termux/files/usr/bin/aarch64-linux-android-ld: ../../lib/libopencv_core.a(logger.cpp.o): in function cv::utils::logging::internal::writeLogMessage(cv::utils::logging::LogLevel, char const*)': logger.cpp:(.text._ZN2cv5utils7logging8internal15writeLogMessageENS1_8LogLevelEPKc+0x4ec): undefined reference to __android_log_print' clang-8: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: *** [apps/annotation/CMakeFiles/opencv_annotation.dir/build.make:107: bin/opencv_annotation] Error 1 make[2]: Leaving directory '/data/data/com.termux/files/home/opencv/build' make[1]: *** [CMakeFiles/Makefile2:5921: apps/annotation/CMakeFiles/opencv_annotation.dir/all] Error 2 make[1]: Leaving directory '/data/data/com.termux/files/home/opencv/build' make: *** [Makefile:163: all] Error 2

I think it's a bit different from waldboost, need another help....

 
@alalek
 
Contributor

alalek commented on 30 Jun 2019

cmake -DBUILD_opencv_apps=OFF ... (should be OFF for Android builds by default).

We have never tried to build Android binaries on Android directly. This mode is just unsupported.
So We have no idea how many issues you will see during next steps.
Probably you should add -DANDROID=ON too.

Attach your CMakeCache.txt / CmakeVars.txt to initial post, may be community may help. Also put link on used tutorial if any.


BTW, In general, changing of CMake options requires clean CMake's cache (clean build directory) to avoid undefined behavior from messing with previous CMake calls.

 
@wahyubram82
 
Author

wahyubram82 commented on 1 Jul 2019 • 

edited 

sorry for late responses, it's too late last night.
it's the latest source code that i use.

i use android on samsung tab S5e.

i install termux and python (automaticly installed python version 3.7.3, when apt install python)
i download necessary dependencies.

like build_essential, tiff, jpeg library, etc, like build in linux, because i think termux is linux shell.
then download the latest opencv
build it.

btw, if i install anlinux on termux, i can install opencv without problem, but difficult to access the camera of my tablet. so my plan is install the opencv stright to termux to make easier acces camera with termux-am.

ok, back to the problem,
this is the command i use with cmake.
LDFLAGS=" -llog -lpython3" cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=$PREFIX -D INSTALL_PYTHON_EXAMPLES=OFF -D INSTALL_C_EXAMPLES=OFF -D OPENCV_ENABLE_NONFREE=ON -D OPENCV_EXTRA_MODULES_PATH=/data/data/com.termux/files/home/opencv_contrib/modules -D BUILD_opencv_python3=on -D BUILD_opencv_python2=off -D BUILD_EXAMPLES=OFF -D OPENCV_ENABLE_NONFREE:BOOL=ON -D WITH_TEST=OFF -D BUILD_PERF_TESTS=OFF -D WITH_PERF_TEST=OFF -D BUILD_TESTS=OFF -D WITH_LAPACK=OFF -DBUILD_opencv_apps=OFF -D ANDROID=OFF -D WITH1394=OFF -D WITH_VTK=OFF -D BUILD_ANDROID_EXAMPLES=OFF -D BUILD_ANDROID_PROJECTS=OFF -D WITH_CPUFEATURES=OFF -D ENABLE_NEON=ON -D ENABLE_VFPV3= ON -D INSTALL_PYTHON_EXAMPLES=OFF ..

already try with option: -D WITH_CPUFEATURES=ON

the clue is i should have libcpufeatures.so on my system
but base on this
i can build it stright to opencv. but still don't got any idea to do it.

the last error code:

make[2]: Entering directory '/data/data/com.termux/files/home/opencv/build'                         
[100%] Linking CXX shared module ../../lib/python3/cv2.cpython-37m.so                                
cd /data/data/com.termux/files/home/opencv/build/modules/python3 && /data/data/com.termux/files/usr/bin/cmake -E cmake_link_script CMakeFiles/opencv_python3.dir/link.txt --verbose=1                     
/data/data/com.termux/files/usr/bin/c++ -fPIC    -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -pthread -Qunused-arguments -ffunction-sections -fdata-sections    -fvisibility=hidden -fvisibility-inlines-hidden -Wno-unused-function -Wno-deprecated-declarations -Wno-overloaded-virtual -Wno-unused-private-field -Wno-undef -O3 -DNDEBUG  -DNDEBUG  -Wl,--exclude-libs=ALL -shared  -o ../../lib/python3/cv2.cpython-37m.so CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o -Wl,-rpath,::::::::::::::::::::::::::::::::::::: ../../lib/libopencv_core.a ../../lib/libopencv_flann.a ../../lib/libopencv_imgproc.a ../../lib/libopencv_ml.a ../../lib/libopencv_phase_unwrapping.a ../../lib/libopencv_photo.a ../../lib/libopencv_plot.a ../../lib/libopencv_quality.a ../../lib/libopencv_reg.a ../../lib/libopencv_surface_matching.a ../../lib/libopencv_xphoto.a ../../lib/libopencv_dnn.a ../../lib/libopencv_features2d.a ../../lib/libopencv_freetype.a ../../lib/libopencv_fuzzy.a ../../lib/libopencv_hfs.a ../../lib/libopencv_img_hash.a ../../lib/libopencv_imgcodecs.a ../../lib/libopencv_line_descriptor.a ../../lib/libopencv_saliency.a ../../lib/libopencv_videoio.a ../../lib/libopencv_calib3d.a ../../lib/libopencv_highgui.a ../../lib/libopencv_objdetect.a ../../lib/libopencv_rgbd.a ../../lib/libopencv_shape.a ../../lib/libopencv_structured_light.a ../../lib/libopencv_text.a ../../lib/libopencv_video.a ../../lib/libopencv_videostab.a ../../lib/libopencv_xfeatures2d.a ../../lib/libopencv_ximgproc.a ../../lib/libopencv_xobjdetect.a ../../lib/libopencv_aruco.a ../../lib/libopencv_bgsegm.a ../../lib/libopencv_bioinspired.a ../../lib/libopencv_ccalib.a ../../lib/libopencv_datasets.a ../../lib/libopencv_dpm.a ../../lib/libopencv_face.a ../../lib/libopencv_optflow.a ../../lib/libopencv_sfm.a ../../lib/libopencv_stitching.a ../../lib/libopencv_superres.a ../../lib/libopencv_tracking.a /data/data/com.termux/files/usr/lib/libfreetype.so /data/data/com.termux/files/usr/lib/libharfbuzz.so ../../lib/libopencv_phase_unwrapping.a ../../lib/libopencv_photo.a ../../lib/libopencv_objdetect.a ../../3rdparty/lib/libquirc.a ../../lib/libcorrespondence.a ../../lib/libmultiview.a ../../lib/libnumeric.a /data/data/com.termux/files/usr/lib/libglog.so /data/data/com.termux/files/usr/lib/libgflags.so ../../lib/libopencv_xfeatures2d.a ../../lib/libopencv_shape.a ../../lib/libopencv_optflow.a ../../lib/libopencv_ximgproc.a ../../lib/libopencv_plot.a ../../lib/libopencv_video.a ../../lib/libopencv_calib3d.a ../../lib/libopencv_datasets.a ../../lib/libopencv_text.a ../../lib/libopencv_ml.a ../../lib/libopencv_dnn.a ../../3rdparty/lib/liblibprotobuf.a ../../lib/libopencv_features2d.a ../../lib/libopencv_flann.a ../../lib/libopencv_highgui.a ../../lib/libopencv_videoio.a ../../lib/libopencv_imgcodecs.a ../../lib/libopencv_imgproc.a ../../lib/libopencv_core.a /data/data/com.termux/files/usr/lib/libopenblas.so -llibcpufeatures /data/data/com.termux/files/usr/lib/libjpeg.so /data/data/com.termux/files/usr/lib/libwebp.so /data/data/com.termux/files/usr/lib/libpng.so /data/data/com.termux/files/usr/lib/libtiff.so ../../3rdparty/lib/liblibjasper.a ../../3rdparty/lib/libIlmImf.a /data/data/com.termux/files/usr/lib/libz.so /data/data/com.termux/files/usr/lib/libavcodec.so /data/data/com.termux/files/usr/lib/libavformat.so /data/data/com.termux/files/usr/lib/libavutil.so /data/data/com.termux/files/usr/lib/libswscale.so /data/data/com.termux/files/usr/lib/libgthread-2.0.so /data/data/com.termux/files/usr/lib/libglib-2.0.so -ldl -lm -lpthread -lrt ../../3rdparty/lib/libtegra_hal.a    /data/data/com.termux/files/usr/bin/aarch64-linux-android-ld: cannot find -llibcpufeatures           
clang-8: error: linker command failed with exit code 1 (use -v to see invocation)                    
make[2]: *** [modules/python3/CMakeFiles/opencv_python3.dir/build.make:174: lib/python3/cv2.cpython-37m.so] Error 1                                                                                       
make[2]: Leaving directory '/data/data/com.termux/files/home/opencv/build'                           
make[1]: *** [CMakeFiles/Makefile2:5796: modules/python3/CMakeFiles/opencv_python3.dir/all] Error 2  make[1]: Leaving directory '/data/data/com.termux/files/home/opencv/build'                           
make: *** [Makefile:163: all] Error 2`

it already reach 100% process...just a litle bit more, it will installed on termux

i think in the future, coding in linux on android device will be more popular. so i try to start it from now

 
@ixiDev
 
 

ixiDev commented on 27 Dec 2021

Screenshot_2021-12-27-01-32-08-425_com.termux.jpg

if someone still interested I have successfully build it and install it

 
@lukasloetkolben
 
 

lukasloetkolben commented 14 days ago

Screenshot_2021-12-27-01-32-08-425_com.termux.jpg

if someone still interested I have successfully build it and install it

how did you installed it?

 

posted @ 2022-03-23 17:13  leoking01  阅读(229)  评论(0编辑  收藏  举报
#back-to-top { background-color: #00CD00; bottom: 0; box-shadow: 0 0 6px #00CD00; color: #444444; padding: 10px 10px; position: fixed; right: 50px; cursor: pointer; }