on RISC-V (maybe arm, ppc), libjxl missing atomic library in the link stage, most obvious error message like this: /usr/lib/gcc/riscv64-unknown-linux-gnu/11.2.1/../../../../riscv64-unknown-linux-gnu/bin/ld: lib/libjxl.a(dec_group_border.cc.o): in function `.L0 ': dec_group_border.cc:(.text+0x158): undefined reference to `__atomic_fetch_and_1' /usr/lib/gcc/riscv64-unknown-linux-gnu/11.2.1/../../../../riscv64-unknown-linux-gnu/bin/ld: dec_group_border.cc:(.text+0x16a): undefined reference to `__atomic_fetch_and_1'
Created attachment 767817 [details] full build log
I reported upstream: https://github.com/libjxl/libjxl/issues/1283
(In reply to Daniel Novomeský from comment #2) > I reported upstream: > https://github.com/libjxl/libjxl/issues/1283 thanks for the report, I've created a PR to fix it https://github.com/libjxl/libjxl/pull/1284
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5cdf389fd2bdffd38450020639614522c63c2b82 commit 5cdf389fd2bdffd38450020639614522c63c2b82 Author: Yixun Lan <dlan@gentoo.org> AuthorDate: 2022-03-27 04:22:30 +0000 Commit: Yixun Lan <dlan@gentoo.org> CommitDate: 2022-03-27 13:59:42 +0000 media-libs/libjxl: use -pthread to fix missing atomic issue Due to there is no 1, 2byte atomic instruction in 64bit RISC-V hardware, the software layer have to emulate relavant function in atomic library Let's explicitly pass -pthread here to work around pthread builtin since glibc version 2.34 as the "-pthread" option will pull in libatomic for machines like RISC-V Closes: https://bugs.gentoo.org/836125 Upstream: https://github.com/libjxl/libjxl/issues/1283 Package-Manager: Portage-3.0.30, Repoman-3.0.3 Signed-off-by: Yixun Lan <dlan@gentoo.org> media-libs/libjxl/files/libjxl-0.7.0-pthread.patch | 40 ++++++++++++++++++++++ media-libs/libjxl/libjxl-0.7.0_pre20220311.ebuild | 2 ++ 2 files changed, 42 insertions(+)
I've pushed this patch (should be safe to apply), and successfully tested on arm(32bit), amd64, and riscv platform
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ed8bf6b9c2e14a245d38526f9e70ddf0789d5e29 commit ed8bf6b9c2e14a245d38526f9e70ddf0789d5e29 Author: Yixun Lan <dlan@gentoo.org> AuthorDate: 2022-03-30 11:07:22 +0000 Commit: Yixun Lan <dlan@gentoo.org> CommitDate: 2022-03-30 11:22:35 +0000 media-libs/libjxl: rework atomic issue with upstream's solution backport patch from libjxl upstream to fix the atomic issue, btw, we can safely drop this patch in next version bump. URL: https://github.com/libjxl/libjxl/pull/1166 Bug: https://bugs.gentoo.org/836125 Package-Manager: Portage-3.0.30, Repoman-3.0.3 Signed-off-by: Yixun Lan <dlan@gentoo.org> media-libs/libjxl/files/libjxl-0.7.0-atomic.patch | 136 +++++++++++++++++++++ media-libs/libjxl/files/libjxl-0.7.0-pthread.patch | 40 ------ media-libs/libjxl/libjxl-0.7.0_pre20220311.ebuild | 2 +- 3 files changed, 137 insertions(+), 41 deletions(-)