Hi,
The OpenCV version is 4.6.0-dev
My system is Ubuntu 20.04
I’m using RISCV GNU Toolchain.
I can run the basic image processing codes with gcc and RISCV but when I’m trying to compile the Googlenet sample code in this link I have got this errors.
Even when I try to compile the code with gcc or RISCV, I got the same linker error.
gcc main.cpp -o sone -I /home/anil/Desktop/project/opencv/include/ -I /home/anil/Desktop/project/opencv/modules/core/include -I /home/anil/Desktop/project/opencv/build/install/include/opencv4 -I /home/anil/Desktop/project/opencv/modules/core/include/opencv2 -I /home/anil/Desktop/project/riscv-gnu-toolchain/gdb/zlib -I /home/anil/Desktop/deneme/gitdene/cnpy/ -I /usr/include/mkl -L/home/anil/Desktop/project/opencv/build/lib -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -I /home/anil/Desktop/project/opencv/samples/dnn/ -I/usr/local/cuda/include
/bin/ld: skipping incompatible /home/anil/Desktop/project/opencv/build/lib/libopencv_core.so when searching for -lopencv_core
/bin/ld: cannot find -lopencv_core
/bin/ld: skipping incompatible /home/anil/Desktop/project/opencv/build/lib/libopencv_imgcodecs.so when searching for -lopencv_imgcodecs
/bin/ld: cannot find -lopencv_imgcodecs
/bin/ld: skipping incompatible /home/anil/Desktop/project/opencv/build/lib/libopencv_imgproc.so when searching for -lopencv_imgproc
/bin/ld: cannot find -lopencv_imgproc
collect2: error: ld returned 1 exit status
riscv64-unknown-linux-gnu-g++ main.cpp -o sone -I /home/anil/Desktop/project/opencv/include/ -I /home/anil/Desktop/project/opencv/modules/core/include -I /home/anil/Desktop/project/opencv/build/install/include/opencv4 -I /home/anil/Desktop/project/opencv/modules/core/include/opencv2 -I /home/anil/Desktop/project/riscv-gnu-toolchain/gdb/zlib -I /home/anil/Desktop/deneme/gitdene/cnpy/ -I /usr/include/mkl -L/home/anil/Desktop/project/opencv/build/lib -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -I /home/anil/Desktop/project/opencv/samples/dnn/ -I/usr/local/cuda/include --static
/opt/riscv/lib/gcc/riscv64-unknown-linux-gnu/12.2.0/../../../../riscv64-unknown-linux-gnu/bin/ld: cannot find -lopencv_core: No such file or directory
/opt/riscv/lib/gcc/riscv64-unknown-linux-gnu/12.2.0/../../../../riscv64-unknown-linux-gnu/bin/ld: cannot find -lopencv_imgcodecs: No such file or directory
/opt/riscv/lib/gcc/riscv64-unknown-linux-gnu/12.2.0/../../../../riscv64-unknown-linux-gnu/bin/ld: cannot find -lopencv_imgproc: No such file or directory
collect2: error: ld returned 1 exit status
The main problem is linker in the linker I think, but the LD_LİBRARY_PATH is defined as shown below
root@ubuntu:/home/anil/Desktop/googlenet# echo $LD_LIBRARY_PATH
/home/anil/Desktop/project/opencv/build/lib
and the inside of this path is:
root@ubuntu:/home/anil/Desktop/googlenet# ls /home/anil/Desktop/project/opencv/build/lib
libopencv_calib3d.so libopencv_dnn.so.4.6.0 libopencv_gapi.so.406 libopencv_imgproc.so libopencv_objdetect.so.4.6.0 libopencv_videoio.so
libopencv_calib3d.so.406 libopencv_features2d.so libopencv_gapi.so.4.6.0 libopencv_imgproc.so.406 libopencv_photo.so libopencv_videoio.so.406
libopencv_calib3d.so.4.6.0 libopencv_features2d.so.406 libopencv_highgui.so libopencv_imgproc.so.4.6.0 libopencv_photo.so.406 libopencv_videoio.so.4.6.0
libopencv_core.so libopencv_features2d.so.4.6.0 libopencv_highgui.so.406 libopencv_ml.so libopencv_photo.so.4.6.0 libopencv_video.so
libopencv_core.so.406 libopencv_flann.so libopencv_highgui.so.4.6.0 libopencv_ml.so.406 libopencv_stitching.so libopencv_video.so.406
libopencv_core.so.4.6.0 libopencv_flann.so.406 libopencv_imgcodecs.so libopencv_ml.so.4.6.0 libopencv_stitching.so.406 libopencv_video.so.4.6.0
libopencv_dnn.so libopencv_flann.so.4.6.0 libopencv_imgcodecs.so.406 libopencv_objdetect.so libopencv_stitching.so.4.6.0
libopencv_dnn.so.406 libopencv_gapi.so libopencv_imgcodecs.so.4.6.0 libopencv_objdetect.so.406 libopencv_ts.a
Do you have any suggestions?