Stellarium / stellarium

Stellarium is a free GPL software which renders realistic skies in real time with OpenGL. It is available for Linux/Unix, Windows and macOS. With Stellarium, you really see what you can see with your eyes, binoculars or a small telescope.
https://stellarium.org
GNU General Public License v2.0
7.76k stars 821 forks source link

v24.3: compilation error: expected unqualified-id #3905

Closed dimich-dmb closed 1 month ago

dimich-dmb commented 1 month ago

v24.3 compilation fails with error:

[ 41%] Building CXX object src/CMakeFiles/stelMain.dir/core/modules/SolarSystem.cpp.o
cd /home/dimich/work/src/stellarium/BUILD/src && /usr/bin/ccache /usr/bin/c++ -DCOPYRIGHT_YEARS=\"2000-2024\" -DENABLE_MEDIA -DENABLE_NLS -DENABLE_SCRIPTING -DENABLE_SCRIPT_CONSOLE -DENABLE_SCRIPT_QML -DENABLE_SHOWMYSKY -DENABLE_XLSX -DEXV_LOCALEDIR=\"../share/locale\" -DINSTALL_DATADIR=\"/usr/local/share/stellarium\" -DNDEBUG -DNLOPT_DLL -DPACKAGE_VERSION=\"24.3.0\" -DQT_CHARTS_LIB -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_GUI_LIB -DQT_MULTIMEDIAWIDGETS_LIB -DQT_MULTIMEDIA_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_OPENGLWIDGETS_LIB -DQT_OPENGL_LIB -DQT_POSITIONING_LIB -DQT_PRINTSUPPORT_LIB -DQT_QMLBUILTINS_LIB -DQT_QMLINTEGRATION_LIB -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_QUICK_LIB -DQT_WEBCHANNEL_LIB -DQT_WEBENGINECORE_LIB -DQT_WEBENGINEWIDGETS_LIB -DQT_WIDGETS_LIB -DSTD_EXECUTION_KNOWN -DSTELLARIUM_BUIDING_VERSION=\"24.3\" -DSTELLARIUM_COMPILER="\"GNU 14.2.1\"" -DSTELLARIUM_COPYRIGHT="\"Copyright (C) 2000-2024 Stellarium Developers\"" -DSTELLARIUM_DEV_URL=\"https://github.com/Stellarium/stellarium\" -DSTELLARIUM_MAJOR=24 -DSTELLARIUM_MINOR=3 -DSTELLARIUM_PATCH=0 -DSTELLARIUM_PUBLIC_VERSION=\"24.3\" -DSTELLARIUM_RELEASE_BUILD -DSTELLARIUM_SERIES=\"24.0\" -DSTELLARIUM_SOURCE_DIR=\"/home/dimich/work/src/stellarium\" -DSTELLARIUM_URL=\"https://stellarium.org/\" -DUSE_BUNDLED_QTCOMPRESS -DUSE_STATIC_PLUGIN_ANGLEMEASURE -DUSE_STATIC_PLUGIN_ARCHAEOLINES -DUSE_STATIC_PLUGIN_CALENDARS -DUSE_STATIC_PLUGIN_EQUATIONOFTIME -DUSE_STATIC_PLUGIN_EXOPLANETS -DUSE_STATIC_PLUGIN_LENSDISTORTIONESTIMATOR -DUSE_STATIC_PLUGIN_METEORSHOWERS -DUSE_STATIC_PLUGIN_MISSINGSTARS -DUSE_STATIC_PLUGIN_NAVSTARS -DUSE_STATIC_PLUGIN_NOVAE -DUSE_STATIC_PLUGIN_OBSERVABILITY -DUSE_STATIC_PLUGIN_OCULARS -DUSE_STATIC_PLUGIN_ONLINEQUERIES -DUSE_STATIC_PLUGIN_POINTERCOORDINATES -DUSE_STATIC_PLUGIN_PULSARS -DUSE_STATIC_PLUGIN_QUASARS -DUSE_STATIC_PLUGIN_REMOTECONTROL -DUSE_STATIC_PLUGIN_REMOTESYNC -DUSE_STATIC_PLUGIN_SATELLITES -DUSE_STATIC_PLUGIN_SCENERY3D -DUSE_STATIC_PLUGIN_SOLARSYSTEMEDITOR -DUSE_STATIC_PLUGIN_SUPERNOVAE -DUSE_STATIC_PLUGIN_TEXTUSERINTERFACE -D_USE_MATH_DEFINES -I/home/dimich/work/src/stellarium/BUILD/src -I/home/dimich/work/src/stellarium/src -I/home/dimich/work/src/stellarium/BUILD/src/stelMain_autogen/include -I/home/dimich/work/src/stellarium/BUILD -I/home/dimich/work/src/stellarium/src/core -I/home/dimich/work/src/stellarium/src/core/modules -I/home/dimich/work/src/stellarium/src/core/planetsephems -I/home/dimich/work/src/stellarium/src/gui -I/home/dimich/work/src/stellarium/src/scripting -I/home/dimich/work/src/stellarium/src/external/glues_stel/source -I/home/dimich/work/src/stellarium/plugins/RemoteControl/src/../include -I/home/dimich/work/src/stellarium/src/external/qtcompress -I/home/dimich/work/src/stellarium/BUILD/_deps/qxlsxqt6-src/QXlsx/header -isystem /usr/include/qt6/QtGui -isystem /usr/include/qt6 -isystem /usr/include/qt6/QtCore -isystem /usr/lib/qt6/mkspecs/linux-g++ -isystem /usr/include/qt6/QtWidgets -isystem /usr/include/qt6/QtQml -isystem /usr/include/qt6/QtQmlIntegration -isystem /usr/include/qt6/QtQmlBuiltins -isystem /usr/include/qt6/QtNetwork -isystem /usr/include/qt6/QtCharts -isystem /usr/include/qt6/QtOpenGL -isystem /usr/include/qt6/QtOpenGLWidgets -isystem /usr/include/qt6/QtWebEngineWidgets -isystem /usr/include/qt6/QtWebEngineCore -isystem /usr/include/qt6/QtQuick -isystem /usr/include/qt6/QtQmlModels -isystem /usr/include/qt6/QtWebChannel -isystem /usr/include/qt6/QtPositioning -isystem /usr/include/qt6/QtPrintSupport -isystem /usr/include/qt6/QtGui/6.7.2 -isystem /usr/include/qt6/QtGui/6.7.2/QtGui -isystem /usr/include/qt6/QtCore/6.7.2 -isystem /usr/include/qt6/QtCore/6.7.2/QtCore -isystem /usr/include/qt6/QtConcurrent -isystem /usr/include/qt6/QtMultimedia -isystem /usr/include/qt6/QtMultimediaWidgets -Wall -Wextra -Wno-unused-parameter -Wno-unknown-pragmas -Wno-unused-result -O3 -DNDEBUG -std=c++17 -mno-direct-extern-access -Winvalid-pch -include /home/dimich/work/src/stellarium/BUILD/src/CMakeFiles/stelMain.dir/cmake_pch.hxx -MD -MT src/CMakeFiles/stelMain.dir/core/modules/SolarSystem.cpp.o -MF CMakeFiles/stelMain.dir/core/modules/SolarSystem.cpp.o.d -o CMakeFiles/stelMain.dir/core/modules/SolarSystem.cpp.o -c /home/dimich/work/src/stellarium/src/core/modules/SolarSystem.cpp
In file included from /usr/include/oneapi/tbb/detail/_small_object_pool.h:23,
                 from /usr/include/oneapi/tbb/detail/_task.h:23,
                 from /usr/include/oneapi/tbb/parallel_for.h:23,
                 from /usr/include/tbb/parallel_for.h:17,
                 from /usr/include/c++/14.2.1/pstl/parallel_backend_tbb.h:25,
                 from /usr/include/c++/14.2.1/pstl/parallel_backend.h:20,
                 from /usr/include/c++/14.2.1/pstl/algorithm_impl.h:22,
                 from /usr/include/c++/14.2.1/pstl/glue_execution_defs.h:50,
                 from /usr/include/c++/14.2.1/execution:39,
                 from /home/dimich/work/src/stellarium/src/core/modules/SolarSystem.cpp:51:
