Incorrect RPATH for libopencv_cudalegacy.so on Linux
cocoa-xu opened this issue · comments
libopencv_cudalegacy.so
is a dependency of libopencv_stitching.so
.
ldd
shows that
$ ldd evision.so
...
libopencv_cudalegacy.so.407 => not found
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f7a41420000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f7a41416000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f7a413f3000)
/lib64/ld-linux-x86-64.so.2 (0x00007f7a853e9000)
libopencv_cudalegacy.so.407 => not found
...
A Rust implementation of lddtree "correctly" or "incorrectly" resolves this dependency. "correct" because this is what I would expect; "incorrect" because it doesn't seem to have the same behaviours as the Linux system.
$ cargo install lddtree
$ lddtree evision.so
libopencv_stitching.so.407 => /home/ubuntu/.cache/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda118-0.1.27/priv/lib/libopencv_stitching.so.4.7.0
libopencv_cudafeatures2d.so.407 => /home/ubuntu/.cache/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda118-0.1.27/priv/lib/libopencv_cudafeatures2d.so.4.7.0
...
libopencv_cudalegacy.so.407 => /home/ubuntu/.cache/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda118-0.1.27/priv/lib/libopencv_cudalegacy.so.4.7.0
...
However, when I compiled it on my local machine, this dependency issue disappeared.
No, the issue is still there.
$ mv lib lib2
$ ldd lib2/libopencv_stitching.so
linux-vdso.so.1 (0x00007fff25b7b000)
libopencv_cudafeatures2d.so.407 => not found
libopencv_cudalegacy.so.407 => not found
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f1970143000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f1970139000)
libopencv_cudawarping.so.407 => not found
libopencv_cudaarithm.so.407 => not found
libopencv_calib3d.so.407 => not found
libopencv_features2d.so.407 => not found
libopencv_flann.so.407 => not found
libopencv_imgproc.so.407 => not found
libopencv_core.so.407 => not found
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f196ffe6000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f196ffc3000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f196fde1000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f196fdc6000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f196fbd4000)
/lib64/ld-linux-x86-64.so.2 (0x00007f1970312000)
$ readelf -d lib/libopencv_stitching.so.407 |head -30
Dynamic section at offset 0x1b38c0 contains 42 entries:
Tag Type Name/Value
0x0000000000000001 (NEEDED) Shared library: [libopencv_cudafeatures2d.so.407]
0x0000000000000001 (NEEDED) Shared library: [libopencv_cudalegacy.so.407]
0x0000000000000001 (NEEDED) Shared library: [libdl.so.2]
0x0000000000000001 (NEEDED) Shared library: [librt.so.1]
0x0000000000000001 (NEEDED) Shared library: [libopencv_cudawarping.so.407]
0x0000000000000001 (NEEDED) Shared library: [libopencv_cudaarithm.so.407]
0x0000000000000001 (NEEDED) Shared library: [libopencv_calib3d.so.407]
0x0000000000000001 (NEEDED) Shared library: [libopencv_features2d.so.407]
0x0000000000000001 (NEEDED) Shared library: [libopencv_flann.so.407]
0x0000000000000001 (NEEDED) Shared library: [libopencv_imgproc.so.407]
0x0000000000000001 (NEEDED) Shared library: [libopencv_core.so.407]
0x0000000000000001 (NEEDED) Shared library: [libm.so.6]
0x0000000000000001 (NEEDED) Shared library: [libpthread.so.0]
0x0000000000000001 (NEEDED) Shared library: [libstdc++.so.6]
0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
0x0000000000000001 (NEEDED) Shared library: [ld-linux-x86-64.so.2]
0x000000000000000e (SONAME) Library soname: [libopencv_stitching.so.407]
0x000000000000001d (RUNPATH) Library runpath: [/__w/evision/evision/_build/test/lib/evision/priv/lib:/usr/local/cuda/lib64]
So I need to set RPATH for all opencv libraries.
Another possible solution is to build static OpenCV libraries only and link them in evision.so
.
It's correct now.
$ ldd evision.so
linux-vdso.so.1 (0x00007fff319a5000)
libopencv_stitching.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_stitching.so.407 (0x00007fead4a3e000)
libopencv_aruco.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_aruco.so.407 (0x00007fead4a29000)
libopencv_barcode.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_barcode.so.407 (0x00007fead4a0f000)
libopencv_bgsegm.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_bgsegm.so.407 (0x00007fead49f1000)
libopencv_bioinspired.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_bioinspired.so.407 (0x00007fead49b7000)
libopencv_ccalib.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_ccalib.so.407 (0x00007fead495e000)
libopencv_cudabgsegm.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_cudabgsegm.so.407 (0x00007fead46cb000)
libopencv_cudacodec.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_cudacodec.so.407 (0x00007fead4611000)
libopencv_cudafeatures2d.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_cudafeatures2d.so.407 (0x00007fead1f52000)
libopencv_cudaobjdetect.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_cudaobjdetect.so.407 (0x00007fead1cab000)
libopencv_cudastereo.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_cudastereo.so.407 (0x00007feacff64000)
libopencv_cudawarping.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_cudawarping.so.407 (0x00007feaca338000)
libopencv_dnn_superres.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_dnn_superres.so.407 (0x00007feaca328000)
libopencv_face.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_face.so.407 (0x00007feaca2a4000)
libopencv_fuzzy.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_fuzzy.so.407 (0x00007feaca293000)
libopencv_hfs.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_hfs.so.407 (0x00007feaca165000)
libopencv_img_hash.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_img_hash.so.407 (0x00007feaca150000)
libopencv_intensity_transform.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_intensity_transform.so.407 (0x00007feaca14b000)
libopencv_line_descriptor.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_line_descriptor.so.407 (0x00007feaca120000)
libopencv_mcc.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_mcc.so.407 (0x00007feaca0b7000)
libopencv_quality.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_quality.so.407 (0x00007feaca0a1000)
libopencv_rapid.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_rapid.so.407 (0x00007feaca08d000)
libopencv_reg.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_reg.so.407 (0x00007feaca072000)
libopencv_rgbd.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_rgbd.so.407 (0x00007feac9fa4000)
libopencv_saliency.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_saliency.so.407 (0x00007feac9f7f000)
libopencv_stereo.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_stereo.so.407 (0x00007feac9f53000)
libopencv_structured_light.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_structured_light.so.407 (0x00007feac9f3f000)
libopencv_surface_matching.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_surface_matching.so.407 (0x00007feac9ee7000)
libopencv_text.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_text.so.407 (0x00007feac9e7b000)
libopencv_tracking.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_tracking.so.407 (0x00007feac9c81000)
libopencv_wechat_qrcode.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_wechat_qrcode.so.407 (0x00007feac9c0c000)
libopencv_xfeatures2d.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_xfeatures2d.so.407 (0x00007feac97c2000)
libopencv_ximgproc.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_ximgproc.so.407 (0x00007feac957e000)
libopencv_xphoto.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_xphoto.so.407 (0x00007feac953c000)
libopencv_shape.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_shape.so.407 (0x00007feac9516000)
libopencv_highgui.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_highgui.so.407 (0x00007feac94dc000)
libopencv_videoio.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_videoio.so.407 (0x00007feac9453000)
libopencv_plot.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_plot.so.407 (0x00007feac9448000)
libopencv_phase_unwrapping.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_phase_unwrapping.so.407 (0x00007feac943c000)
libopencv_ml.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_ml.so.407 (0x00007feac93ac000)
libopencv_objdetect.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_objdetect.so.407 (0x00007feac92af000)
libopencv_imgcodecs.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_imgcodecs.so.407 (0x00007feac8ed4000)
libopencv_video.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_video.so.407 (0x00007feac8e47000)
libopencv_calib3d.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_calib3d.so.407 (0x00007feac8c43000)
libopencv_dnn.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_dnn.so.407 (0x00007feac6600000)
libopencv_features2d.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_features2d.so.407 (0x00007feac6518000)
libopencv_flann.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_flann.so.407 (0x00007feac6491000)
libopencv_photo.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_photo.so.407 (0x00007feac60b8000)
libopencv_cudaimgproc.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_cudaimgproc.so.407 (0x00007feac31f1000)
libopencv_cudafilters.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_cudafilters.so.407 (0x00007feaa22f6000)
libopencv_imgproc.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_imgproc.so.407 (0x00007feaa075e000)
libopencv_cudaarithm.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_cudaarithm.so.407 (0x00007fea92ea8000)
libopencv_core.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_core.so.407 (0x00007fea9126d000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fea9107c000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fea90f2d000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fea90f12000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fea90d1e000)
libopencv_cudalegacy.so.407 => /home/ubuntu/git/evision-nif_2.16-x86_64-linux-gnu-contrib-cuda111-0.1.27/priv/./lib/libopencv_cudalegacy.so.407 (0x00007fea8fc5d000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fea8fc57000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fea8fc4d000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fea8fc2a000)
/lib64/ld-linux-x86-64.so.2 (0x00007fead58ad000)
libnppc.so.11 => /usr/local/cuda/lib64/libnppc.so.11 (0x00007fea8f898000)
libnppig.so.11 => /usr/local/cuda/lib64/libnppig.so.11 (0x00007fea8d23a000)
libcublas.so.11 => /usr/local/cuda/lib64/libcublas.so.11 (0x00007fea875da000)
libcudnn.so.8 => /usr/local/cuda/lib64/libcudnn.so.8 (0x00007fea873b4000)
libnppial.so.11 => /usr/local/cuda/lib64/libnppial.so.11 (0x00007fea86205000)
libnppicc.so.11 => /usr/local/cuda/lib64/libnppicc.so.11 (0x00007fea85928000)
libnppidei.so.11 => /usr/local/cuda/lib64/libnppidei.so.11 (0x00007fea84cb2000)
libnppist.so.11 => /usr/local/cuda/lib64/libnppist.so.11 (0x00007fea82443000)
libnppif.so.11 => /usr/local/cuda/lib64/libnppif.so.11 (0x00007fea7bf7e000)
libnppim.so.11 => /usr/local/cuda/lib64/libnppim.so.11 (0x00007fea7b41e000)
libnppitc.so.11 => /usr/local/cuda/lib64/libnppitc.so.11 (0x00007fea7ad55000)
libcufft.so.10 => /usr/local/cuda/lib64/libcufft.so.10 (0x00007fea69e7a000)
libcublasLt.so.11 => /usr/local/cuda/lib64/libcublasLt.so.11 (0x00007fea458f2000)