Numpy is mostly written in C, but contains a few C++ files that include STL headers. In libstdc++, all the used definitions seem to be defined inline, but this is not the case with libc++. Either way, a non-freestanding C++ TU should *always* be linked via the CXX linker driver, but numpy links it's libraries with CC. In practice, this leads to numpy emitting relocations against the libc++ symbol `_ZNSt3__122__libcpp_verbose_abortEPKcz`, but as libc++ is not included in the link, the resulting libraries are unusable. Furthermore, a C++ compiler is allowed to pull in a runtime support library as it desires when building a non-freestanding TU, so this is very brittle even with libstdc++. I haven't gathered the courage to dig through the beautiful numpy build system just yet, but the fix should be fairly simple.
I do confirm add LDFLAGS="${LDFLAGS} -lstdc++" fixed this. Upstream hasn't decided what to do with.
See https://github.com/numpy/numpy/issues/23122 (bug) and https://github.com/numpy/numpy/pull/23601 (patch).
I can confirm that the above patch fixes the issue. Without this patch dev-python/matplotlib fails to compile throwing a _ZNSt3__122__libcpp_verbose_abortEPKcz symbol is missing error. The above patch to numpy fixes dev-python/matplotlib. I'm sure there could be other python packages that this is affecting.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=95bc234cf4f8d823d890a17571c7d517b42e6c4e commit 95bc234cf4f8d823d890a17571c7d517b42e6c4e Author: Sam James <sam@gentoo.org> AuthorDate: 2023-06-12 00:44:01 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-06-12 00:44:06 +0000 dev-python/numpy: fix build/link with libcxx New revision as this pretty much only worked by chance before and could affect the installed files as a result. Closes: https://bugs.gentoo.org/893962 Signed-off-by: Sam James <sam@gentoo.org> .../numpy/files/numpy-1.24.3-fix-c++-linkage.patch | 25 +++ dev-python/numpy/numpy-1.24.3-r1.ebuild | 176 +++++++++++++++++++++ 2 files changed, 201 insertions(+)
(In reply to Mike Batterton from comment #3) > I can confirm that the above patch fixes the issue. Without this patch > dev-python/matplotlib fails to compile throwing a > _ZNSt3__122__libcpp_verbose_abortEPKcz symbol is missing error. The above > patch to numpy fixes dev-python/matplotlib. I'm sure there could be other > python packages that this is affecting. Thanks for the nudge. For some reason, I was convinced newer numpy was closer around the corner than it really was. So, backported.