Moc: Parse error at "std" [workaround]
-
Hello,
I tried to compile a little project with Qt5.1beta1.
(I am on a Debian Wheezy with the binary offline installer qt-linux-opensource-5.1.0-beta1-x86-offline.run)This produced following error (see command line [1], from the compile window of qtcreator):
@usr/include/c++/4.6/bits/stl_relops.:68: Parse error at "std"
@When trying to look deeper on what is happening it seems that the macro _GLIBCXX_VISIBILITY on the std namespace is undefined [2].
Looking even deeper with strace reveals, that moc tries to open a header file c++config.h which would define the missing macro. [3]
The error is solved when adding/changing the include path which leads to c++config.h
@changing
-I/usr/include/c++/4.6/i686-linux-gnu/.
^
to
-I/usr/include/c++/4.6/i486-linux-gnu/.
^
@This problem is probably debian specific because of the directory structure where the headers are placed.
The directory with i686 does not even exist on my system, only one with i486.
Therefore this is probably defined at compile time of the Qt release, which happened at a system which has the files in i686.For gcc this is no problem because he knows where to find his headers.
So probably moc or qmake could be a little smarter about it by finding out what include paths to use from gcc like in [4].Kind regards,
Bernhard
[1]
@bernhard@debian:/data/yammi/2013-05-09/git.code.sf.net/yammi-git/src$ /data/yammi/2013-05-29_qt5/qt/5.1.0-beta1/gcc/bin/moc -DUSE_QMEDIAPLAYER -DUSE_TAGLIB -DUSE_XINE -DQT_MULTIMEDIA_LIB -DQT_WIDGETS_LIB -DQT_XML_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../2013-05-29_qt5/qt/5.1.0-beta1/gcc/mkspecs/linux-g++ -I. -I/usr/include/taglib -I../../../../2013-05-29_qt5/qt/5.1.0-beta1/gcc/include -I../../../../2013-05-29_qt5/qt/5.1.0-beta1/gcc/include/QtMultimedia -I../../../../2013-05-29_qt5/qt/5.1.0-beta1/gcc/include/QtWidgets -I../../../../2013-05-29_qt5/qt/5.1.0-beta1/gcc/include/QtXml -I../../../../2013-05-29_qt5/qt/5.1.0-beta1/gcc/include/QtNetwork -I../../../../2013-05-29_qt5/qt/5.1.0-beta1/gcc/include/QtGui -I../../../../2013-05-29_qt5/qt/5.1.0-beta1/gcc/include/QtCore -I.moc -I.ui -I/usr/include/c++/4.6 -I/usr/include/c++/4.6/i686-linux-gnu/. -I/usr/include/c++/4.6/backward -I/usr/lib/gcc/i686-linux-gnu/4.6.1/include -I/usr/local/include -I/usr/lib/gcc/i686-linux-gnu/4.6.1/include-fixed -I/usr/include/i386-linux-gnu -I/usr/include applytoalldialog.h -o .moc/moc_applytoalldialog.cpp
usr/include/c++/4.6/bits/stl_relops.:68: Parse error at "std"
@[2]
@bernhard@debian:/data/yammi/2013-05-09/git.code.sf.net/yammi-git/src$ /data/yammi/2013-05-29_qt5/qt/5.1.0-beta1/gcc/bin/moc -E -DUSE_QMEDIAPLAYER -DUSE_TAGLIB -DUSE_XINE -DQT_MULTIMEDIA_LIB -DQT_WIDGETS_LIB -DQT_XML_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../2013-05-29_qt5/qt/5.1.0-beta1/gcc/mkspecs/linux-g++ -I. -I/usr/include/taglib -I../../../../2013-05-29_qt5/qt/5.1.0-beta1/gcc/include -I../../../../2013-05-29_qt5/qt/5.1.0-beta1/gcc/include/QtMultimedia -I../../../../2013-05-29_qt5/qt/5.1.0-beta1/gcc/include/QtWidgets -I../../../../2013-05-29_qt5/qt/5.1.0-beta1/gcc/include/QtXml -I../../../../2013-05-29_qt5/qt/5.1.0-beta1/gcc/include/QtNetwork -I../../../../2013-05-29_qt5/qt/5.1.0-beta1/gcc/include/QtGui -I../../../../2013-05-29_qt5/qt/5.1.0-beta1/gcc/include/QtCore -I.moc -I.ui -I/usr/include/c++/4.6 -I/usr/include/c++/4.6/i686-linux-gnu/. -I/usr/include/c++/4.6/backward -I/usr/lib/gcc/i686-linux-gnu/4.6.1/include -I/usr/local/include -I/usr/lib/gcc/i686-linux-gnu/4.6.1/include-fixed -I/usr/include/i386-linux-gnu -I/usr/include applytoalldialog.h -o /dev/stdout | grep -v -E "^$" | headnamespace std _GLIBCXX_VISIBILITY(default)
{
namespace rel_ops
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
template <class _Tp>
inline bool
operator!=(const _Tp& __x, const _Tp& __y)
{ return !(__x == __y); }
@[3]
@bernhard@debian:/data/yammi/2013-05-09/git.code.sf.net/yammi-git/src$ strace -f [command from above] 2>&1 | grep -i -E "^open|c++config" --color=always
...
open("applytoalldialog.h", O_RDONLY) = 3
open("/data/yammi/2013-05-09/git.code.sf.net/yammi-git/src/.ui/ui_ApplyToAllBase.h", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 4
...
open("/usr/include/c++/4.6/algorithm", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 4
open("/usr/include/c++/4.6/utility", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 4
stat64("../../../../2013-05-29_qt5/qt/5.1.0-beta1/gcc/mkspecs/linux-g++/bits/c++config.h", 0xbfa48328) = -1 ENOENT (No such file or directory)
stat64("./bits/c++config.h", 0xbfa48328) = -1 ENOENT (No such file or directory)
stat64("/usr/include/taglib/bits/c++config.h", 0xbfa48328) = -1 ENOENT (No such file or directory)
...
stat64("/usr/include/c++/4.6/bits/c++config.h", 0xbfa48328) = -1 ENOENT (No such file or directory)
stat64("/usr/include/c++/4.6/i686-linux-gnu/./bits/c++config.h", 0xbfa48328) = -1 ENOENT (No such file or directory)
stat64("/usr/include/c++/4.6/backward/bits/c++config.h", 0xbfa48328) = -1 ENOENT (No such file or directory)
...
open("/usr/include/c++/4.6/bits/stl_relops.h", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 4
...
@[4]
@bernhard@debian:/data/yammi/2013-05-09/git.code.sf.net/yammi-git/src$ g++-4.6 -print-prog-name=cc1plus
/usr/lib/gcc/i486-linux-gnu/4.6/cc1plus
bernhard@debian:/data/yammi/2013-05-09/git.code.sf.net/yammi-git/src$ /usr/lib/gcc/i486-linux-gnu/4.6/cc1plus -v not-existing
ignoring nonexistent directory "/usr/lib/gcc/i486-linux-gnu/4.6/../../../../i486-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/include/c++/4.6
/usr/include/c++/4.6/i486-linux-gnu
/usr/include/c++/4.6/backward
/usr/lib/gcc/i486-linux-gnu/4.6/include
/usr/local/include
/usr/lib/gcc/i486-linux-gnu/4.6/include-fixed
/usr/include
End of search list.
...
@(paths modified to get below the size limitations of the forum)
-
Hi,
that's very in-depth and thorough; have you "filed a bug report":https://bugreports.qt-project.org/ for such behaviour? It might get the needed attention.
-
Hello Alek,
thanks for the quick response.
I created a new bug: https://bugreports.qt-project.org/browse/QTBUG-31496Kind regards,
Bernhard