Is it possible to deploy a Qt Quick application without Qt Network on OS X?
Asked Answered
C

4

14

I have a Qt Quick application using the following modules

QT = core gui qml quick widgets \
    core-private gui-private \
    multimedia printsupport`

which I deploy on OS X. Now my main binary as well as a lot of Qt Qtick plugins show a dependency on 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)

The same dependency on Qt Network is found in the following plugins

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
  1. Is it possible to use Qt Quick without Qt Network?
  2. Is there any module dependency documentation for Qt?

I don't get why the dependency in Qt Network is compiled into my own binary.

Colicweed answered 10/6, 2015 at 9:46 Comment(2)
QtQml depends on QtNetwork. Looking at the Qt source code, it doesn’t look like there’s a way to build it without it.Vicarage
Thanks @FrankOsterfeld. I think that answer part 1. of the question nicely. Feel free to add this as an answer.Colicweed
C
6

No.

Proof

The following command line script generates a dependency list of Qt5 modules on Linux:

# 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

which results in the following output:

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
Colicweed answered 12/6, 2015 at 12:24 Comment(3)
nice script, that only proves correct description of question, but this doesn't give any hint how to solve the problem. It is not an answer.Duad
@MarekR I added "no", which now should answer the question. The script can be interpreted as automated Qt documentation.Colicweed
And my answer proves YES. For Linux where Qt can be shipped as package dependency you are right answer should be NO (but in such case there is no real problem). On platforms where Qt is shipped with application, you can always customize Qt features, so YES.Duad
D
2

Well, QtQml depends on QtDeclarative which depends on QtNetwork so I doubt you can...

And for you, here is the Qt Library Cross Dependencies

Delcine answered 12/6, 2015 at 11:27 Comment(4)
The link you posted is a great resource for Qt 4. Does something similar exist for Qt 5?Colicweed
@SimonWarta oh you're right, I should have paid more attention to thisDelcine
@SimonWarta as the last modification on the page I gave you is two months old, I doubt the version 5 doc is out. But I also doubt that they changed a lot of things since Qt 4.8...Delcine
Thanks. Let's see if that is the best thing we get. Given that Qt 5 has many additional modules, this is not really satisfying.Colicweed
P
0

I don't get why the dependency in Qt Network is compiled into my own binary.

If you statically link your program with Qt, the resulting executable should only contain a copy of the library routines called, not the entire library.

Pretense answered 18/6, 2015 at 18:9 Comment(2)
I am linking dynamically for licensing reasons. The phrase "compiled into" might be misleading. I think "linked against" is what I was trying to say. Anyways, thanks for the hint.Colicweed
@Simon Warta Ah yes. I completely forgot that statically linking with the GPL version of Qt was forbidden. Pleasure.Pretense
D
0

The only option for you is reconfiguring and rebuilding Qt.
You can customize available features and get rid of lots of stuff without breaking license.

I didn't do it for long time so I don't have details (I've lost link to best instruction, if I find it I will let you know). I hope that documentation above will be enough. I'm sure you will be able to find some better instruction with Google.

Duad answered 19/6, 2015 at 8:44 Comment(2)
Thanks for the general hint. From the provided information I still have no clue if and how it is possible to deploy Qt Quick without Qt Network. The paragraph "Including and Excluding Qt Modules" brings be back to exactly my question.Colicweed
I don't have Qt on my current machine, but try to look on help of configure tool (run it with help switch). You will find there how to disable some features (like networking). The main problem is to run configure with proper switches after that it should be straight forward.Duad

© 2022 - 2024 — McMap. All rights reserved.