!!! existing preserved libs: >>> package: dev-libs/rocr-runtime-4.3.0 * - /usr/lib64/libhsa-runtime64.so.1 * - /usr/lib64/libhsa-runtime64.so.1.3.0 * used by /usr/lib64/libomptarget.rtl.amdgpu.so (sys-libs/libomp-13.0.1) >>> package: dev-libs/roct-thunk-interface-4.3.0 * - /usr/lib64/libhsakmt.so.1 * - /usr/lib64/libhsakmt.so.1.0.6 * used by /usr/lib64/libhsa-runtime64.so.1 (preserved) * used by /usr/lib64/libhsa-runtime64.so.1.3.0 (preserved)
That's because sys-libs/libomp[llvm_targets_AMDGPU] actually depends dev-libs/rocr-runtime In cmake configuration, if dev-libs/rocr-runtime is already emerged, then cmake will explicitly link libhsa-runtime.so; if not found, then it will use dlopen to load libhsa-runtime.so at runtime. Both cases needs dev-libs/rocr-runtime to be installed. In your case dev-libs/rocr-runtime is installed before sys-libs/libomp[llvm_targets_AMDGPU], so there are explicit link.
Thanks for the explanation and the patch. I'm sorry it took me this long to look at it. I'll merge your PR and copy the change to newer versions.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6320bf1752822040277b09a8e5fd7360cc0083dd commit 6320bf1752822040277b09a8e5fd7360cc0083dd Author: Yiyang Wu <xgreenlandforwyy@gmail.com> AuthorDate: 2023-01-27 12:49:18 +0000 Commit: Michał Górny <mgorny@gentoo.org> CommitDate: 2023-02-15 11:08:08 +0000 sys-libs/libomp: AMDGPU offload depend on rocr-runtime The package has a semi-automagic dependency on rocr-runtime. If it is installed at build time, it links to it. If it is not, it loads it dynamically at runtime. In either case, the library is needed for offloading to work. Closes: https://bugs.gentoo.org/835095 Signed-off-by: Yiyang Wu <xgreenlandforwyy@gmail.com> Closes: https://github.com/gentoo/gentoo/pull/29298 Signed-off-by: Michał Górny <mgorny@gentoo.org> profiles/arch/amd64/package.use.mask | 5 +++++ profiles/arch/amd64/package.use.stable.mask | 7 ++++++- profiles/base/package.use.mask | 5 +++++ sys-libs/libomp/{libomp-15.0.7.ebuild => libomp-15.0.7-r1.ebuild} | 1 + sys-libs/libomp/libomp-16.0.0.9999.ebuild | 1 + sys-libs/libomp/libomp-16.0.0_rc2.ebuild | 1 + sys-libs/libomp/libomp-17.0.0.9999.ebuild | 1 + sys-libs/libomp/libomp-17.0.0_pre20230211.ebuild | 1 + 8 files changed, 21 insertions(+), 1 deletion(-)
In the future there may be other versions of rocr-runtime. Also, there's a very similar case for clang, recorded in https://github.com/llvm/llvm-project/issues/60660
sys-libs/libomp-15.0.7-r1 fails to compile after these commits. [559/581] cd /var/tmp/portage/sys-libs/libomp-15.0.7-r1/work/openmp_build-abi_x86_64.amd64/libomptarget/DeviceRTL && /usr/bin/cmake -E copy /var/tmp/portage/sys-libs/libomp-15.0.7-r1/work/openmp_build-abi_x86_64.amd64/libomptarget/DeviceRTL/libomptarget-amdgpu-gfx1036.bc /var/tmp/portage/sys-libs/libomp-15.0.7-r1/work/openmp_build-abi_x86_64.amd64/libomptarget [560/581] /usr/lib/ccache/bin/x86_64-pc-linux-gnu-g++ -DTARGET_NAME=AMDGPU -I/usr/lib/llvm/15/include -I/var/tmp/portage/sys-libs/libomp-15.0.7-r1/work/openmp/libomptarget/include -I/var/tmp/portage/sys-libs/libomp-15.0.7-r1/work/openmp/libomptarget/plugins/amdgpu/impl -I/var/tmp/portage/sys-libs/libomp-15.0.7-r1/work/openmp/libomptarget/plugins/common/elf_common -DNDEBUG -march=native -mtune=native -O2 -pipe -Wall -Wcast-qual -Wimplicit-fallthrough -Wsign-compare -Wno-extra -Wno-pedantic -Wno-maybe-uninitialized -std=c++14 -fPIC -MD -MT libomptarget/plugins/amdgpu/CMakeFiles/omptarget.rtl.amdgpu.dir/impl/impl.cpp.o -MF libomptarget/plugins/amdgpu/CMakeFiles/omptarget.rtl.amdgpu.dir/impl/impl.cpp.o.d -o libomptarget/plugins/amdgpu/CMakeFiles/omptarget.rtl.amdgpu.dir/impl/impl.cpp.o -c /var/tmp/portage/sys-libs/libomp-15.0.7-r1/work/openmp/libomptarget/plugins/amdgpu/impl/impl.cpp FAILED: libomptarget/plugins/amdgpu/CMakeFiles/omptarget.rtl.amdgpu.dir/impl/impl.cpp.o /usr/lib/ccache/bin/x86_64-pc-linux-gnu-g++ -DTARGET_NAME=AMDGPU -I/usr/lib/llvm/15/include -I/var/tmp/portage/sys-libs/libomp-15.0.7-r1/work/openmp/libomptarget/include -I/var/tmp/portage/sys-libs/libomp-15.0.7-r1/work/openmp/libomptarget/plugins/amdgpu/impl -I/var/tmp/portage/sys-libs/libomp-15.0.7-r1/work/openmp/libomptarget/plugins/common/elf_common -DNDEBUG -march=native -mtune=native -O2 -pipe -Wall -Wcast-qual -Wimplicit-fallthrough -Wsign-compare -Wno-extra -Wno-pedantic -Wno-maybe-uninitialized -std=c++14 -fPIC -MD -MT libomptarget/plugins/amdgpu/CMakeFiles/omptarget.rtl.amdgpu.dir/impl/impl.cpp.o -MF libomptarget/plugins/amdgpu/CMakeFiles/omptarget.rtl.amdgpu.dir/impl/impl.cpp.o.d -o libomptarget/plugins/amdgpu/CMakeFiles/omptarget.rtl.amdgpu.dir/impl/impl.cpp.o -c /var/tmp/portage/sys-libs/libomp-15.0.7-r1/work/openmp/libomptarget/plugins/amdgpu/impl/impl.cpp In file included from /var/tmp/portage/sys-libs/libomp-15.0.7-r1/work/openmp/libomptarget/plugins/amdgpu/impl/rt.h:11, from /var/tmp/portage/sys-libs/libomp-15.0.7-r1/work/openmp/libomptarget/plugins/amdgpu/impl/impl.cpp:8: /var/tmp/portage/sys-libs/libomp-15.0.7-r1/work/openmp/libomptarget/plugins/amdgpu/impl/hsa_api.h:11:10: fatal error: hsa.h: No such file or directory 11 | #include "hsa.h" | ^~~~~~~ compilation terminated. [561/581] cd /var/tmp/portage/sys-libs/libomp-15.0.7-r1/work/openmp_build-abi_x86_64.amd64/libomptarget/DeviceRTL && /usr/lib/llvm/15/bin/clang -fopenmp -fopenmp-cuda-mode -foffload-lto -fvisibility=hidden -Xopenmp-target=nvptx64-nvidia-cuda --cuda-feature=+ptx61 -nocudalib -nogpulib -nostdinc -O3 -mllvm -openmp-opt-disable -DSHARED_SCRATCHPAD_SIZE=512 --offload-arch=sm_35 --offload-arch=sm_37 --offload-arch=sm_50 --offload-arch=sm_52 --offload-arch=sm_53 --offload-arch=sm_60 --offload-arch=sm_61 --offload-arch=sm_62 --offload-arch=sm_70 --offload-arch=sm_72 --offload-arch=sm_75 --offload-arch=sm_80 --offload-arch=sm_86 --offload-arch=gfx700 --offload-arch=gfx701 --offload-arch=gfx801 --offload-arch=gfx803 --offload-arch=gfx900 --offload-arch=gfx902 --offload-arch=gfx906 --offload-arch=gfx908 --offload-arch=gfx90a --offload-arch=gfx90c --offload-arch=gfx940 --offload-arch=gfx1010 --offload-arch=gfx1030 --offload-arch=gfx1031 --offload-arch=gfx1032 --offload-arch=gfx1033 --offload-arch=gfx1034 --offload-arch=gfx1035 --offload-arch=gfx1036 --std=c++17 -c -o /var/tmp/portage/sys-libs/libomp-15.0.7-r1/work/openmp_build-abi_x86_64.amd64/libomptarget/DeviceRTL/Configuration.cpp.o -I/var/tmp/portage/sys-libs/libomp-15.0.7-r1/work/openmp/libomptarget/DeviceRTL/include -I/var/tmp/portage/sys-libs/libomp-15.0.7-r1/work/openmp/libomptarget/DeviceRTL/../include -I/usr/lib/llvm/15/include /var/tmp/portage/sys-libs/libomp-15.0.7-r1/work/openmp/libomptarget/DeviceRTL/src/Configuration.cpp ninja: build stopped: subcommand failed. * ERROR: sys-libs/libomp-15.0.7-r1::gentoo failed (compile phase): * ninja -v -j2 -l0 failed * * Call stack: * ebuild.sh, line 136: Called src_compile * environment, line 4372: Called cmake-multilib_src_compile * environment, line 1486: Called multilib-minimal_src_compile * environment, line 3235: Called multilib_foreach_abi 'multilib-minimal_abi_src_compile' * environment, line 3502: Called multibuild_foreach_variant '_multilib_multibuild_wrapper' 'multilib-minimal_abi_src_compile' * environment, line 3195: Called _multibuild_run '_multilib_multibuild_wrapper' 'multilib-minimal_abi_src_compile' * environment, line 3193: Called _multilib_multibuild_wrapper 'multilib-minimal_abi_src_compile' * environment, line 544: Called multilib-minimal_abi_src_compile * environment, line 3229: Called multilib_src_compile * environment, line 3722: Called cmake_src_compile * environment, line 1597: Called cmake_build * environment, line 1566: Called eninja * environment, line 2021: Called die * The specific snippet of code: * "$@" || die -n "${*} failed" There is /var/tmp/portage/sys-libs/libomp-15.0.7-r1/work/openmp/libomptarget/plugins/amdgpu/dynamic_hsa/hsa.h and /usr/include/hsa/hsa.h from dev-libs/rocr-runtime-5.3.3-r1
Created attachment 851774 [details] build.log of sys-libs/libomp-15.0.7-r1
This maybe needs to be backported to 15: https://github.com/llvm/llvm-project/commit/716bae0b48375ce59ff107df0997f279a41dfec9 "[Libomptarget] Include "hsa/hsa.h" instead Summary: Recently AMD moved the "hsa.h" include to "hsa/hsa.h". This causes several warning. This patch checks to see if we can include that one instead. This should hopefully keep things backwards compatible while silencing the warnings."
(In reply to jospezial from comment #5) > sys-libs/libomp-15.0.7-r1 fails to compile after these commits. The root cause is https://gitweb.gentoo.org/repo/gentoo.git/commit/bbff88f734f62381b0a0624b4b2d182a8d4b8589 where I disabled the non-FHS installation manifest which provides "/usr/include/hsa.h" (its now placed at "/usr/include/hsa/hsa.h", ROCm team calls this reorganization), and many projects are affected because they are not switched to "hsa/hsa.h" yet. Now it's a duplication of https://bugs.gentoo.org/893602 and https://bugs.gentoo.org/894040
(In reply to jospezial from comment #7) > This maybe needs to be backported to 15: > > https://github.com/llvm/llvm-project/commit/ > 716bae0b48375ce59ff107df0997f279a41dfec9 > "[Libomptarget] Include "hsa/hsa.h" instead > > Summary: > Recently AMD moved the "hsa.h" include to "hsa/hsa.h". This causes > several warning. This patch checks to see if we can include that one > instead. This should hopefully keep things backwards compatible while > silencing the warnings." I can also manually link hsa/hsa.h to hsa.h at /usr/include. This will fix all other bugs caused by this, restoring backward compatibility and not breaking potentially other packages rely on /usr/include/hsa.h
(In reply to Yiyang Wu from comment #8) > (In reply to jospezial from comment #5) > > sys-libs/libomp-15.0.7-r1 fails to compile after these commits. > > The root cause is > https://gitweb.gentoo.org/repo/gentoo.git/commit/ > bbff88f734f62381b0a0624b4b2d182a8d4b8589 where I disabled the non-FHS Correct link is https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bbff88f734f62381b0a0624b4b2d182a8d4b8589 >I can also manually link hsa/hsa.h to hsa.h at /usr/include. This will fix all >other bugs caused by this, restoring backward compatibility and not breaking >potentially other packages rely on /usr/include/hsa.h I had to do the same for /usr/include/hsa/hsa_ext_amd.h but then it gets more complicated,should I link all header files?: FAILED: libomptarget/plugins/amdgpu/CMakeFiles/omptarget.rtl.amdgpu.dir/impl/impl.cpp.o /usr/lib/ccache/bin/x86_64-pc-linux-gnu-g++ -DTARGET_NAME=AMDGPU -I/usr/lib/llvm/15/include -I/var/tmp/portage/sys-libs/libomp-15.0.7-r1/work/openmp/libomptarget/include -I/var/tmp/portage/sys-libs/libomp-15.0.7-r1/work/openmp/libomptarget/plugins/amdgpu/impl -I/var/tmp/portage/sys-libs/libomp-15.0.7-r1/work/openmp/libomptarget/plugins/common/elf_common -DNDEBUG -march=native -mtune=native -O2 -pipe -Wall -Wcast-qual -Wimplicit-fallthrough -Wsign-compare -Wno-extra -Wno-pedantic -Wno-maybe-uninitialized -std=c++14 -fPIC -MD -MT libomptarget/plugins/amdgpu/CMakeFiles/omptarget.rtl.amdgpu.dir/impl/impl.cpp.o -MF libomptarget/plugins/amdgpu/CMakeFiles/omptarget.rtl.amdgpu.dir/impl/impl.cpp.o.d -o libomptarget/plugins/amdgpu/CMakeFiles/omptarget.rtl.amdgpu.dir/impl/impl.cpp.o -c /var/tmp/portage/sys-libs/libomp-15.0.7-r1/work/openmp/libomptarget/plugins/amdgpu/impl/impl.cpp In file included from /var/tmp/portage/sys-libs/libomp-15.0.7-r1/work/openmp/libomptarget/plugins/amdgpu/impl/hsa_api.h:12, from /var/tmp/portage/sys-libs/libomp-15.0.7-r1/work/openmp/libomptarget/plugins/amdgpu/impl/rt.h:11, from /var/tmp/portage/sys-libs/libomp-15.0.7-r1/work/openmp/libomptarget/plugins/amdgpu/impl/impl.cpp:8: /usr/include/hsa_ext_amd.h:49:10: fatal error: hsa_ext_image.h: No such file or directory 49 | #include "hsa_ext_image.h"
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c107d9dcbaf1a3e350917c672971e3e932984923 commit c107d9dcbaf1a3e350917c672971e3e932984923 Author: Michał Górny <mgorny@gentoo.org> AuthorDate: 2023-02-17 12:16:11 +0000 Commit: Michał Górny <mgorny@gentoo.org> CommitDate: 2023-02-17 12:21:35 +0000 sys-libs/libomp: Fix compilation against newer dev-libs/rocr-runtime Bug: https://bugs.gentoo.org/835095 Signed-off-by: Michał Górny <mgorny@gentoo.org> sys-libs/libomp/Manifest | 1 + sys-libs/libomp/libomp-15.0.7-r1.ebuild | 1 + 2 files changed, 2 insertions(+)
(In reply to Yiyang Wu from comment #8) > (In reply to jospezial from comment #5) > > sys-libs/libomp-15.0.7-r1 fails to compile after these commits. > > The root cause is > https://gitweb.gentoo.org/repo/gentoo.git/commit/ > bbff88f734f62381b0a0624b4b2d182a8d4b8589 where I disabled the non-FHS Unfortunately, this link is irrelevant.
(In reply to jospezial from comment #10) > (In reply to Yiyang Wu from comment #8) > > (In reply to jospezial from comment #5) > > > sys-libs/libomp-15.0.7-r1 fails to compile after these commits. > > > > The root cause is > > https://gitweb.gentoo.org/repo/gentoo.git/commit/ > > bbff88f734f62381b0a0624b4b2d182a8d4b8589 where I disabled the non-FHS > Correct link is > https://gitweb.gentoo.org/repo/gentoo.git/commit/ > ?id=bbff88f734f62381b0a0624b4b2d182a8d4b8589 > Ah, thanks. Now I know the correct way to reference the commit. > >I can also manually link hsa/hsa.h to hsa.h at /usr/include. This will fix all >other bugs caused by this, restoring backward compatibility and not breaking >potentially other packages rely on /usr/include/hsa.h > > I had to do the same for /usr/include/hsa/hsa_ext_amd.h but then it gets > more complicated,should I link all header files?: Seems that restoring backward compatibility is not trivial. Since the patch is already back-ported to libomp, lets do it in this way: fix bugs for packages that depend on rocr-runtimes.