Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Behind the Scenes
  3. Wiki Discussion
  4. Qt5 development primer
Forum Update on Monday, May 27th 2025

Qt5 development primer

Scheduled Pinned Locked Moved Wiki Discussion
166 Posts 72 Posters 201.1k Views
  • 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.
  • P Offline
    P Offline
    Philius
    wrote on last edited by
    #35

    Here's a list of files I had to modify on my way to discovering that libQtdesigner is needed for qtbase/plugins/designer/libqwebview.so but wasn't built yet.

    This needs "Qt += quick"
    @
    ./qtwebkit/Tools/WebKitTestRunner/Target.pri
    @

    This needs to "#include <QNetworkCookie>"
    @
    ./qtwebkit/Tools/QtTestBrowser/cookiejar.cpp
    @

    This uses " QTouchEvent::TouchPoint::Primary" - I commented it (and the "if" statement) out to get further.
    @
    ./qtwebkit/Tools/MiniBrowser/qt/MiniBrowserApplication.cpp
    @

    This needs "Qt += quick"
    @
    ./qtwebkit/Tools/MiniBrowser/qt/MiniBrowser.pro
    @

    This needs to "#include <QNetworkCookie>"
    @
    ./qtwebkit/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp
    @

    These need "Qt += quick"
    @
    ./qtwebkit/Source/api.pri
    ./qtwebkit/Source/tests.pri
    @

    This wasn't tested with "regular" OpenGL
    @
    ./qtwebkit/Source/WebCore/platform/graphics/cairo/OpenGLShims.cpp
    @

    Here's the change I made to it.
    @
    #if PLATFORM(QT)
    static void* getProcAddress(const char* procName)
    {

    • return QGLContext::currentContext()->getProcAddress(QString::fromLatin1(procName));
    • return (void *)QGLContext::currentContext()
    •    ->getProcAddress(QString::fromLatin1(procName));
      

    }
    #else
    typedef void* (glGetProcAddressType) (const char procName);
    @

    These assume they're only included from within WebKit - untrue.
    Yes, I later realized that this isn't the right place to change them.
    @
    ./qtbase/include/QtWebKit/qwebview.h
    ./qtbase/include/QtWebKit/qwebframe.h
    ./qtbase/include/QtWebKit/qwebkitversion.h
    ./qtbase/include/QtWebKit/qwebpluginfactory.h
    ./qtbase/include/QtWebKit/qwebinspector.h
    ./qtbase/include/QtWebKit/qwebkitplatformplugin.h
    ./qtbase/include/QtWebKit/qwebhistoryinterface.h
    ./qtbase/include/QtWebKit/qwebsecurityorigin.h
    ./qtbase/include/QtWebKit/qwebelement.h
    ./qtbase/include/QtWebKit/qwebpage.h
    ./qtbase/include/QtWebKit/qwebdatabase.h
    ./qtbase/include/QtWebKit/qwebhistory.h
    ./qtbase/include/QtWebKit/qwebkitglobal.h
    ./qtbase/include/QtWebKit/qwebsettings.h
    @

    Hope this helps.

    1 Reply Last reply
    0
    • P Offline
      P Offline
      Philius
      wrote on last edited by
      #36

      I had to choose between OpenGL and GL ES2 but I could also select xcb.

      Isn't qpa building about being able to select between all of these at run-time?

      On Debian Wheezy I've got the libraries and development packages installed to support OpenGL and GL ES2.

      Also, maybe "build.stamp" and "install.stamp" files marking modules as built/installed could help "make" or "make install" skip modules entirely and speed things up.

      If specifying "-prefix $PWD/qtbase" is your way of saying Qt5 isn't ready for "-prefix /usr" then you could have made that point a little more prominently.

      1 Reply Last reply
      0
      • sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #37

        Philius, I think it would be nice if you posted your findings to Qt development mailing list, where devs are likely to pick it up. And/ or modifying the "Building Qt5 from Git":http://developer.qt.nokia.com/wiki/Building_Qt_5_from_Git wiki page might be a good idea.

        (Z(:^

        1 Reply Last reply
        0
        • P Offline
          P Offline
          Philius
          wrote on last edited by
          #38

          I re-subscribed and posted an email with a QtWebkit patch although my build still (eventually) fails.

          I think that as long as the install prefix is inside the source tree (not to mention the build path!) you're going to have problems, so I won't try it again at least until these things change.

          From trying to fix problems I noticed that there are several "Release" directories created in the source tree - it looks like someone was at least trying to do some whacky kind of out-of-source-while-still-in-source deal.

          Do a "find . -type d -name Release" once you've tried to build it at least once to see the strangeness.

          I also noticed that the build process was picking header files from the install path in preference to the source directory - I've got projects that use automake that don't do that (it's a shame automake can't do the same for libraries).

          Then there's "make install" trying to copy files over themselves.

          I'll stop here.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            angrymango
            wrote on last edited by
            #39

            On OSX I got stuck with a conflict of MacTypes.h

            "http://code.google.com/p/webkit-mirror/source/detail?r=a84882c321ecf749f61a855f1538aeaf938b2340":http://code.google.com/p/webkit-mirror/source/detail?r=a84882c321ecf749f61a855f1538aeaf938b2340

            Here are some links to patches that address some of the problems mentioned by Philius:

            "https://gist.github.com/1647614":https://gist.github.com/1647614
            "https://bug-76463-attachments.webkit.org/attachment.cgi?id=122778":https://bug-76463-attachments.webkit.org/attachment.cgi?id=122778

            1 Reply Last reply
            0
            • P Offline
              P Offline
              Philius
              wrote on last edited by
              #40

              Those "QT += quick" are needed on Debian Wheezy because of
              @
              ld.bfd: "could not read symbols: Invalid operation" after indirect reference is unhelpful
              http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=629498
              @

              1 Reply Last reply
              0
              • A Offline
                A Offline
                angrymango
                wrote on last edited by
                #41

                I can confirm that all of changes mentioned by Philius are required to build on OSX.

                I also needed to add - "QT += quick" to the following files:

                ./qtwebkit/Source/WebKit/qt/declarative/public.pri
                ./qtwebkit/Source/WebKit/qt/declarative/experimental/experimental.pri
                ./qtwebkit/Source/WebKit2/UIProcess/API/qt/tests/tests.pri

                Philius - I think there are a few small mistakes in your earlier post which may be misleading to some - you say add "Qt += quick" which I believe should be "QT += quick" with upper case T

                1 Reply Last reply
                0
                • P Offline
                  P Offline
                  Philius
                  wrote on last edited by
                  #42

                  Yep.
                  While packaging my projects to get them into Debian I had my wrist slapped for referring to Qt as QT, which is QuickTime.
                  It must have stuck in my head.
                  They're spelled correctly in the patch, and anyway sometimes you have to append "quick" to the existing "QT =" or "QT +=" line.

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    angrymango
                    wrote on last edited by
                    #43

                    Very true about appending it in some cases.

                    I was wondering have you been testing qtwebkit at all? On OSX the build seems to be adding incorrect paths from the binaries to the dynamic libraries. I've fixed them up but MiniBrowser and QtTestBrowser are still not quite working properly yet. I'm going to look into it more later. I just wondered if the situation was looking any better on Linux? I'm going to try building on Ubuntu next.

                    1 Reply Last reply
                    0
                    • P Offline
                      P Offline
                      Philius
                      wrote on last edited by
                      #44

                      I just started a shadow build.
                      Here's the makefile (same dir as qt5).
                      @
                      all: config
                      cd qt5-build;
                      export PATH="${PATH}:$$(readlink -f qtbase/bin)";
                      make -j 2 && make install

                      config: #clean
                      mkdir -p qt5-build
                      mkdir -p qt5-install
                      cd qt5-build;
                      if test ! -f config.stamp; then
                      ../qt5/configure -prefix $$(readlink -f ../qt5-install) -no-wayland
                      -no-openvg -opengl es2 -opensource -confirm-license -v
                      -I /usr/include/gstreamer-0.10
                      -I /usr/include/glib-2.0
                      -I /usr/lib/x86_64-linux-gnu/glib-2.0/include
                      -I /usr/include/libxml2
                      2>&1 | tee make.txt;
                      touch config.stamp;
                      else
                      echo "Config target already done.";
                      fi

                      clean:
                      #cd qt5; git submodule foreach --recursive 'git clean -dfx'
                      rm -fr qt5-build
                      @

                      The includes are for gstreamer support.

                      It looks like OpenVG and Phonon aren't ready yet.
                      The error for them is "QMAKESPEC has not been set, so configuration cannot be deduced".

                      I'll report back when it's done.

                      1 Reply Last reply
                      0
                      • P Offline
                        P Offline
                        Philius
                        wrote on last edited by
                        #45

                        It looks like the build system doesn't track configure changes - gstreamer seems to require phonon.

                        I'll "make clean" and "try" yet again.

                        1 Reply Last reply
                        0
                        • P Offline
                          P Offline
                          Philius
                          wrote on last edited by
                          #46

                          Out of source builds definitely don't work, although this could change with new updates.

                          I'm not sure why the separate packages aren't "configure && make && make install" -able individually.
                          Maybe this is just to get them built quicker, but then they aren't really separate packages.

                          Also, providing text instructions that (currently) conflict with the README in git isn't helpful.
                          One of them should change.

                          Next, there should be a top-level "make" script which builds the tested configuration.
                          export "$ROOT" to the absolute path to the qt5 directory for the comments below.
                          I added
                          @export QMAKESPEC="linux-g++-64"@

                          otherwise svg and phonon modules fail.

                          I added
                          @-prefix ${ROOT}/qtbase@

                          otherwise qmake won't find qmodule.pri.

                          I added
                          @export PATH="${ROOT}/qtbase/bin:${PATH}"@

                          To use the binaries built in the build tree and not those installed on my system.

                          It still fails with the following error:
                          @
                          ../../../../Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp: In member function ‘void WebCore::GraphicsContext3DPrivate::blitMultisampleFramebuffer() const’:
                          ../../../../Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp:261:23: error: ‘GL_READ_FRAMEBUFFER_EXT’ was not declared in this scope
                          ../../../../Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp:262:23: error: ‘GL_DRAW_FRAMEBUFFER_EXT’ was not declared in this scope
                          make[6]: *** [obj/release-static/platform/graphics/qt/GraphicsContext3DQt.o] Error 1
                          @

                          GL_READ_FRAMEBUFFER_EXT is defined in GL/glext.h but not in OpenGL ES2, at least not in Wheezy amd64.

                          1 Reply Last reply
                          0
                          • P Offline
                            P Offline
                            Philius
                            wrote on last edited by
                            #47

                            Sorry for editing my messages but the ground is moving under me.

                            I rebuilt with "regular" OpenGL and found one more problem:
                            qtwebkit-examples-and-demos/examples/browser/cookiejar.cpp is missing "#include <QNetworkCookie>".

                            I sent a message to development@qt-project.org so hopefully the patch (along with my patch for qtwebkit) should find their way into GIT soon.

                            Other than that, with the approach detailed in my previous post, the build succeeded.

                            It took about 4 hours with "make -j 2" on my dual core laptop with both cores running at 1.867 GHz.

                            1 Reply Last reply
                            0
                            • W Offline
                              W Offline
                              werispaul
                              wrote on last edited by
                              #48

                              I had to use "-prefix CD\qtbase" option as described in the qt5 git readme file, to get through the configure step without errors. By not specifying the prefix, my mkspec (win32-msvc2010), was searched in "qtbase\bin" instead in "qtbase".

                              In addition i had to install python, because one of the compilation steps had an python call.

                              To init the QT Modules I used "git submodule init" and "git submodule update". Are there any magics behind the perl init-submodule script i'm missing (beside submodule selection and git user settings)?

                              Actually i'm trying to compile the current git master using Win 7 and VS2010 without success.

                              @ cl -c -FIqt_widgets_pch.h -Yuqt_widgets_pch.h -Fptmp\obj\debug_shared\QtWidgetsd_pch.pch -nologo -Zm200 -Zc:wchar_t -Zi -MDd -W3 -w34100 -w341
                              89 -MP -GR -EHsc -DQT_SHARED -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_BUILD_WIDGETS_LIB -DQT_NO_USING_NAMESPACE -DQT_MAKEDLL -DQT_NO_CAST_TO_ASCI
                              I -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -D_USE_MATH_DEFINES -DQT_NO_STYLE_MAC -DQT_NO_STYLE_GTK -DQT_NO_STYLE_WINDOWSCE -DQ
                              T_NO_STYLE_WINDOWSMOBILE -DQ_INTERNAL_QAPP_SRC -DQT_NO_DIRECTWRITE -DQT_DLL -DQT_GUI_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_H
                              AVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -I"....\include\QtCore" -I"....\include\QtCore\5.0.0" -I"....\include\QtCore\5.0.0\QtCore"
                              -I"....\include\QtGui\5.0.0" -I"....\include\QtGui\5.0.0\QtGui" -I"....\include\QtGui" -I"....\include" -I"....\include\QtWidgets\5.0.0" -I"....
                              \include\QtWidgets\5.0.0\QtWidgets" -I"....\include\QtWidgets" -I"....\include" -I"tmp\rcc\debug_shared" -I"tmp" -I"..\3rdparty\wintab" -I"dialogs"
                              -I"..\3rdparty\harfbuzz\src" -I"tmp\moc\debug_shared" -I"." -I"....\mkspecs\win32-msvc2010" -Fotmp\obj\debug_shared\ @C:\Users\vth\AppData\Local\Temp
                              \nmDEE9.tmp
                              qpushbutton.cpp
                              c:\qt\5.0\qtbase\include\qtwidgets\5.0.0\qtwidgets\private../../../../../src/widgets/dialogs/qdialog_p.h(61) : fatal error C1083: Datei (Include) kan
                              n nicht geöffnet werden: "QtGui/QPlatformDialogHelper": No such file or directory
                              NMAKE : fatal error U1077: ""c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cl.EXE"": Rückgabe-Code "0x2"
                              Stop.
                              NMAKE : fatal error U1077: ""c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\nmake.exe"": Rückgabe-Code "0x2"
                              Stop.
                              NMAKE : fatal error U1077: "cd": Rückgabe-Code "0x2"
                              Stop.
                              NMAKE : fatal error U1077: "cd": Rückgabe-Code "0x2"
                              Stop.@

                              Is there a nightly build process for Qt5 or kind of branch which is stable in the meaning of: at least compilable?

                              I 1 Reply Last reply
                              1
                              • R Offline
                                R Offline
                                RazrFalcon
                                wrote on last edited by
                                #49

                                Can't configure on ArchLinux x64

                                bq. No QPA platform plugin enabled!
                                If you really want to build without a QPA platform plugin you must pass
                                -no-xcb and -no-wayland to configure. Doing this will produce a Qt that
                                cannot run GUI applications.

                                But libxcb, mesa and gperf are installed.

                                Any suggestions?
                                Thanks.

                                1 Reply Last reply
                                0
                                • D Offline
                                  D Offline
                                  dangelog
                                  wrote on last edited by
                                  #50

                                  Add the option -verbose to configure to figure out which test is failing.

                                  Be sure to install almost all xcb-related packages from your distribution, esp. the ones related to the various X extensions. Double check also their version.

                                  Software Engineer
                                  KDAB (UK) Ltd., a KDAB Group company

                                  1 Reply Last reply
                                  0
                                  • R Offline
                                    R Offline
                                    RazrFalcon
                                    wrote on last edited by
                                    #51

                                    Thanks. Verbose helped.

                                    Here is my installed xcb-package list:
                                    extra/libxcb
                                    extra/xcb-proto
                                    extra/xcb-util
                                    extra/xcb-util-image
                                    extra/xcb-util-keysyms
                                    extra/xcb-util-renderutil
                                    extra/xcb-util-wm

                                    1 Reply Last reply
                                    0
                                    • R Offline
                                      R Offline
                                      RazrFalcon
                                      wrote on last edited by
                                      #52

                                      Hello again. I have a new error:

                                      @cd qtsvg/ && make -f Makefile
                                      make[1]: Entering directory /media/data/Additional/Sources/qt5/qtsvg' /media/data/Additional/Sources/qt5/qtbase/bin/qmake QMAKE_ABSOLUTE_SOURCE_PATH=/media/data/Additional/Sources/qt5/qtbase -o Makefile qtsvg.pro QMAKESPEC has not been set, so configuration cannot be deduced. Error processing project file: qtsvg.pro make[1]: *** [Makefile] Error 3 make[1]: Leaving directory /media/data/Additional/Sources/qt5/qtsvg'
                                      make: *** [module-qtsvg-make_default] Error 2@

                                      But all other moduls are build well. Error appears after hour of compilation, not at start.

                                      1 Reply Last reply
                                      0
                                      • O Offline
                                        O Offline
                                        oneWonders
                                        wrote on last edited by
                                        #53

                                        Okay it was probably all broken before as i hadn't installed the right prerequisites (the ubuntu 11.10 prerequisite had not been added to the instructions).
                                        i.e.
                                        [code]on Ubuntu Oneiric:

                                        sudo apt-get install libxcb.* libglu1-mesa-dev[/code]
                                        

                                        as oppossed to:
                                        [code]on Ubuntu/Debian:

                                        sudo aptitude install ~nlibxcb.*
                                        

                                        [/code]

                                        I now get this error on compilation:
                                        [code]In file included from ../3rdparty/freetype/src/autofit/autofit.c:23:0:
                                        ../3rdparty/freetype/src/autofit/afhints.c: In function ‘af_glyph_hints_reload’:
                                        ../3rdparty/freetype/src/autofit/afhints.c:642:21: warning: variable ‘first’ set but not used [-Wunused-but-set-variable]
                                        g++ -c -include .pch/debug-shared/QtPlatformSupport -pipe -g -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -D_REENTRANT -fPIC -DQT_SHARED -DQT_NO_WAYLAND -DQT_NO_CORESERVICES -DQT_BUILD_PLATFORMSUPPORT_LIB -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_NO_CAST_FROM_ASCII -DQT_COMPILES_IN_HARFBUZZ -DQT_NO_FONTCONFIG -DFT2_BUILD_LIBRARY -DQT_COMPILES_IN_HARFBUZZ -DQT_GUI_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_HAVE_SSE3 -DQT_HAVE_SSSE3 -DQT_HAVE_SSE4_1 -DQT_HAVE_SSE4_2 -DQT_HAVE_AVX -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I../../mkspecs/linux-g++ -I. -I../../include/QtCore -I../../include/QtCore/5.0.0 -I../../include/QtCore/5.0.0/QtCore -I../../include/QtGui/5.0.0 -I../../include/QtGui/5.0.0/QtGui -I../../include/QtGui -I../../include -I../../include/QtPlatformSupport/5.0.0 -I../../include/QtPlatformSupport/5.0.0/QtPlatformSupport -I../../include/QtPlatformSupport -I../../include -I.rcc/debug-shared -I../3rdparty/harfbuzz/src -I../3rdparty/freetype/builds/unix -I../3rdparty/freetype/src -I../3rdparty/freetype/include -I/usr/X11R6/include -I.moc/debug-shared -o .obj/debug-shared/qglxconvenience.o glxconvenience/qglxconvenience.cpp
                                        glxconvenience/qglxconvenience.cpp:47:36: fatal error: X11/extensions/Xrender.h: No such file or directory
                                        compilation terminated.
                                        make[2]: *** [.obj/debug-shared/qglxconvenience.o] Error 1
                                        make[2]: *** Waiting for unfinished jobs....
                                        make[2]: Leaving directory /home/daniel/qt5/qtbase/src/platformsupport' make[1]: *** [sub-platformsupport-make_default-ordered] Error 2 make[1]: Leaving directory /home/daniel/qt5/qtbase'
                                        make: *** [module-qtbase-make_default] Error 2
                                        [/code]

                                        So i was trying to work out what i was missing in terms of dependencies. Considering i installed libglu1-mesa-dev i am not sure.

                                        1 Reply Last reply
                                        0
                                        • W Offline
                                          W Offline
                                          werispaul
                                          wrote on last edited by
                                          #54

                                          [quote author="werispaul" date="1328263852"]Actually i'm trying to compile the current git master using Win 7 and VS2010 without success.[/quote]
                                          Finally got it working. In between I've switched from Strawberry Perl to ActivePerl. I'm not sure if it was the crux, but an option to keep in mind (as well as the order of perl in the system PATH, saw the wiki note quite late).

                                          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