[Openmp-commits] [openmp] [OpenMP] Allow libomp.so to link in Debug build with GCC 15 libstdc++ (PR #175466)
Rainer Orth via Openmp-commits
openmp-commits at lists.llvm.org
Sun Jan 11 14:04:10 PST 2026
https://github.com/rorth created https://github.com/llvm/llvm-project/pull/175466
As detailed in Issue #153569, a `Debug` build with the `GCC 15` `libstdc++` `FAIL`s to link `libomp.so`.
To avoid this, one needs to define `_GLIBCXX_NO_ASSERTIONS`.
Tested on `x86_64-pc-solaris2.11`.
>From a7eddb13316536f2c7549de440789e3e243f5c32 Mon Sep 17 00:00:00 2001
From: Rainer Orth <ro at gcc.gnu.org>
Date: Sun, 11 Jan 2026 23:01:56 +0100
Subject: [PATCH] [OpenMP] Allow libomp.so to link in Debug build with GCC 15
libstdc++
As detailed in Issue #153569, a `Debug` build with the `GCC 15` `libstdc++`
`FAIL`s to link `libomp.so`.
To avoid this, one needs to define `_GLIBCXX_NO_ASSERTIONS`.
Tested on `x86_64-pc-solaris2.11`.
---
openmp/runtime/src/kmp.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/openmp/runtime/src/kmp.h b/openmp/runtime/src/kmp.h
index 36c40abaf1ef4..db6b4238d4906 100644
--- a/openmp/runtime/src/kmp.h
+++ b/openmp/runtime/src/kmp.h
@@ -48,6 +48,12 @@
#define KMP_CANCEL_THREADS
#define KMP_THREAD_ATTR
+// GCC 15 libstdc++ enables debug assertions in unoptimized builds.
+// Disable them to allow libomp.so to link without libstdc++.so.
+#if !__OPTIMIZE__
+#define GLIBCXX_NO_ASSERTIONS
+#endif
+
// Android does not have pthread_cancel. Undefine KMP_CANCEL_THREADS if being
// built on Android
#if defined(__ANDROID__)
More information about the Openmp-commits
mailing list