OpenCS fails to compile due to bug in Qt moc compiler

Involved development of the OpenMW construction set.


  • Author
  • Message
Offline
User avatar

lgromanowski

Site Admin

  • Posts: 1036
  • Joined: 05 Aug 2011, 22:21
  • Location: Wroclaw, Poland

OpenCS fails to compile due to bug in Qt moc compiler

Post31 Mar 2013, 14:22

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).
best regards,
Lukasz
Offline
User avatar

Zini

  • Posts: 4893
  • Joined: 06 Aug 2011, 15:16

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

Post31 Mar 2013, 15:38

*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.
Offline
User avatar

scrawl

  • Posts: 1797
  • Joined: 18 Feb 2012, 11:51

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

Post31 Mar 2013, 16:17

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
Offline
User avatar

lgromanowski

Site Admin

  • Posts: 1036
  • Joined: 05 Aug 2011, 22:21
  • Location: Wroclaw, Poland

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

Post31 Mar 2013, 16:30

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.
best regards,
Lukasz
Offline
User avatar

scrawl

  • Posts: 1797
  • Joined: 18 Feb 2012, 11:51

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

Post31 Mar 2013, 16:36

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})
Offline
User avatar

lgromanowski

Site Admin

  • Posts: 1036
  • Joined: 05 Aug 2011, 22:21
  • Location: Wroclaw, Poland

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

Post31 Mar 2013, 17:06

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).
best regards,
Lukasz


Return to Editor Development

Who is online

Users browsing this forum: aesylwinn and 5 guests