/usr/include/oneapi/tbb/profiling.h:229:15: error: expected unqualified-id before ‘)’ token
  229 |     void emit() { }
      |               ^
/usr/include/oneapi/tbb/profiling.h:231:22: error: expected unqualified-id before ‘const’
  231 |     static void emit(const std::string &) { }
      |                      ^~~~~
/usr/include/oneapi/tbb/profiling.h:231:22: error: expected ‘)’ before ‘const’
  231 |     static void emit(const std::string &) { }
      |                     ~^~~~~
      |                      )
make[2]: *** [src/CMakeFiles/stelMain.dir/build.make:2054: src/CMakeFiles/stelMain.dir/core/modules/SolarSystem.cpp.o] Error 1
make[2]: Leaving directory '/home/dimich/work/src/stellarium/BUILD'
make[1]: *** [CMakeFiles/Makefile2:2896: src/CMakeFiles/stelMain.dir/all] Error 2
make[1]: Leaving directory '/home/dimich/work/src/stellarium/BUILD'
make: *** [Makefile:156: all] Error 2

Steps to reproduce

$ mkdir BUILD
$ cd BUILD
$ cmake -DUSE_PLUGIN_TELESCOPECONTROL=0 -DENABLE_GPS=0 ..
...
$ make VERBOSE=1

System

Cmake configuration output:

$ cmake -DUSE_PLUGIN_TELESCOPECONTROL=0 -DENABLE_GPS=0 ..
-- Found CMake 3.30.3
-- The C compiler identification is GNU 14.2.1
-- The CXX compiler identification is GNU 14.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test HAVE_STDATOMIC
-- Performing Test HAVE_STDATOMIC - Success
-- Platform: Linux-6.10.10-arch1-1 (x86_64)
-- Building Stellarium 24.3 (v24.3.0; Mode: Release)
-- Found ccache /usr/bin/ccache
-- Found Qt6: /usr/lib/qt6/bin/qmake (found suitable version 6.7.2)
-- Found OpenGL: /usr/lib/libOpenGL.so
-- Found WrapOpenGL: TRUE
-- Found XKB: /usr/lib/libxkbcommon.so (found suitable version "1.7.0", minimum required is "0.5.0")
-- Found WrapVulkanHeaders: /usr/include
-- Building an OpenGL/OpenGL ES build
-- CPM: Using local package ShowMySky-Qt6@
-- Found ShowMySky library: /usr/lib/libShowMySky-Qt6.so.15.0.0
-- GPS: disabled.
-- Unit tests support: disabled
-- Using system-provided zlib at /usr/lib/libz.so
-- Using bundled qtcompress at /home/dimich/work/src/stellarium/src/external/qtcompress
-- Could NOT find QXlsx (missing: QXlsx_DIR)
-- CPM: Adding package QXlsxQt6@1.4.8 (1.4.8)
-- Found Doxygen: /usr/bin/doxygen (found version "1.12.0") found components: doxygen dot
-- Checking that std::from_chars for floats is supported by the C++ library
-- Checking that std::from_chars for floats is supported by the C++ library - yes
-- Checking that std::execution::par is supported by the C++ library
-- Checking that std::execution::par is supported by the C++ library - yes
-- Found Python3: /usr/bin/python3.12 (found version "3.12.6") found components: Interpreter
-- Found ZLIB: /usr/lib/libz.so (found version "1.3.1")
-- Found EXPAT: /usr/lib/libexpat.so (found version "2.6.3")
-- CPM: Using local package NLopt@2.8.0
-- Found exiv2 0.28.3
-- Found Gettext: /usr/bin/msgmerge (found version "0.22.5")
-- Found xgettext: /usr/bin/xgettext
-- Found lupdate: /usr/lib/qt6/bin/lupdate
-- Found lconvert: /usr/lib/qt6/bin/lconvert
-- Configuring done (5.3s)
-- Generating done (0.3s)
-- Build files have been written to: /home/dimich/work/src/stellarium/BUILD

Sources tagged v24.2 in the same environment are compiled successfully without errors.

10110111 commented 1 month ago

What if you apply the following patch?

diff --git a/src/core/modules/SolarSystem.cpp b/src/core/modules/SolarSystem.cpp
index 0e8a6f104b..83ccdd8178 100644
--- a/src/core/modules/SolarSystem.cpp
+++ b/src/core/modules/SolarSystem.cpp
@@ -19,6 +19,8 @@
  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335, USA.
  */

