[英]OpenCV build Error: libwebp.so not found
I have two Arch Linux machines on one I can compile my code but on my new one I get the following errors: 我有一台可以编译代码的两台Arch Linux机器,但是在新的一台机器上,出现以下错误:
:-1: warning: libwebp.so.5, needed by /usr/local/lib/libopencv_imgcodecs.so, not found (try using -rpath or -rpath-link)
/usr/local/lib/libopencv_imgcodecs.so:-1: error: undefined reference to `WebPEncodeBGRA'
/usr/local/lib/libopencv_imgcodecs.so:-1: error: undefined reference to `WebPDecodeBGRAInto'
/usr/local/lib/libopencv_imgcodecs.so:-1: error: undefined reference to `WebPEncodeLosslessBGR'
/usr/local/lib/libopencv_imgcodecs.so:-1: error: undefined reference to `WebPDecodeBGRInto'
/usr/local/lib/libopencv_imgcodecs.so:-1: error: undefined reference to `WebPEncodeLosslessBGRA'
/usr/local/lib/libopencv_imgcodecs.so:-1: error: undefined reference to `WebPGetFeaturesInternal'
/usr/local/lib/libopencv_imgcodecs.so:-1: error: undefined reference to `WebPEncodeBGR'
:-1: error: collect2: error: ld returned 1 exit status
My .pro file looks like this: 我的.pro文件如下所示:
#-------------------------------------------------
#
# Project created by QtCreator 2015-11-15T16:30:56
#
#-------------------------------------------------
QT += core gui opengl
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = ColonyCounter
TEMPLATE = app
CONFIG += c++11
INCLUDEPATH += /usr/local/include/opencv
LIBS += -L/usr/local/lib -lopencv_core -lopencv_imgcodecs -lopencv_imgproc
SOURCES += main.cpp\
mainwindow.cpp \
cellcounter.cpp
HEADERS += mainwindow.h \
cellcounter.h
FORMS += mainwindow.ui
DISTFILES += \
to-do.txt
How can I link the library or something like this, haven't found anything in the web right know. 我如何链接库或类似的东西,在网络上找不到任何已知信息。 I have checked my libs and found out that I do not have a libwep.so.5 but libwebp.so.6 and libwebp.so and libwebp.so.2, but I do not know how to fix it, install libwebp.so.5 or change something in my .pro file?
我检查了我的库,发现我没有libwep.so.5,但是没有libwebp.so.6和libwebp.so和libwebp.so.2,但是我不知道如何解决它,请安装libwebp.so .5或更改.pro文件中的内容?
Looks like the version of OpenCV that you installed wants to link with an older version of libwebp (specifically version 0.4.4 which contains libwebp.so.5) than what you have installed (probably version 0.5.0-1). 看起来您安装的OpenCV版本想要链接到比已安装的版本(可能是0.5.0-1版)更旧的libwebp版本(特别是包含libwebp.so.5的0.4.4版)。 Some options are:
一些选项是:
Now a comment about your currently marked solution: Making a link from one soname to another is highly not recommended. 现在,对您当前标记的解决方案发表评论:强烈建议不要从一个名称到另一个名称建立链接。 In many cases, it won't compile, but even if it does, your application may exhibit arbitrary and unstable behavior and/or segfault unless the binaries are completely compatible.
在许多情况下,它不会编译,但即使编译,除非二进制文件完全兼容,否则您的应用程序可能会表现出任意和不稳定的行为和/或段错误。 But if they were compatible, the packager would probably not have changed the soname.
但是,如果它们兼容,则打包程序可能不会更改soname。 If this is for a school project, you might be ok, but if this is for anything important, don't do it.
如果这是用于学校项目,则可能没问题,但是,如果这是重要的事情,请不要这样做。
Hope this helps. 希望这可以帮助。
I solved the problem with a not so elegant solution: I just created a symbolic link: 我用一个不太优雅的解决方案解决了这个问题:我刚刚创建了一个符号链接:
$ file libwebp.so.5
libwebp.so.5: symbolic link to libwebp.so.6.0.0
with: 与:
ln /usr/lib/libwebp.so.6 /usr/lib/libwebp.so.5
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.