igd-geo / schwarzwald

Create 3D Tiles and Potree tiles from raw point clouds
Apache License 2.0
31 stars 6 forks source link

Can not build with GCC 9/11+ #4

Closed geoyee closed 1 month ago

geoyee commented 2 months ago

Hi, when i build this project by cmake (WSL2 and GCC 9/11+), i get some errors :

[build] In file included from /home/user/schwarzwald/schwarzwald/util/./logging/Journal.h:5,
[build]                  from /home/user/schwarzwald/schwarzwald/core/process/Tiler.cpp:8:
[build] /home/user/schwarzwald/schwarzwald/util/./logging/Journal.h: In instantiation of ‘constexpr bool logging::detail::is_flat_trivial_type() [with T = ThroughputStats]’:
[build] /home/user/schwarzwald/schwarzwald/util/./logging/Journal.h:502:74:   required from ‘constexpr const bool logging::IsFlatTrivialType<ThroughputStats>’
[build] /home/user/schwarzwald/schwarzwald/util/./logging/Journal.h:891:17:   required from ‘logging::JournalBuilderWithType<logging::VectorStorage<T> > logging::JournalBuilder::with_flat_type() [with T = ThroughputStats]’
[build] /home/user/schwarzwald/schwarzwald/core/process/Tiler.cpp:112:39:   required from here
[build] /home/user/schwarzwald/schwarzwald/util/./logging/Journal.h:425:55:   in ‘constexpr’ expansion of ‘refl::members_of<ThroughputStats>()’
[build] /home/user/schwarzwald/schwarzwald/util/./types/MembersOf.h:116:43:   in ‘constexpr’ expansion of ‘refl::detail::members_of_aggregate<ThroughputStats>()’
[build] /home/user/schwarzwald/schwarzwald/util/./types/MembersOf.h:57:16: error: ‘reinterpret_cast’ is not a constant expression
[build]    57 |     T* dummy = reinterpret_cast<T*>(&mem);
[build]       |                ^~~~~~~~~~~~~~~~~~~~~~~~~~
[build] In file included from /home/user/schwarzwald/schwarzwald/core/process/Tiler.cpp:8:
[build] /home/user/schwarzwald/schwarzwald/util/./logging/Journal.h: In instantiation of ‘logging::JournalBuilderWithType<logging::VectorStorage<T> > logging::JournalBuilder::with_flat_type() [with T = ThroughputStats]’:
[build] /home/user/schwarzwald/schwarzwald/core/process/Tiler.cpp:112:39:   required from here
[build] /home/user/schwarzwald/schwarzwald/util/./logging/Journal.h:891:17: error: non-constant condition for static assertion
[build]   891 |   static_assert(IsFlatTrivialType<T>,
[build]       |                 ^~~~~~~~~~~~~~~~~~~~
[build] gmake[2]: *** [schwarzwald/core/CMakeFiles/SchwarzwaldCore.dir/build.make:426: schwarzwald/core/CMakeFiles/SchwarzwaldCore.dir/process/Tiler.cpp.o] Error 1
[build] gmake[1]: *** [CMakeFiles/Makefile2:1611: schwarzwald/core/CMakeFiles/SchwarzwaldCore.dir/all] Error 2
[build] gmake: *** [Makefile:136: all] Error 2

I found this to be the wrong way to use, we should not use reinterpret_cast in constexpr function, but i know this project compiles on GCC 7+ and successfully. If i want to use GCC 9/11+, what should i do?

Thank you!

tobias93 commented 2 months ago

Hi, thanks for the issue. I'll get back to you once I had a chance to look at it. Probably in the next few days or next week.

geoyee commented 2 months ago

Hi, thanks for the issue. I'll get back to you once I had a chance to look at it. Probably in the next few days or next week.

Thanks, looking forward to your reply~

tobias93 commented 1 month ago

If you try out the latest commit on master, it should now compile with an up-to-date version of GCC again.