/usr/lib/gcc/riscv64-unknown-linux-gnu/11.2.1/../../../../riscv64-unknown-linux-gnu/bin/ld: openvdb/openvdb/cmd/CMakeFiles/vdb_render.dir/openvdb_render.cc.o: undefined reference to symbol '__atomic_exchange_1@@LIBATOMIC_1.0' /usr/lib/gcc/riscv64-unknown-linux-gnu/11.2.1/../../../../riscv64-unknown-linux-gnu/bin/ld: /usr/lib/gcc/riscv64-unknown-linux-gnu/11.2.1/libatomic.so.1: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status
Created attachment 765143 [details] full build log
Created attachment 765265 [details] fix-atomic.patch for fixing this missing atomic library issue, we explicitly pass -pthread to work around pthread builtin since glibc-2.34, as we need -pthread to pull in libatomic for machines like riscv
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=64988e18d34d6d84629194aa767ef29ed5521881 commit 64988e18d34d6d84629194aa767ef29ed5521881 Author: Yixun Lan <dlan@gentoo.org> AuthorDate: 2022-02-18 22:20:45 +0000 Commit: Yixun Lan <dlan@gentoo.org> CommitDate: 2022-02-18 22:20:45 +0000 media-gfx/openvdb: fix missing atomic lib this happened on RISC-V platform, but may also exist in other ARCH, see tracking bug #721344 Closes: https://bugs.gentoo.org/833372 Package-Manager: Portage-3.0.30, Repoman-3.0.3 Signed-off-by: Yixun Lan <dlan@gentoo.org> .../openvdb/files/openvdb-9.0.0-fix-atomic.patch | 47 ++++++++++++++++++++++ media-gfx/openvdb/openvdb-9.0.0-r2.ebuild | 1 + 2 files changed, 48 insertions(+)
As a note for this fix, the actual issue is cmake with glibc 2.34+. Since glibc 2.34, pthread is builtin and linking pthread is not required. CMake detects this and doesn't append -pthread. This is not correct behaviour because glibc never claims -pthread is unnecessary e.g. -pthread pulls in libatomic in riscv. Newer CMake version has fixed this and backported.