oneTBB
oneTBB copied to clipboard
tbbmalloc linked as C causes build failure when using GCC 15
Summary
Linking of tbbmalloc using GCC 15 fails when CXXFLAGS contain -Wp,-D_GLIBCXX_ASSERTIONS.
Version
oneTBB 2022.1.0.
Environment
- x86_64
- Arch Linux rolling release
-
g++ (GCC) 15.1.1 20250425 Copyright (C) 2025 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Observed Behavior
oneTBB fails to build.
Expected Behavior
oneTBB builds without error.
Steps To Reproduce
$ curl -O -L https://github.com/uxlfoundation/oneTBB/archive/v2022.1.0/onetbb-2022.1.0.tar.gz
$ tar -xf onetbb-2022.1.0.tar.gz
$ export CXXFLAGS='-Wp,-D_GLIBCXX_ASSERTIONS'
$ cmake -B build -S oneTBB-2022.1.0
$ cmake --build build
....
[ 20%] Linking C executable ../gnu_15.1_cxx11_64_none/test_malloc_pure_c
/usr/bin/ld: ../gnu_15.1_cxx11_64_none/libtbbmalloc.so.2.15: undefined reference to `std::__glibcxx_assert_fail(char const*, int, char const*, char const*)'
collect2: error: ld returned 1 exit status
make[2]: *** [test/CMakeFiles/test_malloc_pure_c.dir/build.make:102: gnu_15.1_cxx11_64_none/test_malloc_pure_c] Error 1
make[1]: *** [CMakeFiles/Makefile2:5139: test/CMakeFiles/test_malloc_pure_c.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
Full log in additional information.
Additional Information
- onetbb-2022.1.0-1-x86_64-build.log
- Bisected to GCC commit 17db574 libstdc++: Add cold attribute to assertion failure functions [PR117650]
- Fixed by Fedora in https://src.fedoraproject.org/rpms/tbb/blob/rawhide/f/tbb-c++-linkage.patch @jamesjer.
- Worked around by Gentoo in https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-cpp/tbb/tbb-2022.1.0.ebuild @thesamesam .
- Downstream Arch merge request https://gitlab.archlinux.org/archlinux/packaging/packages/onetbb/-/merge_requests/2.