Qt5 development primer

Page  
3

January 23, 2012

oneWonders oneWonders
Lab Rat
8 posts

Ah thanks, that works, i had gcc installed but not g++ it seems.

Strangely, i cannot run demos as even if i make the executables runnable, then i get something like this:

  1. Details: Failed to execute child process "/usr/bin/tea_service" (No such file or directory)

after making the qt teaservice.desktop demo executable as a program in its right click properties and trying to run.
Somehow i get the impression that this is not what i am meant to be doimng anyway, as the idea that i would have to right click and change the permissions of all the demo files that i wanted to run doesn’t seem the most fun so i guess i am trying to do it the wrong way :$

Also, i tried to compile qt creator and the qtquick3d demos myself and got errors.
(For example, for the qtquick3d):

  1. daniel@andy-desktop:~/qt_creator/what$ qmake /home/daniel/qt5/qtquick3d/demos/demos.pro
  2. daniel@andy-desktop:~/qt_creator/what$ sudo make
  3. cd quick3d/ && /home/daniel/qt5/qtbase/bin/qmake /home/daniel/qt5/qtquick3d/demos/quick3d/quick3d.pro -o Makefile
  4. cd quick3d/ && make -f Makefile
  5. make[1]: Entering directory `/home/daniel/qt_creator/what/quick3d'
  6. cd model_viewer/ && /home/daniel/qt5/qtbase/bin/qmake /home/daniel/qt5/qtquick3d/demos/quick3d/model_viewer/model_viewer.pro -o Makefile
  7. cd model_viewer/ && make -f Makefile
  8. make[2]: Entering directory `/home/daniel/qt_creator/what/quick3d/model_viewer'
  9. g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_DECLARATIVE_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../../qt5/qtbase/mkspecs/linux-g++ -I../../../../qt5/qtquick3d/demos/quick3d/model_viewer -I../../../../qt5/qtbase/include/QtCore -I../../../../qt5/qtbase/include/QtGui -I../../../../qt5/qtbase/include/QtWidgets -I../../../../qt5/qtdeclarative/include -I../../../../qt5/qtdeclarative/include/QtDeclarative -I../../../../qt5/qtbase/include -I../../../../qt5/qtbase/include/QtNetwork -I../../../../qt5/qtxmlpatterns/include -I../../../../qt5/qtxmlpatterns/include/QtXmlPatterns -I/usr/X11R6/include -I. -I../../../../qt5/qtquick3d/demos/quick3d/model_viewer -I. -o main.o ../../../../qt5/qtquick3d/demos/quick3d/model_viewer/main.cpp
  10. In file included from ../../../../qt5/qtbase/include/QtGui/qopengl.h:1:0,
  11.                  from ../../../../qt5/qtdeclarative/include/QtDeclarative/../../src/declarative/items/qquickcanvas.h:46,
  12.                  from ../../../../qt5/qtdeclarative/include/QtDeclarative/qquickcanvas.h:1,
  13.                  from ../../../../qt5/qtdeclarative/include/QtDeclarative/../../src/declarative/items/qquickview.h:46,
  14.                  from ../../../../qt5/qtdeclarative/include/QtDeclarative/qquickview.h:1,
  15.                  from ../../../../qt5/qtdeclarative/include/QtDeclarative/QQuickView:1,
  16.                  from ../../../../qt5/qtquick3d/demos/quick3d/model_viewer/../qmlres.h:47,
  17.                  from ../../../../qt5/qtquick3d/demos/quick3d/model_viewer/main.cpp:42:
  18. ../../../../qt5/qtbase/include/QtGui/../../src/gui/opengl/qopengl.h:69:21: fatal error: GL/gl.h: No such file or directory
  19. compilation terminated.
  20. make[2]: *** [main.o] Error 1
  21. make[2]: Leaving directory `/home/daniel/qt_creator/what/quick3d/model_viewer'
  22. make[1]: *** [sub-model_viewer-make_default] Error 2
  23. make[1]: Leaving directory `/home/daniel/qt_creator/what/quick3d'
  24. make: *** [sub-quick3d-make_default] Error 2

Sorry to be a pain.

January 24, 2012

bunjee bunjee
Lab Rat
120 posts

Greetings guys,

