我正在尝试在 CentOS 6 集群上安装 Octave-4.0.0。Octave 有 20 多个依赖项,不清楚每个依赖项要使用哪个版本。由于yum
只有 Octave-3.4.3,我安装了 Octave-3.4.3,yum
希望它能让我正确安装大多数依赖项。我还必须安装(通过yum
)
arpack-devel-3.1.3-1.el6.x86_64
fltk-devel-1.1.10-1.el6.x86_64
gl2ps-devel-1.3.5-1.el6.x86_64
glpk-devel-4.40-1.1.el6.x86_64
qhull-devel-2003.1-14.el6.x86_64
qrupdate-devel-1.1.2-1.el6.x86_64
qscintilla-devel-2.4-1.el6.x86_64
suitesparse-devel-3.4.0-9.el6.x86_64
以及来源
pcre-8.36
我运行自动配置:
./configure JAVA_HOME="/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.79.x86_64/" CPPFLAGS="-I/home/path/to/user/local/include" --prefix=/home/path/to/user/local/ --with-blas=/usr/lib64/atlas/libf77blas.so.3 --with-lapack=/usr/lib64/atlas/liblapack.so.3
似乎一切都很好,然后当我运行时,make
它花了大约 30 分钟进行编译,然后失败:
.
.
.
make[2]: Entering directory /gpfs0/home/path/to/user/local/src/octave-4.0.0/src'
CXX octave_gui-main-gui.o
CXXLD octave-gui
/usr/lib64/libQtOpenGL.so.4: undefined reference to 'QWidgetPrivate::checkWindowRole()'`
/usr/lib64/libQtOpenGL.so.4: undefined reference to 'QPaintEngineEx::drawPixmaps(QDrawPixmaps::Data const*, int, QPixmap const&, QFlags<QDrawPixmaps::DrawingHint>)'
/usr/lib64/libQtOpenGL.so.4: undefined reference to 'QTextureGlyphCache::populate(QTextItemInt const&, QVarLengthArray<unsigned int, 256> const&, QVarLengthArray<QFixedPoint, 256> const&)'
/usr/lib64/libQtNetwork.so.4: undefined reference to 'QObjectPrivate::checkWindowRole()'
collect2: error: ld returned 1 exit status
make[2]: *** [octave-gui] Error 1
make[2]: Leaving directory '/gpfs0/home/path/to/user/local/src/octave-4.0.0/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/gpfs0/home/path/to/user/local/src/octave-4.0.0'
make: *** [all] Error 2
在 auto conf 生成的 Makefile 中,它似乎应该正确链接到 Qt 库,即
.
.
.
QT_CFLAGS = -DQT_SHARED -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include/QtNetwork -I/usr/include/Q tOpenGL
QT_CPPFLAGS = -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include/QtNetwork -I/usr/include/QtOpenGL
QT_LDFLAGS =
QT_LIBS = -lQtNetwork -lQtOpenGL -lQtGui -lQtCore -lqscintilla2
.
.
.
在 /usr/lib64/ 中我检查了 Qt 库的内容
$ for i in *Qt*.so.4.6.2; do echo $i; nm -C -D $i | grep -i checkWindowRole; done
libQt3Support.so.4.6.2
U QObjectPrivate::checkWindowRole()
U QWidgetPrivate::checkWindowRole()
libQtAssistantClient.so.4.6.2
libQtCLucene.so.4.6.2
libQtCore.so.4.6.2
00000000001657b0 T QObjectPrivate::checkWindowRole()
libQtDBus.so.4.6.2
U QObjectPrivate::checkWindowRole()
libQtDesignerComponents.so.4.6.2
libQtDesigner.so.4.6.2
libQtGui.so.4.6.2
U QObjectPrivate::checkWindowRole()
00000000002388f0 T QWidgetPrivate::checkWindowRole()
libQtHelp.so.4.6.2
libQtMultimedia.so.4.6.2
U QObjectPrivate::checkWindowRole()
libQtNetwork.so.4.6.2
U QObjectPrivate::checkWindowRole()
libQtOpenGL.so.4.6.2
U QObjectPrivate::checkWindowRole()
U QWidgetPrivate::checkWindowRole()
libQtScript.so.4.6.2
U QObjectPrivate::checkWindowRole()
libQtScriptTools.so.4.6.2
U QObjectPrivate::checkWindowRole()
U QWidgetPrivate::checkWindowRole()
libQtSql.so.4.6.2
U QObjectPrivate::checkWindowRole()
libQtSvg.so.4.6.2
U QObjectPrivate::checkWindowRole()
U QWidgetPrivate::checkWindowRole()
libQtTest.so.4.6.2
libQtXmlPatterns.so.4.6.2
U QObjectPrivate::checkWindowRole()
libQtXml.so.4.6.2
并且似乎在 内QWidgetPrivate::checkWindowRole()
声明了(如果我解释nm
正确的话?)libQtGui.so.4.6.2
。此库已链接到(参见上文)
问题:我该如何解决这个问题并libQtOpenGL
看到正确的库?
答案1
事实证明,我在用户空间本地安装了一款软件,它在 中安装了一些库~/local/lib
。在该目录中,该软件安装了libQtCore.so.4
和libQtGui.so.4
。这是这里安装的唯一 Qt 相关库。同样,我设置了
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/path/to/user/local/lib
这意味着链接器在位于 中的库之前找到了这些库/usr/lib64
。更改 $LD_LIBRARY_PATH 以使其不再指向~/local/lib
,让链接器完成其工作并解决了我的问题。