Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. QNetworkConfigurationManager is not working as expected after deploying using macdeployqt tool in MAC.
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Installation and Deployment
11 Posts 3 Posters 4.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shyju
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to DevNet,

      Please enclose your code with code tags.

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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S Offline
        S Offline
        shyju
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

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

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • S Offline
            S Offline
            shyju
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              shyju
              wrote on last edited by
              #6

              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.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                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 ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  shyju
                  wrote on last edited by
                  #8

                  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

                  • qmake -config debug test.pro

                  for release

                  • qmake -config release test.pro

                  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 ?

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    amccarthy
                    wrote on last edited by
                    #9

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

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      shyju
                      wrote on last edited by
                      #10

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

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        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 :)

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved