mitsuba icon indicating copy to clipboard operation
mitsuba copied to clipboard

Build on Ubuntu with Qt5 may need to modify include path

Open penguin1214 opened this issue 6 years ago • 10 comments

Qt5 rearranges the the file structure and QtGui/QAction.h and 'QtGui/QApplication.hhave been moved toQtWidgets` subdirectory and thus cause build error:

Checking for Qt 5.x... yes
Checking for g++ ...(cached) yes
Checking for C header file png.h... (cached) yes
Checking for C header file jpeglib.h... (cached) yes
Checking for C++ header file ImfRgba.h... (cached) yes
Checking for C++ header file xercesc/dom/DOMLSParser.hpp... (cached) yes
Checking for C++ header file dae.h... (cached) no
COLLADA DOM is missing: not building the COLLADA importer
Checking for C++ header file pyconfig.h... (cached) yes
Checking for C++ header file boost/version.hpp... (cached) yes
Checking for C++ header file Eigen/Core... (cached) yes
Checking for C++ header file fftw3.h... (cached) yes
Checking for C header file GL/gl.h... (cached) yes
Checking for C header file GL/glu.h... (cached) yes
Checking for C header file GL/glext.h... (cached) yes
Checking for C header file GL/glew.h... (cached) yes
Checking for C type GLEWContext... (cached) yes
Checking for C header file X11/extensions/xf86vmode.h... (cached) yes
Checking for Mitsuba version .. 0.6.0
scons: done reading SConscript files.
scons: Building targets ...
g++ -o build/release/mtsgui/aboutdlg.o -c -DGLEW_MX -O3 -Wall -g -pipe -march=nocona -msse2 -ftree-vectorize -mfpmath=sse -funsafe-math-optimizations -fno-rounding-math -fno-signaling-nans -fno-math-errno -fomit-frame-pointer -DMTS_DEBUG -DSINGLE_PRECISION -DSPECTRUM_SAMPLES=3 -DMTS_SSE -DMTS_HAS_COHERENT_RT -fopenmp -fvisibility=hidden -mtls-dialect=gnu2 -std=c++11 -fPIC -DMTS_HAS_LIBPNG=1 -DMTS_HAS_LIBJPEG=1 -DMTS_HAS_OPENEXR=1 -DMTS_HAS_FFTW=1 -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_CORE_LIB -DQT_OPENGL_LIB -DQT_XML_LIB -DQT_NETWORK_LIB -I/usr/include/eigen3 -I/usr/include/OpenEXR -Iinclude -Isrc/mtsgui -I/home/fluid/Qt5.7.0/5.7/gcc_64/include/QtOpenGL -I/home/fluid/Qt5.7.0/5.7/gcc_64/include -I/home/fluid/Qt5.7.0/5.7/gcc_64/include/QtWidgets -I/home/fluid/Qt5.7.0/5.7/gcc_64/include/QtGui -I/home/fluid/Qt5.7.0/5.7/gcc_64/include/QtXml -I/home/fluid/Qt5.7.0/5.7/gcc_64/include/QtXmlPatterns -I/home/fluid/Qt5.7.0/5.7/gcc_64/include/QtNetwork -I/home/fluid/Qt5.7.0/5.7/gcc_64/include/QtCore build/release/mtsgui/aboutdlg.cpp
In file included from build/release/mtsgui/aboutdlg.cpp:19:0:
build/release/mtsgui/ui_aboutdlg.h:15:30: fatal error: QtGui/QApplication: No such file or directory
compilation terminated.
scons: *** [build/release/mtsgui/aboutdlg.o] Error 1
scons: building terminated because of errors.

In file included from build/release/mtsgui/aboutdlg.cpp:19:0: build/release/mtsgui/ui_aboutdlg.h:15:30: fatal error: QtGui/QApplication: No such file or directory compilation terminated.

The include paths need fixing.

penguin1214 avatar Dec 24 '17 12:12 penguin1214

Seem to have a related issue on Debian 9 (stretch). The suggestion "Perhaps you should add ..." does not appear to help:

dgriffith@nimbus:~/GitHub/mitsuba$ scons -j 26 scons: Reading SConscript files ... Using configuation file "/home/dgriffith/GitHub/mitsuba/config.py" Checking for Qt 5.x... yes Checking for g++ ...yes Checking for C header file png.h... yes Checking for C header file jpeglib.h... yes Checking for C++ header file ImfRgba.h... yes Checking for C++ header file xercesc/dom/DOMLSParser.hpp... yes Checking for C++ header file dae.h... yes Checking for C++ header file pyconfig.h... yes Checking for C++ header file pyconfig.h... yes Checking for C++ header file boost/version.hpp... yes Checking for C++ header file Eigen/Core... yes Checking for C++ header file fftw3.h... yes Checking for C header file GL/gl.h... yes Checking for C header file GL/glu.h... yes Checking for C header file GL/glext.h... yes Checking for C header file GL/glew.h... yes Checking for C type GLEWContext... yes Checking for C header file X11/extensions/xf86vmode.h... yes Checking for Mitsuba version .. 0.6.0 Package QtWidgets was not found in the pkg-config search path. Perhaps you should add the directory containing `QtWidgets.pc' to the PKG_CONFIG_PATH environment variable No package 'QtWidgets' found OSError: 'pkg-config QtGui QtWidgets QtCore QtOpenGL QtXml QtXmlPatterns QtNetwork --libs --cflags' exited 1: File "/home/dgriffith/GitHub/mitsuba/SConstruct", line 54: build('src/mtsgui/SConscript', ['mainEnv', 'converter_objects'], duplicate=True) File "/home/dgriffith/GitHub/mitsuba/SConstruct", line 29: variant_dir=os.path.join(env['BUILDDIR'], dirname), duplicate=duplicate) File "/usr/lib/scons/SCons/Script/SConscript.py", line 604: return method(*args, **kw) File "/usr/lib/scons/SCons/Script/SConscript.py", line 541: return _SConscript(self.fs, *files, **subst_kw) File "/usr/lib/scons/SCons/Script/SConscript.py", line 250: exec file in call_stack[-1].globals File "/home/dgriffith/GitHub/mitsuba/build/release/mtsgui/SConscript", line 28: qtEnv.EnableQt5Modules(['QtGui', 'QtWidgets', 'QtCore', 'QtOpenGL', 'QtXml', 'QtXmlPatterns', 'QtNetwork']) File "/usr/lib/scons/SCons/Environment.py", line 224: return self.method(*nargs, **kwargs) File "/home/dgriffith/GitHub/mitsuba/data/scons/qt5.py", line 467: self.ParseConfig('pkg-config %s --libs --cflags'% ' '.join(pcmodules)) File "/usr/lib/scons/SCons/Environment.py", line 1557: return function(self, self.backtick(command)) File "/usr/lib/scons/SCons/Environment.py", line 594: raise OSError("'%s' exited %d" % (command, status)) dgriffith@nimbus:~/GitHub/mitsuba$

derekjgriffith avatar Jan 05 '18 14:01 derekjgriffith

@derekjgriffith Hi, I manually changed the include paths and built again but there were still building errors need to be fixed. So I switched to qt4 and everything's fine..

penguin1214 avatar Jan 06 '18 06:01 penguin1214

@penguin1214 Thanks. How did you force mitsuba scons build to revert to Qt4? Have uninstalled Qt5 and qtchooser now only finds Qt4. Using QT_SELECT=qt4 scons does not change anything. Mitsuba scons build still seems to decide that Qt5 is available and errors similar to my last post:

dgriffith@nimbus:~/GitHub/mitsuba$ scons -j 26 scons: Reading SConscript files ... Using configuation file "/home/dgriffith/GitHub/mitsuba/config.py" Checking for Qt 5.x... yes Checking for g++ ...yes Checking for C header file png.h... yes Checking for C header file jpeglib.h... yes Checking for C++ header file ImfRgba.h... yes Checking for C++ header file xercesc/dom/DOMLSParser.hpp... yes Checking for C++ header file dae.h... yes Checking for C++ header file pyconfig.h... yes Checking for C++ header file pyconfig.h... yes Checking for C++ header file boost/version.hpp... yes Checking for C++ header file Eigen/Core... yes Checking for C++ header file fftw3.h... yes Checking for C header file GL/gl.h... yes Checking for C header file GL/glu.h... yes Checking for C header file GL/glext.h... yes Checking for C header file GL/glew.h... yes Checking for C type GLEWContext... yes Checking for C header file X11/extensions/xf86vmode.h... yes Checking for Mitsuba version .. 0.6.0 Package Qt5Core was not found in the pkg-config search path. Perhaps you should add the directory containing `Qt5Core.pc' to the PKG_CONFIG_PATH environment variable Package 'Qt5Core', required by 'QtWidgets', not found OSError: 'pkg-config QtGui QtWidgets QtCore QtOpenGL QtXml QtXmlPatterns QtNetwork --libs --cflags' exited 1: File "/home/dgriffith/GitHub/mitsuba/SConstruct", line 54: build('src/mtsgui/SConscript', ['mainEnv', 'converter_objects'], duplicate=True) File "/home/dgriffith/GitHub/mitsuba/SConstruct", line 29: variant_dir=os.path.join(env['BUILDDIR'], dirname), duplicate=duplicate) File "/usr/lib/scons/SCons/Script/SConscript.py", line 604: return method(*args, **kw) File "/usr/lib/scons/SCons/Script/SConscript.py", line 541: return _SConscript(self.fs, *files, **subst_kw) File "/usr/lib/scons/SCons/Script/SConscript.py", line 250: exec file in call_stack[-1].globals File "/home/dgriffith/GitHub/mitsuba/build/release/mtsgui/SConscript", line 28: qtEnv.EnableQt5Modules(['QtGui', 'QtWidgets', 'QtCore', 'QtOpenGL', 'QtXml', 'QtXmlPatterns', 'QtNetwork']) File "/usr/lib/scons/SCons/Environment.py", line 224: return self.method(*nargs, **kwargs) File "/home/dgriffith/GitHub/mitsuba/data/scons/qt5.py", line 467: self.ParseConfig('pkg-config %s --libs --cflags'% ' '.join(pcmodules)) File "/usr/lib/scons/SCons/Environment.py", line 1557: return function(self, self.backtick(command)) File "/usr/lib/scons/SCons/Environment.py", line 594: raise OSError("'%s' exited %d" % (command, status)) dgriffith@nimbus:~/GitHub/mitsuba$

derekjgriffith avatar Jan 08 '18 09:01 derekjgriffith

@derekjgriffith Sorry I put it wrong. I checked my scripts and found out that I built mitsuba without Qt support, which means no GUI provided. If you don't need mtsgui, you can just comment the related code in build/SConscript.configure.

If you do need gui support, you may probably check your qt uninstallation and your qt4 install directory. And may be build/SConscript.configure can provide some useful information to adapt your configuration, but I can't guarantee that.

The related code starts from line 95 and I just change them to

try:
        env = Environment(options=vars, ENV = os.environ, tools=['default', 'qt5'], toolpath=['#data/scons'])
        # print 'Checking for Qt 5.x... yes'
        # hasQt = True
        print 'Not building GUI'
        hasQt = False
except Exception:
        env = Environment(options=vars, ENV = os.environ, tools=['default'], toolpath=['#data/scons'])
        print 'Unable to detect a Qt installation -- not building the GUI!'
        hasQt = False

penguin1214 avatar Jan 08 '18 10:01 penguin1214

@penguin1214 Thanks again. I don't need the GUI. Have attempted compilation without GUI, but on Debian 9 (stretch) I still run into build errors. What platform/OS are you using?

derekjgriffith avatar Jan 08 '18 12:01 derekjgriffith

@derekjgriffith I'm on Ubuntu 14.04. Is the error still about Qt? Or What's the error message?

penguin1214 avatar Jan 08 '18 14:01 penguin1214

@penguin1214 The build errors were related to the Collada DOM. Uninstalled Collada DOM (don't actually need that either) and then got build errors related to OpenEXR (IlmBase). Obtained and built IlmBase and OpenEXR from source and then I got a clean build of Mitsuba. Thanks for your help.

derekjgriffith avatar Jan 09 '18 10:01 derekjgriffith

Does the change in #54 help at all?

davidgiven avatar Jan 15 '18 21:01 davidgiven

I compiled successfully on ubuntu16.04. In my environment, both qt4 and qt5 exist, and I met the problem same as @derekjgriffith I changed "tools=['default', 'qt5']" to "tools=['default', 'qt4']," at build/SConscript.configure line 96. Just dependence issues left, and after install all depndence, all done. I think something wrong with qt5 and qt4... but still confusing. hope useful, and hope someone can tell a way to clear that.

Eddylib avatar Jun 06 '18 03:06 Eddylib

Same problem here. I fixed it by switching the qmake to the Qt5-supported version by the qtchooser (make sure the qt5-qmake has been installed):

export QT_SELECT=5 
scons

or

scons [-qt=5]

These files named "ui_xxx.h" are actually generated by the Qt user interface compiler so if you are using the qt5, you need the qt-5 supported qmake to compile correct files for you.

ryushinn avatar May 13 '22 16:05 ryushinn