Unable to cross compiling OpenCV based application program(face detection) for RISCV architecture
I have cross compiled OpenCV library to support multi core execution with "-DWITH_OPENMP=ON" option, cmake was built successfully but when i am going to cross compiling OpenCV applications (face detection) I am getting some errors.
Error:
/usr/bin/ld: skipping incompatible /home/billa/RISCV/OpenCV_multi_core_support/opencv-3.4.1/platforms/linux/riscv_build/install/lib/libopencv_ml.a when searching for -lopencv_ml
/usr/bin/ld: skipping incompatible /home/billa/RISCV/OpenCV_multi_core_support/opencv-3.4.1/platforms/linux/riscv_build/install/lib/libopencv_videostab.a when searching for -lopencv_videostab
/usr/bin/ld: skipping incompatible /home/billa/RISCV/OpenCV_multi_core_support/opencv-3.4.1/platforms/linux/riscv_build/install/lib/libopencv_stitching.a when searching for -lopencv_stitching
/usr/bin/ld: skipping incompatible /home/billa/RISCV/OpenCV_multi_core_support/opencv-3.4.1/platforms/linux/riscv_build/install/lib/libopencv_calib3d.a when searching for -lopencv_calib3d
/usr/bin/ld: skipping incompatible /home/billa/RISCV/OpenCV_multi_core_support/opencv-3.4.1/platforms/linux/riscv_build/install/lib/libopencv_shape.a when searching for -lopencv_shape
/usr/bin/ld: skipping incompatible /home/billa/RISCV/OpenCV_multi_core_support/opencv-3.4.1/platforms/linux/riscv_build/install/lib/libopencv_objdetect.a when searching for -lopencv_objdetect
/usr/bin/ld: skipping incompatible /home/billa/RISCV/OpenCV_multi_core_support/opencv-3.4.1/platforms/linux/riscv_build/install/lib/libopencv_features2d.a when searching for -lopencv_features2d
/usr/bin/ld: skipping incompatible /home/billa/RISCV/OpenCV_multi_core_support/opencv-3.4.1/platforms/linux/riscv_build/install/lib/libopencv_flann.a when searching for -lopencv_flann
/usr/bin/ld: skipping incompatible /home/billa/RISCV/OpenCV_multi_core_support/opencv-3.4.1/platforms/linux/riscv_build/install/lib/libopencv_superres.a when searching for -lopencv_superres
/usr/bin/ld: skipping incompatible /home/billa/RISCV/OpenCV_multi_core_support/opencv-3.4.1/platforms/linux/riscv_build/install/lib/libopencv_highgui.a when searching for -lopencv_highgui
/usr/bin/ld: skipping incompatible /home/billa/RISCV/OpenCV_multi_core_support/opencv-3.4.1/platforms/linux/riscv_build/install/lib/libopencv_videoio.a when searching for -lopencv_videoio
/usr/bin/ld: skipping incompatible /home/billa/RISCV/OpenCV_multi_core_support/opencv-3.4.1/platforms/linux/riscv_build/install/lib/libopencv_imgcodecs.a when searching for -lopencv_imgcodecs
/usr/bin/ld: skipping incompatible /home/billa/RISCV/OpenCV_multi_core_support/opencv-3.4.1/platforms/linux/riscv_build/install/lib/libopencv_photo.a when searching for -lopencv_photo
/usr/bin/ld: skipping incompatible /home/billa/RISCV/OpenCV_multi_core_support/opencv-3.4.1/platforms/linux/riscv_build/install/lib/libopencv_video.a when searching for -lopencv_video
/usr/bin/ld: skipping incompatible /home/billa/RISCV/OpenCV_multi_core_support/opencv-3.4.1/platforms/linux/riscv_build/install/lib/libopencv_imgproc.a when searching for -lopencv_imgproc
/usr/bin/ld: skipping incompatible /home/billa/RISCV/OpenCV_multi_core_support/opencv-3.4.1/platforms/linux/riscv_build/install/lib/libopencv_core.a when searching for -lopencv_core
/usr/bin/ld: skipping incompatible /home/billa/RISCV/OpenCV_multi_core_support/opencv-3.4.1/platforms/linux/riscv_build/install/share/OpenCV/3rdparty/lib/libzlib.a when searching for -lzlib
/usr/bin/ld: cannot find -lzlib
/usr/bin/ld: skipping incompatible /home/billa/RISCV/OpenCV_multi_core_support/opencv-3.4.1/platforms/linux/riscv_build/install/share/OpenCV/3rdparty/lib/liblibjpeg.a when searching for -llibjpeg
/usr/bin/ld: cannot find -llibjpeg
/usr/bin/ld: skipping incompatible /home/billa/RISCV/OpenCV_multi_core_support/opencv-3.4.1/platforms/linux /riscv_build/install/share/OpenCV/3rdparty/lib/liblibwebp.a when searching for -llibwebp
/usr/bin/ld: cannot find ...
Looks like your OpenCV build was wrong, maybe it was not cross-compiled. You should check cmake output and verify compiler/libraries/sysroot. Did you use cmake toolchain file?
OpenCV cross compiled successfully with riscv cmake toolchain, but when i am executing OpenCV application I am getting above mentioned errors.
Command which I used to cross compiling OpenCV library: 1.$ cmake -DCMAKE_TOOLCHAIN_FILE=../riscv.toolchain.cmake ../../.. -DWITH_PNG=OFF -DWITH_OPENEXR=OFF -DWITH_OPENMP=ON -DBUILD_OPENEXR=OFF -DBUILD_opencv_dnn=OFF -DBUILD_ZLIB=ON -DBUILD_EXAMPLES=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_EXE_LINKER_FLAGS="-static" 2. $ make -j8 3. $ make install These all steps are successfully done. Please can any one help me above mentioned error. Thanks in advance
In above command if I am trying to disable -DWITH_OPENCL=OFF and I am trying to enable -DWITH_OPENMP=ON but with this option my cross compilation for RISC-V was not successful.
Thanks for helping me, my problem solved by adding --static -lzlib when cross compiling OpenCV application.