我想为 Qt Project 4.7.4 版编译一个静态库。但是无论我在.pro
文件中进行什么更改,它都不会影响更改。我想改变例如libQt5Gui.so
指向 on /opt/vendor/extlib/libQt5Gui.so
,但我现在并不幸运:
我正在将文件从 Ubuntu 复制到干净安装的 Xubuntu 13.04 上的虚拟机。
当我使用ldd
命令时,它返回:
marin@host:~/some_dir/test$ ldd ./Project02
linux-gate.so.1 => (0xb76e7000)
libQt5Widgets.so.5 => /usr/lib/i386-linux-gnu/libQt5Widgets.so.5 (0xb70c6000)
libQt5Xml.so.5 => /usr/lib/i386-linux-gnu/libQt5Xml.so.5 (0xb708a000)
libQt5Gui.so.5 => not found
libQt5Core.so.5 => not found
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb6fa0000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb6f83000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb6dd0000)
libQt5Gui.so.5 => not found
libQt5Core.so.5 => not found
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb6db4000)
libgobject-2.0.so.0 => /usr/lib/i386-linux-gnu/libgobject-2.0.so.0 (0xb6d64000)
libglib-2.0.so.0 => /lib/i386-linux-gnu/libglib-2.0.so.0 (0xb6c63000)
libX11.so.6 => /usr/lib/i386-linux-gnu/libX11.so.6 (0xb6b2c000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb6ae9000)
/lib/ld-linux.so.2 (0xb76e8000)
libQt5Core.so.5 => not found
libffi.so.6 => /usr/lib/i386-linux-gnu/libffi.so.6 (0xb6ae2000)
libpcre.so.3 => /lib/i386-linux-gnu/libpcre.so.3 (0xb6aa1000)
libxcb.so.1 => /usr/lib/i386-linux-gnu/libxcb.so.1 (0xb6a7e000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb6a79000)
libXau.so.6 => /usr/lib/i386-linux-gnu/libXau.so.6 (0xb6a75000)
libXdmcp.so.6 => /usr/lib/i386-linux-gnu/libXdmcp.so.6 (0xb6a6e000)
所以你,我不明白为什么是:
libQt5Gui.so.5 => not found
libQt5Core.so.5 => not found
我的.pro
文件:
QT += core gui xml
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Project02
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp \
editorplain.cpp \
logssession.cpp \
createcontroller.cpp \
createmodel.cpp \
createview.cpp \
envview.cpp \
properties.cpp \
debugsettings.cpp \
serverconf.cpp \
frameworkview.cpp \
helpergen.cpp \
offlineserver.cpp \
cssproperty.cpp \
regex.cpp \
formgen.cpp
HEADERS += mainwindow.h \
editorplain.h \
logssession.h \
createcontroller.h \
createmodel.h \
createview.h \
envview.h \
properties.h \
debugsettings.h \
serverconf.h \
frameworkview.h \
helpergen.h \
offlineserver.h \
cssproperty.h \
regex.h \
formgen.h
FORMS += mainwindow.ui \
editorplain.ui \
logssession.ui \
createcontroller.ui \
createmodel.ui \
createview.ui \
envview.ui \
properties.ui \
debugsettings.ui \
serverconf.ui \
frameworkview.ui \
helpergen.ui \
offlineserver.ui \
cssproperty.ui \
regex.ui \
formgen.ui
RESOURCES += \
res.qrc
CONFIG += staticlib
LIBS += -L$$PWD/extstaticlibs/ -lFoobar
INCLUDEPATH += $$PWD/extstaticlibs
在.pro
我只添加的文件中:
CONFIG += staticlib
LIBS += -L$$PWD/extstaticlibs/ -lFoobar
INCLUDEPATH += $$PWD/extstaticlibs
在 $$PWD/extstaticlibs 上有libQt5Gui.so.5
.
那么,必须让静态库在没有动态共享.so
Qt 脚本的情况下作为独立应用程序工作吗?谢谢!