Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 835095 - sys-libs/libomp-13.0.1 automagic dependency on dev-libs/rocr-runtime-4.3.0
Summary: sys-libs/libomp-13.0.1 automagic dependency on dev-libs/rocr-runtime-4.3.0
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Bernard Cafarelli
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2022-03-14 01:47 UTC by Alessandro Barbieri
Modified: 2023-02-18 11:53 UTC (History)
4 users (show)

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


Attachments
build.log of sys-libs/libomp-15.0.7-r1 (build.log,484.29 KB, text/plain)
2023-02-16 09:54 UTC, jospezial
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alessandro Barbieri 2022-03-14 01:47:19 UTC
!!! 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)
Comment 1 Yiyang Wu 2023-01-27 12:27:37 UTC
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.
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2023-02-15 11:03:38 UTC
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.
Comment 3 Larry the Git Cow gentoo-dev 2023-02-15 11:08:12 UTC
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(-)
Comment 4 Yiyang Wu 2023-02-15 12:50:48 UTC
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
Comment 5 jospezial 2023-02-16 09:53:00 UTC
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
Comment 6 jospezial 2023-02-16 09:54:04 UTC
Created attachment 851774 [details]
build.log of sys-libs/libomp-15.0.7-r1
Comment 7 jospezial 2023-02-16 10:29:42 UTC
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."
Comment 8 Yiyang Wu 2023-02-16 10:30:41 UTC
(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
Comment 9 Yiyang Wu 2023-02-16 10:33:30 UTC
(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
Comment 10 jospezial 2023-02-16 11:55:09 UTC
(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"
Comment 11 Larry the Git Cow gentoo-dev 2023-02-17 12:21:38 UTC
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(+)
Comment 12 Benda Xu gentoo-dev 2023-02-18 08:39:39 UTC
(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.
Comment 13 Yiyang Wu 2023-02-18 11:53:06 UTC
(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.