我有一个使用以下模块的Qt Quick应用程序
QT = core gui qml quick widgets \
core-private gui-private \
multimedia printsupport`
我在OS X上部署。现在我的主要二进制文件以及许多Qt Qtick插件都显示出对Qt Network的依赖。
otool -L /path/to/My.app/Contents/MacOS/My
/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 55471.14.18)
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1056.16.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
@executable_path/../Frameworks/QtQuick.framework/Versions/5/QtQuick (compatibility version 5.4.0, current version 5.4.2)
@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui (compatibility version 5.4.0, current version 5.4.2)
@executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore (compatibility version 5.4.0, current version 5.4.2)
/System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
@executable_path/../Frameworks/QtQml.framework/Versions/5/QtQml (compatibility version 5.4.0, current version 5.4.2)
/Users/me/Qt/5.4/clang_64/lib/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.4.0, current version 5.4.2)
@executable_path/../Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport (compatibility version 5.4.0, current version 5.4.2)
@executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.4.0, current version 5.4.2)
@executable_path/../Frameworks/QtMultimedia.framework/Versions/5/QtMultimedia (compatibility version 5.4.0, current version 5.4.2)
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 855.17.0)
在以下插件中可以找到与Qt Network相同的依赖性
My.app/Contents/Frameworks/QtMultimedia.framework/Versions/5/QtMultimedia
My.app/Contents/Frameworks/QtMultimediaQuick_p.framework/Versions/5/QtMultimediaQuick_p
My.app/Contents/Frameworks/QtQml.framework/Versions/5/QtQml
My.app/Contents/Frameworks/QtQuick.framework/Versions/5/QtQuick
My.app/Contents/Plugins/audio/libqtaudio_coreaudio.dylib
My.app/Contents/Resources/qml/QtMultimedia/libdeclarative_multimedia.dylib
My.app/Contents/Resources/qml/QtQuick/Controls/libqtquickcontrolsplugin.dylib
My.app/Contents/Resources/qml/QtQuick/Dialogs/libdialogplugin.dylib
My.app/Contents/Resources/qml/QtQuick/Dialogs/Private/libdialogsprivateplugin.dylib
My.app/Contents/Resources/qml/QtQuick/Layouts/libqquicklayoutsplugin.dylib
My.app/Contents/Resources/qml/QtQuick/PrivateWidgets/libwidgetsplugin.dylib
My.app/Contents/Resources/qml/QtQuick/Window.2/libwindowplugin.dylib
My.app/Contents/Resources/qml/QtQuick.2/libqtquick2plugin.dylib
我不明白为什么Qt Network中的依赖会被编译成我自己的二进制文件。
答案 0 :(得分:4)
没有
<强>证明强>
以下命令行脚本在Linux上生成Qt5模块的依赖关系列表:
# Run in e.g. Qt/5.4/gcc_64/lib
for f in libQt5*.so; do mod=$(basename "$f" .so | cut -c "7-"); echo "$mod"; ldd "$f" | grep "libQt5" | cut -f 1 -d">" | tr -dc "a-zA-Z0-9.[:space:]" | cut -d"." -f 1 | sed 's/libQt5//g'; done
导致以下输出:
Bluetooth
DBus
Core
CLucene
Core
Concurrent
Core
Core
DBus
Core
Declarative
Widgets
Gui
Script
Sql
XmlPatterns
Network
Core
DesignerComponents
Designer
Widgets
Gui
Xml
Core
Designer
Widgets
Gui
Xml
Core
Gui
Core
Help
Widgets
Gui
Core
Network
Sql
CLucene
Location
Positioning
Quick
Gui
Core
Qml
Network
MultimediaQuick_p
Quick
Multimedia
Gui
Core
Qml
Network
Multimedia
Network
Gui
Core
MultimediaWidgets
Multimedia
Widgets
Gui
Core
OpenGL
Network
Network
Core
Nfc
Core
OpenGL
Widgets
Gui
Core
Positioning
Core
PrintSupport
Widgets
Gui
Core
Qml
Network
Core
QuickParticles
Quick
Gui
Qml
Core
Network
Quick
Gui
Qml
Network
Core
QuickTest
Widgets
Gui
Core
Test
Quick
Qml
Network
QuickWidgets
Quick
Widgets
Gui
Qml
Core
Network
Script
Core
ScriptTools
Core
Widgets
Gui
Script
Sensors
Core
SerialPort
Core
Sql
Core
Svg
Widgets
Gui
Core
Test
Core
WebChannel
Qml
Core
Network
WebKit
Sensors
Core
Positioning
Quick
Gui
Qml
Network
WebChannel
Sql
WebKitWidgets
Widgets
WebKit
Gui
Network
Core
Sensors
PrintSupport
OpenGL
Positioning
Quick
Qml
WebChannel
Sql
WebSockets
Network
Core
Widgets
Gui
Core
X11Extras
Gui
Core
XmlPatterns
Network
Core
Xml
Core
答案 1 :(得分:2)
嗯, QtQml 取决于依赖于 QtNetwork 的 QtDeclarative ,所以我怀疑你能不能......
答案 2 :(得分:0)
我不明白为什么Qt网络中的依赖被编译成我自己的二进制文件。
如果您将程序静态链接到Qt,则生成的可执行文件应仅包含所调用的库例程的副本,而不是整个库。
答案 3 :(得分:0)
唯一的选择是reconfiguring and rebuilding Qt 您可以自定义可用功能并在不破坏许可证的情况下删除大量内容。
我没有长时间这么做,所以我没有细节(我已经失去了与最佳教学的联系,如果我发现它,我会告诉你)。我希望上面的文档就足够了。我相信你能找到一些更好的Google指导。