开发者

Fix broken links on shared library g++

I have an executable which links to opencv 2.2. However, I have removed opencv 2.2 and I have opencv 2.3 installed.

The question is, is there a way to link this executable to the new shared library without recompiling the whole source code? How can I fix those broken links?

running ldd:

    linux-vdso.so.1 =>  (0x00007fff17fff000)
    libSM.so.6 => /usr/lib/x86_64-linux-gnu/libSM.so.6 (0x00007fd6f0e0d000)
    libICE.so.6 => /usr/lib/x86_64-linux-gnu/libICE.so.6 (0x00007fd6f0bf2000)
    libXmu.so.6 => /usr/lib/libXmu.so.6 (0x00007fd6f09d8000)
    libXi.so.6 => /usr/lib/x86_64-linux-gnu/libXi.so.6 (0x00007fd6f07c8000)
    libGLU.so.1 => /usr/lib/libGLU.so.1 (0x00007fd6f0559000)
    libGL.so.1 => /usr/lib/fglrx/libGL.so.1 (0x00007fd6f0353000)
    libopencv_core.so.2.2 => not found
  开发者_开发百科  libopencv_imgproc.so.2.2 => not found
    libopencv_highgui.so.2.2 => not found
    libopencv_ml.so.2.2 => not found
    libopencv_video.so.2.2 => not found
    libopencv_features2d.so.2.2 => not found
    libopencv_calib3d.so.2.2 => not found
    libopencv_objdetect.so.2.2 => not found
    libopencv_contrib.so.2.2 => not found
    libopencv_legacy.so.2.2 => not found
    libopencv_flann.so.2.2 => not found
    libglut.so.3 => /usr/lib/libglut.so.3 (0x00007fd6f0109000)

...

thanks guys,

Samuel


If OpenCV version 2.3 is binary compatible with version 2.2, i.e. if the ABI did not undergo breaking changes, you can work around the problem with symbolic links:

# ln -s /usr/lib/libopencv_core.so.2.3 /usr/lib/libopencv_core.so.2.2
# ln -s /usr/lib/libopencv_imgproc.so.2.3 /usr/lib/libopencv_imgproc.so.2.2
.
.
.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