简体   繁体   English

OpenCV构建错误:找不到libwebp.so

[英]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: 一些选项是:

  1. Downgrade libwebp to 0.4.4 and ignore libwebp 0.5.0-1 to avoid reverting back with future upgrades. 将libwebp降级到0.4.4,并忽略libwebp 0.5.0-1,以避免在以后的升级中恢复原状。 This is probably not the best choice, but it is easy and would work unless you have other packages which depend on 0.5.0-1. 这可能不是最佳选择,但它很容易并且可以工作,除非您拥有其他依赖于0.5.0-1的软件包。
  2. Manually download and build the 0.4.4 version of libwebp and install in a non-standard location. 手动下载并构建0.4.4版本的libwebp,然后将其安装在非标准位置。 In this case, you would need to modify/use LD_LIBRARY_PATH to point opencv there. 在这种情况下,您将需要修改/使用LD_LIBRARY_PATH将opencv指向此处。 This is probably your easiest best option. 这可能是您最简单的最佳选择。
  3. Download some more recent version of the OpenCV source and build it. 下载一些最新版本的OpenCV源代码并进行构建。 It will find and link to your current libwep.so.6, if it is compatible. 如果兼容,它将找到并链接到您当前的libwep.so.6。 The latest version of OpenCV (as of this writing 3.1.0) is compatible. 兼容最新版本的OpenCV(在撰写本文时为3.1.0)。 This option is the best option but the most involved as compiling OpenCV can be trivial or painful depending upon the features you want to include. 此选项是最佳选择,但编译OpenCV涉及最多,取决于您要包括的功能可能很琐碎或痛苦。

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.

相关问题 OpenCV_FOUND为FALSE因此包“OpenCV”被认为是未找到的 - OpenCV_FOUND to FALSE so package “OpenCV” is considered to be NOT FOUND /lib64/libc.so.6:未找到版本“GLIBC_2.14” - 使用 pyinstaller 构建应用程序时出错 - /lib64/libc.so.6: version `GLIBC_2.14' not found - error from the application build using pyinstaller Linux编译opencv python错误:ImportError:libjasper.so.1 - Linux Compiling opencv python error: ImportError: libjasper.so.1 Anaconda OpenCV Arch Linux libselinux.so 错误 - Anaconda OpenCV Arch Linux libselinux.so error OpenCv已安装,但找不到模块,如何使符号链接指向cv2.so文件? - OpenCv is installed, but module cannot be found, how to make sym-link point to cv2.so file? oprofile 二进制构建错误 -(未找到自由库) - oprofile binary build error - (liberty library not found) 错误“sys/videoio.h - 未找到” OpenCV 3.1.0 - Error “sys/videoio.h - not found” OpenCV 3.1.0 错误:ldd outputLine:“ libicui18n.so.56 =>找不到” - ERROR: ldd outputLine: “libicui18n.so.56 => not found” libstdc ++。so.6:找不到版本“ GLIBCXX_3.4.21”错误 - libstdc++.so.6: version `GLIBCXX_3.4.21' not found error Hexeditted 共享库“未找到版本 x.so”错误 - Hexeditted shared library 'Version x.so not found' error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM