OpenCS fails to compile due to bug in Qt moc compiler

Involved development of the OpenMW construction set.
Post Reply
User avatar
lgromanowski
Site Admin
Posts: 1193
Joined: 05 Aug 2011, 22:21
Location: Wroclaw, Poland
Contact:

OpenCS fails to compile due to bug in Qt moc compiler

Post by lgromanowski »

Hi,
just in case someone encounter similar problem:

Code: Select all

[ 39%] Generating view/doc/moc_operation.cxx
[ 39%] Generating view/doc/moc_subview.cxx
[ 39%] Generating view/doc/moc_startup.cxx
[ 39%] Generating view/doc/moc_filedialog.cxx
[ 39%] Generating view/world/moc_table.cxx
[ 40%] Generating view/world/moc_tablesubview.cxx
usr/include/boost/type_traits/detail/has_binary_operator.hp:50: Parse error at "BOOST_JOIN"
[ 40%] make[2]: *** [apps/opencs/moc_editor.cxx] Błąd 1
make[2]: *** Oczekiwanie na niezakończone zadania....
Generating view/tools/moc_reportsubview.cxx
make[1]: *** [apps/opencs/CMakeFiles/opencs.dir/all] Błąd 2
there is a bug: https://bugreports.qt-project.org/browse/QTBUG-22829 in Qt moc compiler and, as far I see, OpenCS will not compile with boost 1.53 (and probably other versions >= 1.48 as mentioned in bugreport) and Qt 4.8.4 (it's fixed in Qt 5.0).
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: OpenCS fails to compile due to bug in Qt moc compiler

Post by Zini »

*ugh*

Forcing the use of newer Qt is not an option. I guess we could fix it by locating all includes for that boost library (and all includes for headers that include that boost library) and put them in #ifndef Q_MOC_RUN and #endif.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: OpenCS fails to compile due to bug in Qt moc compiler

Post by scrawl »

I think this workaround is nicer (assuming that it is possible from within CMake):
Passing the following to moc will prevent it from parsing through the portion of boost that it is having problems with:
-DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED
User avatar
lgromanowski
Site Admin
Posts: 1193
Joined: 05 Aug 2011, 22:21
Location: Wroclaw, Poland
Contact:

Re: OpenCS fails to compile due to bug in Qt moc compiler

Post by lgromanowski »

scrawl wrote:I think this workaround is nicer (assuming that it is possible from within CMake):
Passing the following to moc will prevent it from parsing through the portion of boost that it is having problems with:
-DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED
I've just added this near line 309 in CMakeLists.txt (where gcc parameters are set) but unfortunately this didn't solve the problem. I will try with #ifndefs Q_MOC_RUN.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: OpenCS fails to compile due to bug in Qt moc compiler

Post by scrawl »

No, don't pass them to gcc, but to the moc executable.

something like

Code: Select all

qt4_wrap_cpp(OPENCS_MOC_SRC ${OPENCS_HDR_QT} -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED)
instead of just

Code: Select all

qt4_wrap_cpp(OPENCS_MOC_SRC ${OPENCS_HDR_QT})
User avatar
lgromanowski
Site Admin
Posts: 1193
Joined: 05 Aug 2011, 22:21
Location: Wroclaw, Poland
Contact:

Re: OpenCS fails to compile due to bug in Qt moc compiler

Post by lgromanowski »

I tried:

Code: Select all

qt4_wrap_cpp(OPENCS_MOC_SRC ${OPENCS_HDR_QT} OPTIONS "-DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED")
but this didn't help either. Only a bit ugly "#ifndef Q_MOC_RUN" works (pull request sent).
Post Reply