Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 833372

Summary: media-gfx/openvdb-9.0.0: missing libatomic
Product: Gentoo Linux Reporter: Yixun Lan <dlan>
Component: Current packagesAssignee: Adrian <agrigo2001>
Status: RESOLVED FIXED    
Severity: normal CC: proxy-maint, riscv, sam
Priority: Normal    
Version: unspecified   
Hardware: riscv   
OS: Linux   
URL: https://gitlab.kitware.com/cmake/cmake/-/merge_requests/6693#note_1080533
See Also: https://bugs.gentoo.org/show_bug.cgi?id=832947
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 721344, 803482    
Attachments: full build log
fix-atomic.patch

Description Yixun Lan archtester gentoo-dev 2022-02-15 03:05:37 UTC
/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
Comment 1 Yixun Lan archtester gentoo-dev 2022-02-15 03:07:08 UTC
Created attachment 765143 [details]
full build log
Comment 2 Yixun Lan archtester gentoo-dev 2022-02-16 14:29:18 UTC
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
Comment 3 Larry the Git Cow gentoo-dev 2022-02-18 22:23:51 UTC
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(+)
Comment 4 Alex Fan archtester 2022-02-19 03:48:17 UTC
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.