rock-core / base-types

C/C++ and Ruby definition of the base types in Rock
6 stars 40 forks source link

Solve issue building base/types in Ubuntu 18.04 #140

Closed mmunoz-gmv closed 4 years ago

mmunoz-gmv commented 5 years ago

When building in Ubuntu 18.04, there is an error for the file DistanceImageVisualization.cpp:

/usr/include/boost/predef/language/stdc.h:52: Parse error at "defined"
viz/CMakeFiles/base-viz.dir/build.make:62: recipe for target 'viz/moc_DistanceImageVisualization.cxx' failed
make[2]: *** [viz/moc_DistanceImageVisualization.cxx] Error 1
CMakeFiles/Makefile2:140: recipe for target 'viz/CMakeFiles/base-viz.dir/all' failed
make[1]: *** [viz/CMakeFiles/base-viz.dir/all] Error 2

This is due to an error processing a Boost include file with the Qt MOC tool (the Boost version has probably changed in Ubuntu 18.04).

To prevent that the problematic include file is processed by MOC, the include has been enclosed with:

#ifndef Q_MOC_RUN
#include <boost/math/special_functions/fpclassify.hpp>
#endif

This macro is defined only when running MOC.

The solution was found from a similar change in RVIZ.

maltewi commented 5 years ago

Could not reproduce the problem on a fresh bootstrap with Ubuntu 18.04. Could you provide more information like:

@doudou or @2maz maybe you know something about the problem and can review the request?

As an alternative solution without any QT-specific artifacts in the base-type I think the following would work: We move the implementation of getScenePoint into the .cpp file and thus we can also include the problematic boost header in the .cpp file.

mmunoz-gmv commented 5 years ago

The boost version installed is 1.65.1. It has been installed at system level (apt-get).

I see that the base/types directory includes a script cmake/DownloadBoost.cmake that references version 1.55. However, the script seems to find the boost library installed at sytem level and it doesn't perform a local download (no boost/types/external directory is created).

Could yo please check if your build is using the system boost install or the local download?

For Qt, I have versions 4.8.7 and 5.9.5. The build is using the 4.8.7.

2maz commented 5 years ago

I cannot reproduce the error in an isolated build in a clean chroot. Could you recheck/provide the build/CMakeCache.txt.

mmunoz-gmv commented 5 years ago

Here is the file:

CMakeCache.txt

maltewi commented 5 years ago

Still can not reproduce. I have exactly the same boost and Qt version.

Your initial post refers to viz/CMakeFiles/base-viz.dir/build.make:62. I looked in my file and see that this command is executed there:

cd /media/wirkus/Data/development/rock-runtime/base/types/build/viz && /usr/lib/x86_64-linux-gnu/qt4/bin/moc @/media/wirkus/Data/development/rock-runtime/base/types/build/viz/moc_DistanceImageVisualization.cxx_parameters

When I execute the command it works fine. Is it right, that this command (with your correct paths substituted) is producing the same error you where reporting initially?

To further understand what's going on could you please provide or answer:

mmunoz-gmv commented 5 years ago

Running moc DistanceImage.hpp in src/samples prints:

DistanceImage.hpp:0: Note: No relevant classes found. No output generated.

I get the error message when I run moc @moc_DistanceImageVisualization.cxx_parameters :

$ moc @moc_DistanceImageVisualization.cxx_parameters 
/usr/include/boost/predef/language/stdc.h:52: Parse error at "defined"

I enclose the file moc_DistanceImageVisualization.cxx_parameters, which contains the command options and includes used (I've renamed it to .txt for uploading). Could you please compare with yours?

moc_DistanceImageVisualization.cxx_parameters.txt

It would be also useful to verify if there is a version of Boost installed at system level (I have libboost1.65-dev:amd64). The types-build.log prints the Boost version detected during the build:

-- Boost version: 1.65.1
-- Found the following Boost libraries:
--   system

Could you please check if it's the same for you?

maltewi commented 4 years ago

@mmunoz-gmv Is this issue still present or resolved by now?

mmunoz-gmv commented 4 years ago

The issue was not solved for the configuration that we're using for the new OGs. Currently we've created a fork of the package for the purposes of maintenance in the new OGs. At the end of the projects, we'll recheck the status of the issue and decide if we can go back to the master branch. We can close the issue or leave it open for tracking, as you prefer.

maltewi commented 4 years ago

First of all, here's the requested data:

The cxx_parameters-file moc_DepthMapVisualization.cxx_parameters.txt

Output when running moc There's no output, but the file moc_DistanceImageVisualization.cxx.txt (.txt-extension for upload) is created.

wirkus@MWIRKUS-LAP-U:viz[master]$ moc @moc_DistanceImageVisualization.cxx_parameters 
wirkus@MWIRKUS-LAP-U:viz[master]$ 

Selected CMake version: It's the version installed at system-level (1.65.1)

-- Boost version: 1.65.1
-- Found the following Boost libraries:
--   system

And here's the file causing the error in your installation /usr/include/boost/predef/language/stdc.h. Maybe you can compare it to yours. Since the file is about language, maybe the locale settings are a hint? Here are mine.

wirkus@MWIRKUS-LAP-U:viz[master]$ locale
LANG=en_US.UTF-8
LANGUAGE=en
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=de_DE.UTF-8
LC_TIME=de_DE.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=de_DE.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=de_DE.UTF-8
LC_NAME=de_DE.UTF-8
LC_ADDRESS=de_DE.UTF-8
LC_TELEPHONE=de_DE.UTF-8
LC_MEASUREMENT=de_DE.UTF-8
LC_IDENTIFICATION=de_DE.UTF-8
LC_ALL=

We can close the issue or leave it open for tracking, as you prefer.

Let's keep it open until the issue is sorted out or until it is considered irrelevant. Just provide more info when you have it. It's okay if you need some time for that, we're not in a hurry on our side.

m0rsch1 commented 4 years ago

Hi there,

since I am affected by the same bug I confirm that the file /usr/include/boost/predef/language/stdc.h is the same.

BR

m0rsch1 commented 4 years ago

Please see also this bug report: https://bugreports.qt.io/browse/QTBUG-22829

doudou commented 4 years ago

OK. So. I don't like it, but trying to find out why this is happening one some machines and not other seems to be going nowhere.

The fix seems innocuous enough ... I'd be OK to merge this. @2maz, opinion ?

2maz commented 4 years ago

Ok for me as well, so I will just merge.