Skip to content

Commit 304373f

Browse files
Fix Debug Build Using GCC 15 (#152223)
Flang currently doesn't build in debug mode on GCC 15 due to missing dynamic libraries in some CMakeLists.txt files, and OpenMP doesn't link in debug mode due to the atomic library pulling in libstdc++ despite an incomplete attempt in the CMakeLists.txt to disable glibcxx assertions. This PR fixes these issues and allows Flang and the OpenMP runtime to build and link on GCC 15 in debug mode. --------- Co-authored-by: ronlieb <[email protected]>
1 parent 36d07ad commit 304373f

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

flang-rt/lib/runtime/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ endif ()
183183

184184

185185
if (NOT WIN32)
186+
add_definitions(-U_GLIBCXX_ASSERTIONS -D_GLIBCXX_NO_ASSERTIONS)
187+
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions>)
188+
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-O2>)
189+
186190
add_flangrt_library(flang_rt.runtime STATIC SHARED
187191
${sources}
188192
LINK_LIBRARIES ${Backtrace_LIBRARY}

flang/lib/Optimizer/Builder/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ add_flang_library(FIRBuilder
5050
FIRDialectSupport
5151
FIRSupport
5252
FortranEvaluate
53+
FortranSupport
5354
HLFIRDialect
5455

5556
MLIR_DEPS

flang/lib/Optimizer/HLFIR/Transforms/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ add_flang_library(HLFIRTransforms
2727
FIRSupport
2828
FIRTransforms
2929
FlangOpenMPTransforms
30+
FortranEvaluate
31+
FortranSupport
3032
HLFIRDialect
3133

3234
LINK_COMPONENTS

openmp/runtime/src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ endif()
168168
# Disable libstdc++ assertions, even in an LLVM_ENABLE_ASSERTIONS build, to
169169
# avoid an unwanted dependency on libstdc++.so.
170170
if(NOT WIN32)
171-
add_definitions(-U_GLIBCXX_ASSERTIONS)
171+
add_definitions(-U_GLIBCXX_ASSERTIONS -D_GLIBCXX_NO_ASSERTIONS)
172172
endif()
173173

174174
# Add the OpenMP library

0 commit comments

Comments
 (0)