QNetworkConfigurationManager is not working as expected after deploying using macdeployqt tool in MAC.



  • The program:
    [code]
    #include <QString>
    #include <QApplication>
    #include <QNetworkConfigurationManager>
    #include <QNetworkConfiguration>
    #include <QNetworkSession>
    #include <QDebug>
    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);
    QString intr;
    QList<QNetworkInterface> interfaces = QNetworkInterface::allInterfaces();

    for (int i = 0; i < interfaces.count(); i++) {
        QNetworkInterface networkInterface = interfaces.at(i);
        qDebug("NetworkName %s\n", networkInterface.humanReadableName().toLatin1().constData());
    }
    QNetworkConfigurationManager networkConfigurationManager;
    QNetworkConfiguration configuration = networkConfigurationManager.defaultConfiguration();
    QNetworkSession *session = new QNetworkSession(configuration);
    intr = session->interface().humanReadableName();
    qDebug("Active interface :%s \n", intr.toLatin1().constData());
    
    QNetworkConfigurationManager NetworkConfigurationManager;
    QList<QNetworkConfiguration> Configuration = NetworkConfigurationManager.allConfigurations();
    

    qDebug("Config count : %d", Configuration.size());

    app.exec&#40;&#41;;
    return true;
    

    }
    [/code]

    On executing the above code after deploying using macdeployqt tool.The output is as follows:
    NetworkName : en0
    NetworkName : en1
    .............[list around 6 interface names]
    Active interface null
    Config count 0.

    Were as if the same application without deploying .The output is as follows:
    NetworkName : en0
    NetworkName : en1
    .............[list around 6 interface names]
    Active interface en0
    Config count 6.

    Any one faced a similar kind of issue with QNetworkConfigurationManager, were it does not work properly after deployment using macdeployqt tool.


  • Lifetime Qt Champion

    Hi and welcome to DevNet,

    Please enclose your code with code tags.

    Check your resulting bundle to see if all libraries path are correct



  • i ran otool on my test application. it shows:
    test.app/Contents/MacOS/test:
    @executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.0.0, current version 5.0.1)
    @executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui (compatibility version 5.0.0, current version 5.0.1)
    @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore (compatibility version 5.0.0, current version 5.0.1)
    @executable_path/../Frameworks/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.0.0, current version 5.0.1)
    /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/libstdc++.6.dylib (compatibility version 7.0.0, current version 56.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)

    i ran on each copied framework also all the QT referering path is changed to @executable_path/../Frameworks


  • Lifetime Qt Champion

    Did you also check that you have all plugins required ? (platform etc...)



  • under plug-in i have following structure:
    @PlugIns
    |-accessible
    | |-libqtaccessiblewidgets.dylib
    |-imageformats
    | |-libqgif.dylib
    | |-libqico.dylib
    | |-libqjpeg.dylib
    | |-libqmng.dylib
    | |-libqtga.dylib
    | |-libqtiff.dylib
    | |-libqwbmp.dylib
    |-platforms
    | |-libqcocoa.dylib
    |-printsupport
    | |-libcocoaprintersupport.dylib
    @

    bq. is any thing missed here ?Since i am using only the network module which all can be the related plugin?Please let me know.



  • my .pro file is like this:
    @
    QT += core gui network widgets
    TEMPLATE = app
    TARGET = test
    TARGET.CAPABILITY = NetworkServices ReadUserData
    INCLUDEPATH += .

    Input

    SOURCES += net.cpp
    @

    bq. have i missed any thing in my pro file which is necessary while bundling using macdeployqt tool.


  • Lifetime Qt Champion

    IFAIK TARGET.CAPABILITY is only used for symbian target (but i don't think it should be problematic)

    Did you also checked debug vs release compilation ?



  • i removed the TARGET.CAPABILITY in case if it may cause problem.
    Then i compiled and deploy in both the ways using command:

    for debug

    for release

    then bundled it with macdeployqt:

    • macdeployqt test.app/ -verbose=2

    @
    Log: Deploying Qt frameworks found inside: ("test.app/Contents/MacOS/test")
    Log: copied: "/usr/local/Qt-5.0.1/lib/QtWidgets.framework/Versions/5/QtWidgets"
    Log: to "test.app/Contents/Frameworks/QtWidgets.framework/Versions/5/QtWidgets"
    Log: copied: "/usr/local/Qt-5.0.1/lib/QtGui.framework/Versions/5/QtGui"
    Log: to "test.app/Contents/Frameworks/QtGui.framework/Versions/5/QtGui"
    Log: copied: "/usr/local/Qt-5.0.1/lib/QtCore.framework/Versions/5/QtCore"
    Log: to "test.app/Contents/Frameworks/QtCore.framework/Versions/5/QtCore"
    Log: copied: "/usr/local/Qt-5.0.1/lib/QtNetwork.framework/Versions/5/QtNetwork"
    Log: to "test.app/Contents/Frameworks/QtNetwork.framework/Versions/5/QtNetwork"
    Log:
    Log: Deploying plugins from "/usr/local/Qt-5.0.1/plugins"
    Log: copied: "/usr/local/Qt-5.0.1/plugins/platforms/libqcocoa.dylib"
    Log: to "test.app/Contents/PlugIns/platforms/libqcocoa.dylib"
    Log:
    Log: Deploying Qt frameworks found inside: ("test.app/Contents/PlugIns/platforms/libqcocoa.dylib")
    Log: copied: "/usr/local/Qt-5.0.1/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport"
    Log: to "test.app/Contents/Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport"
    Log: copied: "/usr/local/Qt-5.0.1/plugins/printsupport/libcocoaprintersupport.dylib"
    Log: to "test.app/Contents/PlugIns/printsupport/libcocoaprintersupport.dylib"
    Log:
    Log: Deploying Qt frameworks found inside: ("test.app/Contents/PlugIns/printsupport/libcocoaprintersupport.dylib")
    Log: copied: "/usr/local/Qt-5.0.1/plugins/accessible/libqtaccessiblewidgets.dylib"
    Log: to "test.app/Contents/PlugIns/accessible/libqtaccessiblewidgets.dylib"
    Log:
    Log: Deploying Qt frameworks found inside: ("test.app/Contents/PlugIns/accessible/libqtaccessiblewidgets.dylib")
    Log: copied: "/usr/local/Qt-5.0.1/plugins/imageformats/libqgif.dylib"
    Log: to "test.app/Contents/PlugIns/imageformats/libqgif.dylib"
    Log:
    Log: Deploying Qt frameworks found inside: ("test.app/Contents/PlugIns/imageformats/libqgif.dylib")
    Log: copied: "/usr/local/Qt-5.0.1/plugins/imageformats/libqico.dylib"
    Log: to "test.app/Contents/PlugIns/imageformats/libqico.dylib"
    Log:
    Log: Deploying Qt frameworks found inside: ("test.app/Contents/PlugIns/imageformats/libqico.dylib")
    Log: copied: "/usr/local/Qt-5.0.1/plugins/imageformats/libqjpeg.dylib"
    Log: to "test.app/Contents/PlugIns/imageformats/libqjpeg.dylib"
    Log:
    Log: Deploying Qt frameworks found inside: ("test.app/Contents/PlugIns/imageformats/libqjpeg.dylib")
    Log: copied: "/usr/local/Qt-5.0.1/plugins/imageformats/libqmng.dylib"
    Log: to "test.app/Contents/PlugIns/imageformats/libqmng.dylib"
    Log:
    Log: Deploying Qt frameworks found inside: ("test.app/Contents/PlugIns/imageformats/libqmng.dylib")
    Log: copied: "/usr/local/Qt-5.0.1/plugins/imageformats/libqtga.dylib"
    Log: to "test.app/Contents/PlugIns/imageformats/libqtga.dylib"
    Log:
    Log: Deploying Qt frameworks found inside: ("test.app/Contents/PlugIns/imageformats/libqtga.dylib")
    Log: copied: "/usr/local/Qt-5.0.1/plugins/imageformats/libqtiff.dylib"
    Log: to "test.app/Contents/PlugIns/imageformats/libqtiff.dylib"
    Log:
    Log: Deploying Qt frameworks found inside: ("test.app/Contents/PlugIns/imageformats/libqtiff.dylib")
    Log: copied: "/usr/local/Qt-5.0.1/plugins/imageformats/libqwbmp.dylib"
    Log: to "test.app/Contents/PlugIns/imageformats/libqwbmp.dylib"
    Log:
    Log: Deploying Qt frameworks found inside: ("test.app/Contents/PlugIns/imageformats/libqwbmp.dylib")
    Log: Created configuration file: "test.app/Contents/Resources/qt.conf"
    Log: This file sets the plugin search path to "test.app/Contents/PlugIns"
    @

    bq. But still i am facing the same issue.
    QNetworkConfigurationManager at run time has to query to system to get the session information etc.
    Can if due to any reason my test application does not have permission to communicate with the system libraries? Can it be possiblity? Please let me know your thought ?



  • You are missing the plugins under PlugIns/bearer. I would expect to find two plugins in that location, corewlan and generic.



  • it worked.... i copied the contents of bearer into Plugin and changed the path using install_name_tool -change command . Thanks you !!


  • Lifetime Qt Champion

    I knew there was something I forgot in the plugins... Great you found out !

    Don't forget to update the thread's title to solved so other forum users may know a solution has been found :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.