Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 836125 - media-libs/libjxl-0.7.0_pre20220311: undefined reference to __atomic_fetch_and_1
Summary: media-libs/libjxl-0.7.0_pre20220311: undefined reference to __atomic_fetch_and_1
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: riscv Linux
: Normal normal (vote)
Assignee: Daniel Novomeský
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: libatomic-linking 836013
  Show dependency tree
 
Reported: 2022-03-26 03:46 UTC by Yixun Lan
Modified: 2022-03-30 11:22 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
full build log (build.log.xz,8.05 KB, text/xz)
2022-03-26 03:47 UTC, Yixun Lan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yixun Lan archtester gentoo-dev 2022-03-26 03:46:47 UTC
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'
Comment 1 Yixun Lan archtester gentoo-dev 2022-03-26 03:47:56 UTC
Created attachment 767817 [details]
full build log
Comment 2 Daniel Novomeský 2022-03-26 12:27:30 UTC
I reported upstream:
https://github.com/libjxl/libjxl/issues/1283
Comment 3 Yixun Lan archtester gentoo-dev 2022-03-26 14:35:08 UTC
(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
Comment 4 Larry the Git Cow gentoo-dev 2022-03-27 14:00:22 UTC
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(+)
Comment 5 Yixun Lan archtester gentoo-dev 2022-03-27 14:02:26 UTC
I've pushed this patch (should be safe to apply), and successfully tested on arm(32bit), amd64, and riscv platform
Comment 6 Larry the Git Cow gentoo-dev 2022-03-30 11:22:59 UTC
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(-)