/usr/bin/ld: cannot find -lopencv_xxxxx errors when compile a simple opencv c++ program

Dear Support,

After I just flashed the JetPack 4.3 in my Jetson AGX Xavier, I try to run a simple logo.cpp program to test the OpenCV4.1.1 in my system while I never had a problem for my Jetson TX2 on OpenCV3.4.0 version.

  1. Compile command

/usr/bin/g++ (or nvcc) -g -Wall pkg-config --libs --cflags opencv -std=c++11 -lstdc++ -lopencv_core -lopencv_highgui -lopencv_videoio -I/usr/include/opencv2 -L/usr/local/cuda-10.0/lib64 logo.cpp -o main.exe

  1. The Compile Error for the Library file load (which is defined by the file:
    /usr/share/visionworks/sources/opencv.pc

error messages

/usr/bin/ld: cannot find -lopencv_calib3d
/usr/bin/ld: cannot find -lopencv_contrib
/usr/bin/ld: cannot find -lopencv_features2d
/usr/bin/ld: cannot find -lopencv_flann
/usr/bin/ld: cannot find -lopencv_gpu
/usr/bin/ld: cannot find -lopencv_legacy
/usr/bin/ld: cannot find -lopencv_ml
/usr/bin/ld: cannot find -lopencv_objdetect
/usr/bin/ld: cannot find -lopencv_photo
/usr/bin/ld: cannot find -lopencv_stitching
/usr/bin/ld: cannot find -lopencv_superres
/usr/bin/ld: cannot find -lopencv_ts
/usr/bin/ld: cannot find -lopencv_video
/usr/bin/ld: cannot find -lopencv_videostab
/usr/bin/ld: cannot find -lopencv_facedetect
/usr/bin/ld: cannot find -lopencv_imuvstab
/usr/bin/ld: cannot find -lopencv_tegra
/usr/bin/ld: cannot find -lopencv_vstab
/usr/bin/ld: cannot find -lnppi

Can you please let me know where are those opencv_xxxx library files located (plus the libnppi.so)?

Or if you know better solution for this, please let me know as well.

Thanks so much
Jimmy

I will try to download the OpenCV4.1 Package and build from the source to see…

Please see this github issue:

You will probably need to modify whatever build script you are using if you need pkg-config support, however it’s deprecated, so there is no telling when it’ll stop working.

Hi,
You may rebuild OpenCV with -D OPENCV_GENERATE_PKGCONFIG=YES

A reference post:
https://devtalk.nvidia.com/default/topic/1047563/jetson-tx2/libargus-eglstream-to-nvivafilter/post/5403210/#5403210