+#include <execution> // must be included before Qt because some versions of libtbb use "emit" identifier for their needs
+
 #include "SolarSystem.hpp"
 #include "StelTexture.hpp"
 #include "EphemWrapper.hpp"
@@ -48,7 +50,6 @@
 #include "StelObserver.hpp"

 #include <algorithm>
-#include <execution>

 #include <QTextStream>
 #include <QSettings>
dimich-dmb commented 1 month ago

What if you apply the following patch?

The same error but now "In file included from ... src/core/modules/SolarSystem.cpp:22"

dimich-dmb commented 1 month ago

Probably that's because of gcc command line option

-include /home/dimich/work/src/stellarium/BUILD/src/CMakeFiles/stelMain.dir/cmake_pch.hxx

which includes src/stelMain_pch.hpp which also includes Qt headers.

carlosal1015 commented 1 month ago

CC @krachyon

alex-w commented 1 month ago

@dimich-dmb please try configure building Stellarium without PCH - -DENABLE_PCH=0

10110111 commented 1 month ago

OK, and what if we alter the patch to also include the header into the PCH?

diff --git a/src/core/modules/SolarSystem.cpp b/src/core/modules/SolarSystem.cpp
index 0e8a6f104b..83ccdd8178 100644
--- a/src/core/modules/SolarSystem.cpp
+++ b/src/core/modules/SolarSystem.cpp
@@ -19,6 +19,8 @@
  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335, USA.
  */

+#include <execution> // must be included before Qt because some versions of libtbb use "emit" identifier for their needs
+
 #include "SolarSystem.hpp"
 #include "StelTexture.hpp"
 #include "EphemWrapper.hpp"
@@ -48,7 +50,6 @@
 #include "StelObserver.hpp"

 #include <algorithm>
-#include <execution>

 #include <QTextStream>
 #include <QSettings>
diff --git a/src/stelMain_pch.hpp b/src/stelMain_pch.hpp
index 9c35362285..c7677fd19c 100644
--- a/src/stelMain_pch.hpp
+++ b/src/stelMain_pch.hpp
@@ -28,6 +28,7 @@
 // It seems that inclusion of some headers is actually bad for build time, these are commented away again. More teting or other compiler combinations may have slightly other results.

 // Base time was 284s from first test without PCH
+#include <execution> // must be included before Qt because some versions of libtbb use "emit" identifier for their needs
 #include "StelApp.hpp"
 #include<QDebug>
 #include "StelUtils.hpp"
krachyon commented 1 month ago

@dimich-dmb please try configure building Stellarium without PCH - -DENABLE_PCH=0

That does not change the error for me when building with https://aur.archlinux.org/packages/stellarium and TBB installed.

I think it's just the conflict between QT's emit macro and TBB defining a function called emit as @10110111 noted in his patch.

Not sure what the cleanest way to solve this would be in this context, but seems sensible to just include <execution> before any QT-header.

carlosal1015 commented 1 month ago

Another user reported the same error with onetbb, confirming above comment, looks like onetbb is an optional makedepedency for stellarium.

We compiled fine without onetbb in a clean chroot.

10110111 commented 1 month ago

Could someone test the build with TBB having applied my second patch? If the patch works, I'll just push it so that the next release will not have the problem at all.

alex-w commented 1 month ago

Probably this issue will be happen in macOS too - I'll check it tomorrow.

krachyon commented 1 month ago

Could someone test the build with TBB having applied my second patch? If the patch works, I'll just push it so that the next release will not have the problem at all.

With your patch, compilation works (on my machine ;) )

Btw, enabling PCH does not seem to make much of a difference wrt. to build time for me on a Ryzen 7 5700U if that's an interesting datapoint relating to the comment in stelMain_pch.hpp

dimich-dmb commented 1 month ago

@dimich-dmb please try configure building Stellarium without PCH - -DENABLE_PCH=0

With -DENABLE_PCH=0 AND with the patch above compilation succeeds. With -DENABLE_PCH=0 but without the patch compilation fails.

github-actions[bot] commented 1 month ago

Hello @dimich-dmb!

Please check the fresh version (development snapshot) of Stellarium: https://github.com/Stellarium/stellarium-data/releases/tag/weekly-snapshot