build: disable precompiled headers when using GCC >=12.2

Prevents out-of-bounds error bug present in GCC >=12.2 that happens when precompiled headers are used with c++20

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106799
This commit is contained in:
Gabriel Ferreira
2023-10-12 19:55:29 -03:00
parent 2a7b4451b6
commit 9600693fb1
2 changed files with 10 additions and 0 deletions

View File

@@ -28,6 +28,9 @@ Changes from ns-3.40 to ns-3-dev
### Changes to build system
* In preparation to enable C++20, the following actions have been taken due to compiler issues:
* Precompiled headers have been disabled in GCC versions >= 12.2.
### Changed behavior
Changes from ns-3.39 to ns-3.40

View File

@@ -244,6 +244,13 @@ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
# ns3-module-macros.cmake.
set(GCC8 TRUE)
endif()
if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12.2.0"))
# PCH causes weird errors on certain versions of GCC when C++20 is enabled
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106799
set(NS3_PRECOMPILE_HEADERS OFF
CACHE BOOL "Precompile module headers to speed up compilation" FORCE
)
endif()
set(GCC TRUE)
add_definitions(-fno-semantic-interposition)
if(${NS3_COLORED_OUTPUT} OR "$ENV{CLICOLOR}")