Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QDesktopServices::openUrl failing on KDE Fedora Linux (Qt_6.10_PRIVATE_API not found)

QDesktopServices::openUrl failing on KDE Fedora Linux (Qt_6.10_PRIVATE_API not found)

Scheduled Pinned Locked Moved Solved General and Desktop
kdefedora
9 Posts 4 Posters 389 Views 3 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.
  • K Offline
    K Offline
    Karob
    wrote last edited by
    #1

    Hello.

    I was on Fedora Linux 42 (KDE Plasma version). I installed Qt 6.10.1, Qt Build Tools, and Qt Creator 18.0.1 from Qt's online installer. Building and testing a C++/CMake Qt app mostly worked without issue, but whenever I try to open a URL, e.g.:

    QDesktopServices::openUrl(QUrl("file:///home/karob/Documents/notes.txt", QUrl::TolerantMode));
    

    I get the error:

    kde-open: /home/karob/Qt/6.10.1/gcc_64/lib/libQt6Gui.so.6: version `Qt_6.9_PRIVATE_API' not found (required by /lib64/libKF6WindowSystem.so.6)
    

    I tried installing and switching the project kit to Qt 6.9.3, to which I got this error.

    kde-open: /home/karob/Qt/6.9.3/gcc_64/lib/libQt6Gui.so.6: version `Qt_6.9_PRIVATE_API' not found (required by /lib64/libKF6WindowSystem.so.6)
    

    I tried upgrading to Fedora 43 and switching the project back to Qt 6.10.1, which only changed the error message to:

    kde-open: /home/karob/Qt/6.10.1/gcc_64/lib/libQt6Gui.so.6: version `Qt_6.10_PRIVATE_API' not found (required by /lib64/libKF6WindowSystem.so.6)
    

    When I run strings /home/karob/Qt/6.10.1/gcc_64/lib/libQt6Gui.so.6|grep Qt.*API, I only get "Qt_6_PRIVATE_API" (notice the lack of a minor version number). Does anyone know what I can do to get QDesktopServices::openUrl to work, or to further diagnose the issue?

    Pl45m4P 1 Reply Last reply
    0
    • K Karob

      Hello.

      I was on Fedora Linux 42 (KDE Plasma version). I installed Qt 6.10.1, Qt Build Tools, and Qt Creator 18.0.1 from Qt's online installer. Building and testing a C++/CMake Qt app mostly worked without issue, but whenever I try to open a URL, e.g.:

      QDesktopServices::openUrl(QUrl("file:///home/karob/Documents/notes.txt", QUrl::TolerantMode));
      

      I get the error:

      kde-open: /home/karob/Qt/6.10.1/gcc_64/lib/libQt6Gui.so.6: version `Qt_6.9_PRIVATE_API' not found (required by /lib64/libKF6WindowSystem.so.6)
      

      I tried installing and switching the project kit to Qt 6.9.3, to which I got this error.

      kde-open: /home/karob/Qt/6.9.3/gcc_64/lib/libQt6Gui.so.6: version `Qt_6.9_PRIVATE_API' not found (required by /lib64/libKF6WindowSystem.so.6)
      

      I tried upgrading to Fedora 43 and switching the project back to Qt 6.10.1, which only changed the error message to:

      kde-open: /home/karob/Qt/6.10.1/gcc_64/lib/libQt6Gui.so.6: version `Qt_6.10_PRIVATE_API' not found (required by /lib64/libKF6WindowSystem.so.6)
      

      When I run strings /home/karob/Qt/6.10.1/gcc_64/lib/libQt6Gui.so.6|grep Qt.*API, I only get "Qt_6_PRIVATE_API" (notice the lack of a minor version number). Does anyone know what I can do to get QDesktopServices::openUrl to work, or to further diagnose the issue?

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote last edited by
      #2

      @Karob

      I dont know why, somehow it is asking for Qt's private API (headers), which can but better should not be used, since they might introduce heavy changes between two versions without any notice. That's why they are private.
      Not sure if KDE Plasma uses them, which would couple the Qt version to that one specific version.

      Are you sure the Qt version you are using to code the your downloaded version and not the system version that comes with KDE Plasma? How does your kit in QtCreator look like?


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      1 Reply Last reply
      0
      • K Offline
        K Offline
        Karob
        wrote last edited by
        #3

        Sorry, I'm not sure what information you are looking for. Here are some screenshots.

        s1768966103.png
        s1768966108.png
        s1768966139.png

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

          Hi,

          A shot in the dark but, add the QT_DEBUG_PLUGINSenvironment variable in the Run part of the Project panel and set it to 1. Then check the output of your application. I suspect that there's a system plugin getting loaded that is not built with the same Qt version.

          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
          • Axel SpoerlA Offline
            Axel SpoerlA Offline
            Axel Spoerl
            Moderators
            wrote last edited by
            #5

            Hi,

            you have run into this issue.

            Unfortunately there is no easy fix for it.
            In the application I was trying to build before I reported it, I ended up building in a customisable option. Users can specify in the application settings whether they want to use QDesktopServices::openUrl() or a custom executable instead. On my system, I just use xdg-open launched in a QProcess.

            Software Engineer
            The Qt Company, Oslo

            1 Reply Last reply
            1
            • K Offline
              K Offline
              Karob
              wrote last edited by
              #6

              Thank you, that clarifies it very well. I was worried this PRIVATE_API issue would be a broader problem where whole swaths of Qt would be inaccessible to me, but if it's specific to QDesktopServices::openUrl(), then I can be content with a workaround as you have suggested.

              1 Reply Last reply
              0
              • K Karob has marked this topic as solved
              • K Offline
                K Offline
                Karob
                wrote last edited by
                #7

                I spoke prematurely. @Axel-Spoerl 's solution does not work for me, because I am having the same errors with QProcess when launching seemingly any KDE app (kwrite, konsole, kde-open), and xdg-open appears to forward to kde-open.

                Running QProcess::execute("xdg-open", { "/" }); fails with:

                kde-open: /home/karob/Qt/6.10.1/gcc_64/lib/libQt6Gui.so.6: version `Qt_6.10_PRIVATE_API' not found (required by /lib64/libKF6WindowSystem.so.6)
                

                Running QProcess::execute("konsole"); fails with:

                /usr/bin/konsole: /home/karob/Qt/6.10.1/gcc_64/lib/libQt6Gui.so.6: version `Qt_6.10_PRIVATE_API' not found (required by /lib64/libKF6DBusAddons.so.6)
                /usr/bin/konsole: /home/karob/Qt/6.10.1/gcc_64/lib/libQt6Core.so.6: version `Qt_6.10_PRIVATE_API' not found (required by /lib64/libKF6XmlGui.so.6)
                /usr/bin/konsole: /home/karob/Qt/6.10.1/gcc_64/lib/libQt6Gui.so.6: version `Qt_6.10_PRIVATE_API' not found (required by /lib64/libKF6ConfigWidgets.so.6)
                /usr/bin/konsole: /home/karob/Qt/6.10.1/gcc_64/lib/libQt6Gui.so.6: version `Qt_6.10_PRIVATE_API' not found (required by /lib64/libKF6WindowSystem.so.6)
                /usr/bin/konsole: /home/karob/Qt/6.10.1/gcc_64/lib/libQt6Gui.so.6: version `Qt_6.10_PRIVATE_API' not found (required by /lib64/libKF6IconThemes.so.6)
                /usr/bin/konsole: /home/karob/Qt/6.10.1/gcc_64/lib/libQt6Gui.so.6: version `Qt_6.10_PRIVATE_API' not found (required by /lib64/libKF6GlobalAccel.so.6)
                /usr/bin/konsole: /home/karob/Qt/6.10.1/gcc_64/lib/libQt6Gui.so.6: version `Qt_6.10_PRIVATE_API' not found (required by /lib64/libKF6KIOWidgets.so.6)
                /usr/bin/konsole: /home/karob/Qt/6.10.1/gcc_64/lib/libQt6Gui.so.6: version `Qt_6.10_PRIVATE_API' not found (required by /lib64/libKF6ColorScheme.so.6)
                /usr/bin/konsole: /home/karob/Qt/6.10.1/gcc_64/lib/libQt6Gui.so.6: version `Qt_6.10_PRIVATE_API' not found (required by /lib64/libKF6JobWidgets.so.6)
                /usr/bin/konsole: /home/karob/Qt/6.10.1/gcc_64/lib/libQt6Core.so.6: version `Qt_6.10_PRIVATE_API' not found (required by /lib64/libQt6TextToSpeech.so.6)
                

                Non-KDE Qt apps launch fine, such as qpwgraph and qdirstat.

                Is there a further diagnosis for this, or a way to launch a process without the private API issue, or is there a way to launch a file or path in its default app without relying on kde-open in this environment?

                1 Reply Last reply
                0
                • K Karob has marked this topic as unsolved
                • Axel SpoerlA Offline
                  Axel SpoerlA Offline
                  Axel Spoerl
                  Moderators
                  wrote last edited by
                  #8

                  There are two things you can do, @Karob :
                  The underlying problem is, that your application is loading the Qt version you installed via the Qt online installer.
                  My guess is that your local LD_LIBRARY_PATH is set to something under /home/karob/Qt/6.10.1/...

                  1. Unset LD_LIBRARY_PATH
                    I personally find LD_LIBRARY_PATH a kitten murderer. It's easy to use and can cause terrible spill overs, because it affects all your dynamically linked applications. Better to unset and compile the application with a run path.
                    That would be something like
                  set(LOCALQT, "/home/karob/Qt/6.10.1/gcc_64/lib")
                  set_target_properties(KarobsApp PROPERTIES
                      BUILD_RPATH "${LOCALQT}"
                      INSTALL_RPATH "${LOCALQT}"
                      INSTALL_RPATH_USE_LINK_PATH TRUE
                  )
                  
                  1. Eliminate LD_LIBRARY_PATH from process environment
                    Use xdg-open. Before starting your QProcess, do the following:
                  auto env = karobsProcess.processEnvironment();
                  env.remove("LD_LIBRARY_PATH");
                  karobsProcess.setProcessEnvironment(env);
                  

                  Software Engineer
                  The Qt Company, Oslo

                  1 Reply Last reply
                  0
                  • K Offline
                    K Offline
                    Karob
                    wrote last edited by
                    #9

                    @Axel-Spoerl I tried the second option via:

                    QProcess process(this);
                    process.setProcessChannelMode(QProcess::ForwardedChannels);
                    auto env = process.processEnvironment();
                    env.remove("LD_LIBRARY_PATH");
                    process.setProcessEnvironment(env);
                    process.start("xdg-open", { "/" });
                    process.waitForFinished(-1);
                    

                    This still resulted in the same errors for some reason.

                    But you pointed me in the right direction. I realized everything works correctly when the built files are executed outside of Qt Creator. (I should have tried this from the start.) I found the option "Add build library search path to LD_LIBRARY_PATH" in Qt Creator's run settings for the configuration.

                    s1769126557.png

                    Unchecking that causes QDesktopServices::openUrl (and QProcess::start with xdg-open) to work correctly in my app even when launched from Qt Creator.

                    1 Reply Last reply
                    3
                    • K Karob has marked this topic as solved

                    • Login

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