Ask Your Question
0

I am Trying to cross compiling OpenCV application statically by using following command

asked 2018-07-18 02:03:15 -0500

$ cmake -DCMAKE_TOOLCHAIN_FILE=../riscv.toolchain.cmake ../../.. -DWITH_PNG=OF -DBUILD_SHARED_LIBS=OFF -DCMAKE_EXE_LINKER_FLAGS="-static" .

I am getting error as below

../../lib/libopencv_core.a(opencl_core.cpp.o): In function GetHandle(char const*)': opencl_core.cpp:(.text._ZL9GetHandlePKc+0xc): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/bin/ld: attempted static link of dynamic object/usr/local/lib/libz.so' collect2: error: ld returned 1 exit status apps/version/CMakeFiles/opencv_version.dir/build.make:96: recipe for target 'bin/opencv_version' failed make[2]: * [bin/opencv_version] Error 1

Please help me regarding this error.

Thanks in advance

edit retag flag offensive close merge delete

Comments

have you tried -DBUILD_ZLIB=ON ? (so it will build it's own, static zlib, instead of relying on your system's libz.so)

also, you probably meant: -DWITH_PNG=OFF (typo?)

then, please do not run cmake from the src folder, but make a "build" folder, and cd into that. (else it is next to impossible to clean up !)

berak gravatar imageberak ( 2018-07-18 02:26:19 -0500 )edit

cmake -DCMAKE_TOOLCHAIN_FILE=../riscv.toolchain.cmake ../../..cmake -DCMAKE_TOOLCHAIN_FILE=../riscv.toolchain.cmake ../../.. -DWITH_PNG=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_ZLIB=ON -DWITH_PNG=OFF -DCMAKE_EXE_LINKER_FLAGS="-static"

Even after adding -DBUILD_ZLIB=ON also i am getting same error:

../../lib/libopencv_core.a(opencl_core.cpp.o): In function GetHandle(char const*)': opencl_core.cpp:(.text._ZL9GetHandlePKc+0xc): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/bin/ld: attempted static link of dynamic object/usr/lib/x86_64-linux-gnu/libjpeg.so' collect2: error: ld returned 1 exit status apps/visualisation/CMakeFiles/opencv_visualisation.dir/build.make:110: recipe for target 'bin/ope

Billa Surendra gravatar imageBilla Surendra ( 2018-07-18 03:39:40 -0500 )edit

please put msgs like that into your question, where it can be properly formatted.

and you want to use -DBUILD_JPEG=ON -DBUILD_TIFF=ON, etc. for ALL your image codecs required or disable them entirely like -DWITH_JPEG=OFF

berak gravatar imageberak ( 2018-07-18 03:43:55 -0500 )edit

idk, what to do about the opencl warning. you probably do not have a static opencl lib.

berak gravatar imageberak ( 2018-07-18 03:49:56 -0500 )edit

Now I am getting some other error of the same fashion.

../../lib/libopencv_core.a(opencl_core.cpp.o): In function GetHandle(char const*)': opencl_core.cpp:(.text._ZL9GetHandlePKc+0xc): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/bin/ld: attempted static link of dynamic object/usr/lib/x86_64-linux-gnu/libtiff.so' collect2: error: ld returned 1 exit status apps/annotation/CMakeFiles/opencv_annotation.dir/build.make:108: recipe for target 'bin/opencv_annotation' failed make[2]: * [bin/opencv_annotation] Error 1 CMakeFiles/Makefile2:4238: recipe for target 'apps/annotation/CMakeFiles/opencv_annotation.dir/all' failed make[1]: * [apps/annotation/CMakeFiles/opencv_annotation.dir/all] Error

Billa Surendra gravatar imageBilla Surendra ( 2018-07-18 04:19:26 -0500 )edit

and the answer is still the same -- either build the 3rd party version or disable it.

berak gravatar imageberak ( 2018-07-18 04:27:28 -0500 )edit

I am successfully cross compiled opencv for riscv architecture statically.now i am trying to run opencv application but i am getting error.please help me. error :- /usr/bin/ld: skipping incompatible /home/billa/Documents/opencv/platforms/linux/build_riscv/install/lib/libopencv_ml.a when searching for -lopencv_ml /usr/bin/ld: skipping incompatible /home/billa/Documents/opencv/platforms/linux/build_riscv/install/lib/libopencv_videostab.a when searching for -lopencv_videostab /usr/bin/ld: skipping incompatible /home/billa/Documents/opencv/platforms/linux/build_riscv/install/lib/libopencv_stitching.a when searching for -lopencv_stitching /usr/bin/ld: skipping incompatible /home/billa/Documents/opencv/platforms/linux/build_riscv/install/lib/libopencv_calib3d.a when searching for -lopencv_cali

Billa Surendra gravatar imageBilla Surendra ( 2018-07-18 23:59:00 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-08-07 04:44:43 -0500

Thanks..now I am able to cross compiling opencv library for riscv and also I can able to run opencv applications on riscv linux

edit flag offensive delete link more

Comments

Hi surendra,

Can you please send the solution, how you solved the below issue. error :- /usr/bin/ld: skipping incompatible /home/billa/Documents/opencv/platforms/linux/build_riscv/install/lib/libopencv_ml.a when searching for -lopencv_ml

Thanks, Ram.

ramthota gravatar imageramthota ( 2019-03-11 05:55:19 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-07-18 02:03:15 -0500

Seen: 234 times

Last updated: Jul 18 '18