scons qt5 on linux platform
building on linux (at least my Ubuntu 17.04 machine) requires to slightly patch data/scons/qt5.py because Qt is not found, while it is available. Fix is simple:
pcmodules = [module+debugSuffix for module in ...
should be changed into
pcmodules = [module.replace('Qt','Qt5')+debugSuffix for module in ...
I can confirm that I both have this problem (on Debian unstable) and that the suggested fix fixes it.
...well, up to a point. I also had to hack the config.py file to add -fPIC to the compiler flags, or else Qt would bail out with an error. (But you can't use -fPIE as well.)
Unfortunately, whether you need -fPIC or not appears to depend on the compilation options for the Qt library itself, so knowing whether we need it or not seems hard. I'd have thought pkg-config would know, but it seems not to...
I'm on clean Ubuntu 16.04 and tried to build mitsuba with Qt5. The described modifications are not enough for my case. I did what described in this thread. After that,I fixed header (QtGui -> QtWidgets migration). I also removed all occurrences of UnicodeUTF8.
Finally, I've got error:
build/release/mtsgui/moc_aboutdlg.cc:13:2: error: #error "This file was generated using the moc from 4.8.7. It cannot be used with the include files from this version of Qt. (The moc has changed too much.)"
And them some other errors in the same file
build/release/mtsgui/moc_aboutdlg.cc:55:7: error: ‘QMetaObjectExtraData’ does not name a type const QMetaObjectExtraData AboutDialog::staticMetaObjectExtraData = { ^ build/release/mtsgui/moc_aboutdlg.cc:61:34: error: ‘staticMetaObjectExtraData’ was not declared in this scope qt_meta_data_AboutDialog, &staticMetaObjectExtraData } ^ build/release/mtsgui/moc_aboutdlg.cc: In member function ‘virtual const QMetaObject* AboutDialog::metaObject() const’: build/release/mtsgui/moc_aboutdlg.cc:70:71: error: conditional expression between distinct pointer types ‘QDynamicMetaObjectData*’ and ‘const QMetaObject*’ lacks a cast return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
Debian/Ubuntu have (IIRC) a moc wrapper which uses an environment variable to decide whether to run the Qt4 moc or the Qt5 one. I suspect I don't have Qt4 installed, so it always picks the Qt5 one for me.
You might try doing export QT_SELECT=5 before the build and seeing what happens (you'll need to clean first).
It worked! I also had to add -std=c++14 to config.py complier flags.
pkestene's fix did not work for me. Instead, I hardcoded the list:
pcmodules = ['QtGui', 'Qt5Widgets', 'QtCore', 'Qt5OpenGL', 'QtXml', 'QtXmlPatterns', 'QtNetwork'].