在开始之前,我想指出实际上存在一个非常相似(可能完全相同)的问题。但是,从接受的答案来看,我一直无法解决自己的问题。
我按照该网站提供的说明在Ubuntu 16.04上安装OpenCV3。我到了试图用g ++编译测试程序(第6节)的地步。编译返回以下内容:
/usr/bin/ld: warning: libicui18n.so.58, needed by //home/raggot/anaconda3/lib/libQt5Core.so.5, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libicuuc.so.58, needed by //home/raggot/anaconda3/lib/libQt5Core.so.5, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libicudata.so.58, needed by //home/raggot/anaconda3/lib/libQt5Core.so.5, not found (try using -rpath or -rpath-link)
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `u_errorName_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucal_setMillis_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucnv_getAlias_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucal_inDaylightTime_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `u_strToLower_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucnv_getStandardName_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `u_strToUpper_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucnv_setSubstChars_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucnv_getMaxCharSize_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucal_getTimeZoneDisplayName_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucnv_fromUnicode_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucnv_open_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucnv_getDefaultName_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucal_getDefaultTimeZone_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucal_clone_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucal_getDSTSavings_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucol_strcoll_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucnv_close_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucnv_countAvailable_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucal_openCountryTimeZones_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucol_open_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucnv_compareNames_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucal_close_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucnv_getAvailableName_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucal_openTimeZoneIDEnumeration_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucal_open_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucol_setAttribute_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucal_openTimeZones_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `uenum_close_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucnv_countAliases_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucol_close_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucol_getSortKey_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucal_get_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `uenum_next_58'
//home/raggot/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucnv_toUnicode_58'
collect2: error: ld returned 1 exit status
尝试将此答案应用于我的问题时,我尝试将Qt5的安装路径本地化。我通过使用做到了dpkg --listfiles libqt5core5a
。我将结果路径添加到LD_LIBRARY_PATH
,但没有帮助。
我尝试通过重新安装Qt5sudo apt install qt5-default
并进行了安装,qttools5-dev
但它也没有帮助。
我的问题可能与编译器正在使用anaconda的库有关,而实际上我是在全局环境中工作的。更多的研究还显示,我使用的Qt5安装的apt install
版本为5.5.1,而如果键入,qtdiag
我会看到显示的版本为5.6.2。那可能是因为在某个时候我可能也已经在anaconda下安装了Qt5。因此,我可能有2个安装。我不知道该如何验证。
是什么原因引起的?
编辑:
多亏了这些评论,我才意识到anaconda3
甚至不应该PATH
放在首位。经过一番黑客攻击后,我发现它是在登录时添加到路径中的.bashrc
,这可能是因为在安装Anaconda时提出了这样的要求。我将其删除,然后make
再次尝试。
我现在看到的是(很长的输出摘录):
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_stdio_dest@LIBJPEG_9.0'
/usr/local/lib/libopencv_highgui.so: undefined reference to `QGraphicsView::staticMetaObject@Qt_5'
/usr/local/lib/libopencv_highgui.so: undefined reference to `QSize::scaled(QSize const&, Qt::AspectRatioMode) const@Qt_5'
/usr/local/lib/libopencv_highgui.so: undefined reference to `QWidget::update()@Qt_5'
/usr/local/lib/libopencv_highgui.so: undefined reference to `QWidget::paintEngine() const@Qt_5'
/usr/local/lib/libopencv_highgui.so: undefined reference to `QAbstractSlider::setMinimum(int)@Qt_5'
/usr/local/lib/libopencv_highgui.so: undefined reference to `QCheckBox::minimumSizeHint() const@Qt_5'
/usr/local/lib/libopencv_highgui.so: undefined reference to `QFileInfo::QFileInfo(QString const&)@Qt_5'
/usr/local/lib/libopencv_highgui.so: undefined reference to `QWidget::hideEvent(QHideEvent*)@Qt_5'
/usr/local/lib/libopencv_highgui.so: undefined reference to `QObject::connectNotify(QMetaMethod const&)@Qt_5'
/usr/local/lib/libopencv_highgui.so: undefined reference to `non-virtual thunk to QBoxLayout::hasHeightForWidth() const@Qt_5'
/usr/local/lib/libopencv_highgui.so: undefined reference to `QWidget::isFullScreen() const@Qt_5'
/usr/local/lib/libopencv_highgui.so: undefined reference to `QWidget::hasHeightForWidth() const@Qt_5'
/usr/local/lib/libopencv_highgui.so: undefined reference to `QPen::QPen(QBrush const&, double, Qt::PenStyle, Qt::PenCapStyle, Qt::PenJoinStyle)@Qt_5'
/usr/local/lib/libopencv_highgui.so: undefined reference to `QStatusBar::showMessage(QString const&, int)@Qt_5'
/usr/local/lib/libopencv_highgui.so: undefined reference to `QObject::customEvent(QEvent*)@Qt_5'
/usr/local/lib/libopencv_highgui.so: undefined reference to `QObject::QObject(QObject*)@Qt_5'
/usr/local/lib/libopencv_highgui.so: undefined reference to `QFont::setLetterSpacing(QFont::SpacingType, double)@Qt_5'
/usr/local/lib/libopencv_highgui.so: undefined reference to `QGraphicsView::dragLeaveEvent(QDragLeaveEvent*)@Qt_5'
/usr/local/lib/libopencv_highgui.so: undefined reference to `typeinfo for QHBoxLayout@Qt_5'
/usr/local/lib/libopencv_highgui.so: undefined reference to `QGLWidget::~QGLWidget()@Qt_5'
这使我觉得我现在只是想念中的东西PATH
。
我在这些子文件夹中找到了这些库的定义位置(在我安装的Qt5中)/usr/include/x86_64-linux-gnu/qt5/
,然后PATH
通过中的export
命令将它们全部添加到.profile
,然后运行source .profile
。如果我现在跑步,echo $PATH
我会看到它们全部就绪。
不幸的是,如果我运行make
命令,错误消息仍然是相同的。
编辑#2:
加入含QT5的头到所有子文件夹之后PATH
,我尝试添加的副本PATH
中LD_LIBRARY_PATH
做
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PATH
但是,错误消息的性质再次没有改变。我真的不明白为什么编译器看不到Qt5库。
简而言之:我通过从头开始重建OpenCV来解决了这个问题。该解决方案归功于用户TomášPospíšek。
OpenCV的安装依赖于Anaconda的Python3安装和软件包,而不是root。无论内容PATH
,PYTHONPATH
或者LD_LIBRARY_PATH
,也不管我已经改名的事实anaconda
,以文件夹anaconda_renamed
,以避免它被发现过,自己的OpenCV建依靠蟒蛇的包。毫不奇怪,在这一点上他们没有被发现。
这个问题一直没有很容易解决,因为即使当我试图使用标准从头开始重建OpenCV的cmake
安装指令通过OpenCV的,蟒蛇仍路径结束了。但是,通过使用cmake-gui
和anaconda
在字段中进行搜索,我设法找到了它的使用位置。
经过多次尝试正常通过连接领域的解决这个问题cmake
远离anaconda
,看到如何通过默认的CMake保持在这一领域找到蟒蛇包,在那里,我结束了从系统中删除蟒蛇,拉的最新版本opencv
,并opencv-contrib
与下面的OpenCV的安装说明再来一次。
该make
过程导致某些CUDA软件包出现了一些错误(类似于cudaarithm
和cudatest
)。使用cmake-gui
工作将它们从构建中排除。我希望我永远不会后悔这些排除。
PS:如果其他不幸的用户也发现他们的make -j4
命令导致构建过程陷入了99%的停留数小时的情况,请尝试make -j1
使用。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句