On Windows 7 ×64 I get the following:

  1. qwindowstheme.cpp: In member function 'virtual QVariant QWindowsTheme::themeHint(QPlatformTheme::ThemeHint) const': qwindowstheme.cpp:77:53: error: 'SPI_GETDROPSHADOW' was not declared in this scope

It seems that the SPI_GETDROPSHADOW is under a WIN_NT_32 define.

January 27, 2012

Philius Philius
Lab Rat
34 posts

I just restarted my attempt at building Qt5 after spending a day finding out that wayland isn’t ready for Debian Wheezy amd64 yet.

By running configure with the “-v” switch I could see the auto-detection tests and their results – I needed to install libasound2-dev for Alsa.

Note:

  1. make confclean

does nothing – “confclean” isn’t a valid makefile target, although configure tells you to use this to clean up before another configure run.

Maybe someone could add

  1. confclean:
  2. <tab>git submodule foreach --recursive 'git clean -dfx'

to the right makefile to tie things up.

Also, see the

  1. qtbase/configure: 7201: [: x86_64: unexpected operator

error after the “rm -f …” entries below.

The error is

  1. if [ -n "$_SBOX_DIR" -a "$CFG_ARCH" == "arm" ]; then

This is a “bashism” – something only bash understands.
Although /bin/sh was usually symlinked to /bin/bash, on Debian Wheezy /bin/sh -> dash.

“dash” and therefore “sh” doesn’t recognise “[” and doesn’t like “==”.

  1. if test -n "$_SBOX_DIR" && test "$CFG_ARCH" = "arm"; then

It occurs lots of times in this configure script – maybe in others too.

Somehow it muddles through. I’d recommend using “set -e” to catch these.

Anyway here’s my configure output, after doing the recursive clean command above.

  1. + /v3c/dev/Graphics/Qt/qt5/qtbase/configure -prefix /v3c/dev/Graphics/Qt/qt5/qtbase -no-wayland -opengl -no-glib -opensource -confirm-license -qpa -v
  2. Determining system architecture... (Linux:3.0.0-1-amd64:x86_64)
  3.     64-bit AMD 80x86 (x86_64)
  4.     'x86_64' is supported
  5. System architecture: 'x86_64'
  6. Host architecture: 'x86_64'
  7. Precompiled-headers support enabled.
  8. Symbol visibility control enabled.
  9. Symbolic function binding enabled.
  10.  
  11. This is the Qt Lighthouse Open Source Edition.
  12.  
  13. You are licensed to use this software under the terms of
  14. the Lesser GNU General Public License (LGPL) versions 2.1.
  15.  
  16. You have already accepted the terms of the  license.

bootstrapping and feature tests…

  1. /v3c/dev/Graphics/Qt/qt5/qtbase/configure: 7201: [: x86_64: unexpected operator
  2. Testing size of pointers ... (/v3c/dev/Graphics/Qt/qt5/qtbase/mkspecs/linux-g++-64 yes /v3c/dev/Graphics/Qt/qt5/qtbase /v3c/dev/Graphics/Qt/qt5/qtbase)
  3. rm -f ptrsizetest.o
  4. rm -f *~ core *.core
  5. g++ -c -m64 -pipe -O2 -Wall -W  -I../../../mkspecs/linux-g++-64 -I. -o ptrsizetest.o ptrsizetest.cpp
  6. g++ -m64 -Wl,-O1 -o ptrsizetest ptrsizetest.o      
  7. Pointer size: 8
  8. ln: failed to create symbolic link `/v3c/dev/Graphics/Qt/qt5/qtbase/include/QtCore/qconfig.h': File exists
  9. ln: failed to create symbolic link `/v3c/dev/Graphics/Qt/qt5/qtbase/include/Qt/qconfig.h': No such file or directory
  10.  
  11.         This target is using the GNU C++ compiler (linux-g++-64).
  12.  
  13.         Recent versions of this compiler automatically include code for
  14.         exceptions, which increase both the size of the Qt libraries and
  15.         the amount of memory taken by your applications.
  16.  
  17.         You may choose to re-run configure with the -no-exceptions
  18.         option to compile Qt without exceptions. This is completely binary
  19.         compatible, and existing applications will continue to work.
  20.  
  21.  
  22. Build type:    linux-g++-64
  23. Architecture:  x86_64
  24. Host architecture: x86_64
  25. Platform notes:
  26.  
  27.             - Also available for Linux: linux-kcc linux-icc linux-cxx
  28.        
  29. qmake vars .......... cat: .qmake.vars: No such file or directory
  30. qmake switches .........
  31. Build .................. libs examples tests
  32. Configuration ..........  release shared dll qpa largefile stl precompile_header mmx 3dnow sse sse2 sse3 ssse3 sse4_1 sse4_2 avx  minimal-config small-config medium-config large-config full-config fontconfig xlib xrender xcb-render accessibility openvg opengl qpa reduce_exports reduce_relocations clock-gettime clock-monotonic mremap getaddrinfo ipv6ifname getifaddrs inotify system-jpeg system-png png system-tiff system-freetype system-zlib nis cups dbus openssl xcb alsa concurrent audio-backend svg v8 v8snapshot release
  33. Debug .................. no
  34. QtDBus module .......... yes (run-time)
  35. QtConcurrent code ...... yes
  36. QtGui module ........... yes
  37. QtScript module ........ yes
  38. QtScriptTools module ... yes
  39. QtXmlPatterns module ... yes
  40. Phonon module .......... no
  41. Multimedia module ...... auto
  42. SVG module ............. yes
  43. WebKit module .......... yes
  44. JavaScriptCore JIT ..... To be decided by JavaScriptCore
  45. V8 module .............. yes
  46. Declarative module ..... yes
  47. Declarative debugging ...yes
  48. Location module ........ no
  49. STL support ............ yes
  50. PCH support ............ yes
  51. MMX/3DNOW/SSE/SSE2/SSE3. yes/yes/yes/yes/yes
  52. SSSE3/SSE4.1/SSE4.2..... yes/yes/yes
  53. AVX..................... yes
  54. IPv6 ifname support .... yes
  55. getaddrinfo support .... yes
  56. getifaddrs support ..... yes
  57. Accessibility .......... yes
  58. NIS support ............ yes
  59. CUPS support ........... yes
  60. Iconv support .......... no
  61. Glib support ........... no
  62. GStreamer support ...... no
  63. PulseAudio support ..... no
  64. Large File support ..... yes
  65. GIF support ............ plugin
  66. TIFF support ........... plugin (system)
  67. JPEG support ........... plugin (system)
  68. PNG support ............ yes (system)
  69. zlib support ........... system
  70. Session management ..... auto
  71. OpenGL support ......... yes (Desktop OpenGL)
  72. OpenVG support ......... yes
  73. MySQL support .......... plugin
  74. PostgreSQL support ..... plugin
  75. SQLite support ......... plugin (qt)
  76. OpenSSL support ........ yes (run-time)
  77. Alsa support ........... yes
  78. libICU support ......... no
  79. Xcb support ............ limited (old version)
  80. Xrender support ........ yes

(continued…)

January 30, 2012

Philius Philius
Lab Rat
34 posts

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”

  1. ./qtwebkit/Tools/WebKitTestRunner/Target.pri

This needs to “#include <QNetworkCookie>”

  1. ./qtwebkit/Tools/QtTestBrowser/cookiejar.cpp

This uses “ QTouchEvent::TouchPoint::Primary” – I commented it (and the “if” statement) out to get further.

  1. ./qtwebkit/Tools/MiniBrowser/qt/MiniBrowserApplication.cpp

This needs “Qt += quick”

  1. ./qtwebkit/Tools/MiniBrowser/qt/MiniBrowser.pro

This needs to “#include <QNetworkCookie>”

  1. ./qtwebkit/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp

These need “Qt += quick”

  1. ./qtwebkit/Source/api.pri
  2. ./qtwebkit/Source/tests.pri

This wasn’t tested with “regular” OpenGL

  1. ./qtwebkit/Source/WebCore/platform/graphics/cairo/OpenGLShims.cpp

Here’s the change I made to it.

  1.  #if PLATFORM(QT)
  2.  static void* getProcAddress(const char* procName)
  3.  {
  4. -    return QGLContext::currentContext()->getProcAddress(QString::fromLatin1(procName));
  5. +    return (void *)QGLContext::currentContext()
  6. +        ->getProcAddress(QString::fromLatin1(procName));
  7.  }
  8.  #else
  9.  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.

  1. ./qtbase/include/QtWebKit/qwebview.h
  2. ./qtbase/include/QtWebKit/qwebframe.h
  3. ./qtbase/include/QtWebKit/qwebkitversion.h
  4. ./qtbase/include/QtWebKit/qwebpluginfactory.h
  5. ./qtbase/include/QtWebKit/qwebinspector.h
  6. ./qtbase/include/QtWebKit/qwebkitplatformplugin.h
  7. ./qtbase/include/QtWebKit/qwebhistoryinterface.h
  8. ./qtbase/include/QtWebKit/qwebsecurityorigin.h
  9. ./qtbase/include/QtWebKit/qwebelement.h
  10. ./qtbase/include/QtWebKit/qwebpage.h
  11. ./qtbase/include/QtWebKit/qwebdatabase.h
  12. ./qtbase/include/QtWebKit/qwebhistory.h
  13. ./qtbase/include/QtWebKit/qwebkitglobal.h
  14. ./qtbase/include/QtWebKit/qwebsettings.h

Hope this helps.

January 30, 2012

Philius Philius
Lab Rat
34 posts

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.

January 30, 2012

sierdzio sierdzio
Area 51 Engineer
2327 posts

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 [developer.qt.nokia.com] wiki page might be a good idea.

 Signature 

(Z(:^

January 30, 2012

Philius Philius
Lab Rat
34 posts

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.

January 30, 2012

angrymango angrymango
Lab Rat
3 posts

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

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

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

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

January 30, 2012

Philius Philius
Lab Rat
34 posts

Those “QT += quick” are needed on Debian Wheezy because of

  1. ld.bfd: "could not read symbols: Invalid operation" after indirect reference is unhelpful
  2. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=629498

January 31, 2012

angrymango angrymango
Lab Rat
3 posts

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

January 31, 2012

Philius Philius
Lab Rat
34 posts

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.

January 31, 2012

angrymango angrymango
Lab Rat
3 posts

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.

January 31, 2012

Philius Philius
Lab Rat
34 posts

I just started a shadow build.
Here’s the makefile (same dir as qt5).

  1. all: config
  2.  cd qt5-build; \
  3.  export PATH="${PATH}:$$(readlink -f qtbase/bin)"; \
  4.  make -j 2 && make install
  5.  
  6. config: #clean
  7.  mkdir -p qt5-build
  8.  mkdir -p qt5-install
  9.  cd qt5-build; \
  10.  if test ! -f config.stamp; then \
  11.   ../qt5/configure -prefix $$(readlink -f ../qt5-install) -no-wayland \
  12.   -no-openvg -opengl es2 -opensource -confirm-license -v \
  13.   -I /usr/include/gstreamer-0.10 \
  14.   -I /usr/include/glib-2.0 \
  15.   -I /usr/lib/x86_64-linux-gnu/glib-2.0/include \
  16.   -I /usr/include/libxml2 \
  17.   2>&1 | tee make.txt; \
  18.   touch config.stamp; \
  19.  else \
  20.   echo "Config target already done."; \
  21.  fi
  22.  
  23. clean:
  24.  #cd qt5; git submodule foreach --recursive 'git clean -dfx'
  25.  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.

January 31, 2012

Philius Philius
Lab Rat
34 posts

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

I’ll “make clean” and “try” yet again.

January 31, 2012

Philius Philius
Lab Rat
34 posts

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

  1. export QMAKESPEC="linux-g++-64"

otherwise svg and phonon modules fail.

I added

  1. -prefix ${ROOT}/qtbase

otherwise qmake won’t find qmodule.pri.

I added

  1. 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:

  1. ../../../../Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp: In member function ‘void WebCore::GraphicsContext3DPrivate::blitMultisampleFramebuffer() const:
  2. ../../../../Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp:261:23: error: ‘GL_READ_FRAMEBUFFER_EXT’ was not declared in this scope
  3. ../../../../Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp:262:23: error: ‘GL_DRAW_FRAMEBUFFER_EXT’ was not declared in this scope
  4. 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.

Page  
3

  ‹‹ [SOLVED] You are not allowed to edit this page.      How to create and use custom libraries on Windows ››

You must log in to post a reply. Not a member yet? Register here!