From 5cdf389fd2bdffd38450020639614522c63c2b82 Mon Sep 17 00:00:00 2001 From: Yixun Lan Date: Sun, 27 Mar 2022 12:22:30 +0800 Subject: 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 --- 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(+) create mode 100644 media-libs/libjxl/files/libjxl-0.7.0-pthread.patch (limited to 'media-libs/libjxl') diff --git a/media-libs/libjxl/files/libjxl-0.7.0-pthread.patch b/media-libs/libjxl/files/libjxl-0.7.0-pthread.patch new file mode 100644 index 000000000000..ea64e5805479 --- /dev/null +++ b/media-libs/libjxl/files/libjxl-0.7.0-pthread.patch @@ -0,0 +1,40 @@ + +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 + +the command of "gcc dumpspecs | grep pthread" will show accordingly in RISC-V: +pthread:--push-state --as-needed -latomic --pop-state + +https://bugs.gentoo.org/836125 +https://github.com/libjxl/libjxl/issues/1283 + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4df740b..59c7f03 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -190,6 +190,9 @@ endif() # JPEGXL_STATIC + # Threads + set(THREADS_PREFER_PTHREAD_FLAG YES) + find_package(Threads REQUIRED) ++if(CMAKE_USE_PTHREADS_INIT) ++ target_link_libraries(Threads::Threads INTERFACE -pthread) ++endif() + + if(JPEGXL_STATIC) + if (MINGW) +diff --git a/tools/conformance/CMakeLists.txt b/tools/conformance/CMakeLists.txt +index bd25b1c..d125dc5 100644 +--- a/tools/conformance/CMakeLists.txt ++++ b/tools/conformance/CMakeLists.txt +@@ -4,7 +4,7 @@ + # license that can be found in the LICENSE file. + + add_executable(djxl_conformance djxl_conformance.cc) +-target_link_libraries(djxl_conformance jxl_dec) ++target_link_libraries(djxl_conformance jxl_dec -pthread) + + if(BUILD_TESTING AND CMAKE_EXECUTABLE_SUFFIX STREQUAL "") + # Script to validate the tooling. diff --git a/media-libs/libjxl/libjxl-0.7.0_pre20220311.ebuild b/media-libs/libjxl/libjxl-0.7.0_pre20220311.ebuild index 1afe0678670a..f16373af5651 100644 --- a/media-libs/libjxl/libjxl-0.7.0_pre20220311.ebuild +++ b/media-libs/libjxl/libjxl-0.7.0_pre20220311.ebuild @@ -30,6 +30,8 @@ DEPEND="app-arch/brotli:=[${MULTILIB_USEDEP}] RDEPEND="${DEPEND}" +PATCHES=( "${FILESDIR}/${PN}-0.7.0-pthread.patch" ) + S="${WORKDIR}/libjxl-libjxl-3f8e77f" multilib_src_configure() { -- cgit v1.2.3-65-gdbad