Qt World Summit: Submit your Presentation

Build libQt5WebEngine*.so from sources

  • Hi,

    Under Linux (openSUSE Leap 15), I see when installing Qt5 from run file (qt-opensource-linux-x64-5.13.2.run), in /path/to/Qt5/gcc_64/lib/ folder there are libQt5WebEngine*.so libraries, which we are linking to on a project, now we want instead of installing Qt, building it from sources so that any installation of our product is not dependant of which Qt version is installed on the system, and I see, when building for instance from last sources (qt-everywhere-src-5.13.2.tar.xz), whether I try make all or make specifically module-qtwebengine-all I never got any libQt5WebEngine*.so, after the build, indeed, if I search for this kind of file I got not result but if I search in Qt5 installation path I got them:

    linux:~/dev/tmp/Qt/qt-everywhere-src-5.13.2>find . -name "libQt5WebEngine*.so"
    linux:~/dev/tmp/Qt/qt-everywhere-src-5.13.2>find /opt/Qt5/ -name "libQt5WebEngine*.so"

    I also tried to build them from git as explained in the wiki: https://wiki.qt.io/QtWebEngine/How_to_Try but still no such so file generated.

    Anybody knows if there is something I am missing or if we just can get these .so from run file installation ?


  • Lifetime Qt Champion

    @Gluttony There is no need to build Qt to not depend on installed Qt. Simply deploy your app with your Qt libraries.
    Take a look at https://doc.qt.io/qt-5/deployment.html

  • Thanks for your answer but it seems the way showed in this is actually what we was doing (and do not want to do anymore since it leads to errors when upgrading Qt on a side an trying to run an old version of our application that was using a previous Qt version, in this case we have, each time to uninstall/reinstall proper Qt version).

    Anyway, I managed to package Qt as we package all our external libraries by using the installer: installing Qt for example in /tmp/Qt/ and building a compressed archive of it that will be extracted in our corresponding external include, lib, etc. folders.

    However, when trying to build the application we have following error (that we had not when pointing our Qt dependency to an installed version in /opt/Qt5):

    [  8%] Linking CXX executable ../../../bin/Debug/app
    /usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: ../../../../External/Vendors/qt/lib/libQt5X11Extras.so.5.13.2: undefined reference to `qt_version_tag@Qt_5.13'
    collect2: error: ld returned 1 exit status
    distcc[15704] ERROR: compile (null) on localhost failed

    From what I found on the internet some people fixed this error defining QT_NO_VERSION_TAGGING, in our case with add_definitions(-DQT_NO_VERSION_TAGGING) for cmake, but this was without success.

    I also found this should be defined in libQtCore.so.5.13.2 for 5.13.2 version, there are actually several qt_version_tag@<minor.major> defined in this library but for Qt_5.13 it is defined with two @ (00000000003a8380 R qt_version_tag@@Qt_5.13) but not sure this is an issue (it may just be to point out the current version) since in libQt5X11Extras.so.5.13.2 we can see it as undefined with two @ too (U qt_version_tag@@Qt_5.13).

    For information, we also have Qt 5.9.4 installed on the system, it is needed for applications using Qt installed by the OS, but it seems not to interfere, performing a ldd on libQt5X11Extras.so.5.13.2 we are using to build shows it actually links with the proper libQtCore.so (5.13.2):

    linux:/path/to/workspace/lib/external>ldd libQt5X11Extras.so.5.13.2
    	libQt5Gui.so.5 => /path/to/workspace/lib/external/libQt5Gui.so.5 (0x00007fb7c7948000)
    linux:/path/to/workspace/lib/external>ll libQt5Core.so.5
    	libQt5Core.so.5 -> libQt5Core.so.5.13.2

    Finally, what can I say is that when we were using Qt installed on /opt/Qt5, when running nm, we can see the same declarations in libQtCore.so.5.13.2 and the same undefined in libQt5X11Extras.so.5.13.2 for qt_version_tag@@Qt_5.13.

    For now I don't know where else to search, if anybody knows what we can do it would be appreciated.


  • Lifetime Qt Champion


    You might want to check the linuxdeployqt project. It's a helper application similar to macdeployqt and windeployqt.

  • Thanks for your answer, unfortunately we already have our own process to package our application then we cannot use linuxdeployqt since from what I see it generates specific AppDir and/or AppImage packages.

  • Sorry to raising this topic, but if somebody is also struggling with that, I finally found a way to build Qt5 (including libQt5WebEngine*.so) but not from .tar.xz provided but from Git, thanks to this page: https://wiki.qt.io/Building_Qt_5_from_Git

Log in to reply