Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 930391 - media-libs/oidn-2.2.2 fails to build with USE=hip - cannot find ROCm device library
Summary: media-libs/oidn-2.2.2 fails to build with USE=hip - cannot find ROCm device l...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Sebastian Parborg
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2024-04-21 22:06 UTC by Bartosz Stebel
Modified: 2024-06-28 17:00 UTC (History)
7 users (show)

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


Attachments
build.log (build.log,75.89 KB, text/plain)
2024-04-21 22:08 UTC, Bartosz Stebel
Details
emerge --info (einfo.txt,9.49 KB, text/plain)
2024-04-21 22:08 UTC, Bartosz Stebel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bartosz Stebel 2024-04-21 22:06:43 UTC
Build fails during compilation:

[2/8] Building CXX object CMakeFiles/OpenImageDenoise_device_hip.dir/ck_conv_dl.cpp.o
FAILED: CMakeFiles/OpenImageDenoise_device_hip.dir/ck_conv_dl.cpp.o 
/usr/lib/llvm/17/bin/clang++ -DOpenImageDenoise_device_hip_EXPORTS -D__HIP_PLATFORM_AMD__=1 -D__HIP_PLATFORM_HCC__=1 -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -I/var/tmp/portage/media-libs/oidn-2.2.2/work/oidn-2.2.2/devices/hip/../../external/composable_kernel/include -I/var/tmp/portage/media-libs/oidn-2.2.2/work/oidn-2.2.2/devices/hip/../../external/composable_kernel/library/include -isystem /var/tmp/portage/media-libs/oidn-2.2.2/work/oidn-2.2.2 -isystem /var/tmp/portage/media-libs/oidn-2.2.2/work/oidn-2.2.2/external -isystem /var/tmp/portage/media-libs/oidn-2.2.2/work/oidn-2.2.2_build -O2 -march=native -pipe -ggdb  -Wall -Wno-unknown-pragmas -Wno-pass-failed -Wno-unneeded-internal-declaration -fPIC -Wformat -Wformat-security  -O2 -g -DNDEBUG  -fstack-protector -D_FORTIFY_SOURCE=2 -std=c++17 -fPIC -fvisibility=internal -fvisibility-inlines-hidden -Wno-unused-result -mllvm -amdgpu-early-inline-all=true -mllvm -amdgpu-function-calls=false -x hip --offload-arch=gfx1100 -MD -MT CMakeFiles/OpenImageDenoise_device_hip.dir/ck_conv_dl.cpp.o -MF CMakeFiles/OpenImageDenoise_device_hip.dir/ck_conv_dl.cpp.o.d -o CMakeFiles/OpenImageDenoise_device_hip.dir/ck_conv_dl.cpp.o -c /var/tmp/portage/media-libs/oidn-2.2.2/work/oidn-2.2.2/devices/hip/ck_conv_dl.cpp
clang++: error: cannot find ROCm device library; provide its path via '--rocm-path' or '--rocm-device-lib-path', or pass '-nogpulib' to build without ROCm device library


emerge -pqv '=media-libs/oidn-2.2.2::gentoo' :
[ebuild     U ] media-libs/oidn-2.2.2 [1.4.3] USE="hip%* -apps% -cuda% -openimageio% -test%" AMDGPU_TARGETS="gfx1100%* -gfx90a% -gfx803% -gfx900% -gfx906% -gfx908% -gfx1010% -gfx1011% -gfx1012% -gfx1030% -gfx1031% -gfx1101% -gfx1102%" LLVM_SLOT="17%* -15% -16%" PYTHON_SINGLE_TARGET="python3_11 -python3_10 -python3_12%" 

Reproducible: Always
Comment 1 Bartosz Stebel 2024-04-21 22:08:01 UTC
Created attachment 891288 [details]
build.log
Comment 2 Bartosz Stebel 2024-04-21 22:08:22 UTC
Created attachment 891289 [details]
emerge --info
Comment 3 Paul Zander 2024-04-21 22:15:07 UTC
The second cmake call at [68/94] doesn't pass -DROCM_PATH="${EPREFIX}/usr" it seems.

Can you test if setting ROCM_PATH="${EPREFIX}/usr" via package.env fixes the build?
Comment 4 Bartosz Stebel 2024-04-22 23:12:59 UTC
Looks like it didn't help, also the variable is set in the cmake cache for that sub-cmake:
# grep GPU /var/tmp/portage/media-libs/oidn-2.2.2/work/oidn-2.2.2_build/devices/hip/tmp/OpenImageDenoise_device_hip-cache-RelWithDebInfo.cmake
set(GPU_TARGETS "gfx1100" CACHE STRING "Initial cache" FORCE)
Comment 5 Bartosz Stebel 2024-04-22 23:25:37 UTC
2.1.0 fails exactly the same way BTW.
Comment 6 bratzmeister 2024-04-23 20:01:52 UTC
can confirm, exactly same behaviour. I also have gfx1100 maybe it's related to that?
Comment 7 bratzmeister 2024-04-23 20:09:07 UTC
also is it correct we are using python3.12 although target is set to 3.11?

emerge -pv oidn

These are the packages that would be merged, in order:

Calculating dependencies... done!
Dependency resolution took 3.93 s (backtrack: 0/20).

[ebuild   R   ~] media-libs/oidn-2.2.2::gentoo  USE="hip* -apps -cuda -openimageio -test" AMDGPU_TARGETS="gfx1100 -gfx90a -gfx803 -gfx900 -gfx906 -gfx908 -gfx1010 -gfx1011 -gfx1012 -gfx1030 -gfx1031 -gfx1101 -gfx1102" LLVM_SLOT="17 -15 -16" PYTHON_SINGLE_TARGET="python3_11 -python3_10 -python3_12" 0 KiB

and I have hipcc but it uses clang++ (not sure if this matters but was wondering why it doesn't use hipcc)

[68/94] cd /var/tmp/portage/media-libs/oidn-2.2.2/work/oidn-2.2.2_build/devices/hip/build && /usr/bin/cmake -GNinja -C/var/tmp/portage/media-libs/oidn-2.2.2/work/oidn-2.2.2_build/devices/hip/tmp/OpenImageDenoise_device_hip-cache-RelWithDebInfo.cmake -S /var/tmp/portage/media-libs/oidn-2.2.2/work/oidn-2.2.2/devices/hip -B /var/tmp/portage/media-libs/oidn-2.2.2/work/oidn-2.2.2_build/devices/hip/build && /usr/bin/cmake -E touch /var/tmp/portage/media-libs/oidn-2.2.2/work/oidn-2.2.2_build/devices/hip/stamp/OpenImageDenoise_device_hip-configure
loading initial cache file /var/tmp/portage/media-libs/oidn-2.2.2/work/oidn-2.2.2_build/devices/hip/tmp/OpenImageDenoise_device_hip-cache-RelWithDebInfo.cmake
-- The CXX compiler identification is Clang 17.0.6
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/lib/llvm/17/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Python: /usr/bin/python3.12 (found version "3.12.3") found components: Interpreter 
CMake Deprecation Warning at /usr/lib64/cmake/hip/hip-config.cmake:20 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.
Call Stack (most recent call first):
  CMakeLists.txt:32 (find_package)


CMake Deprecation Warning at /usr/lib64/cmake/hip/hip-config-amd.cmake:21 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.
Call Stack (most recent call first):
  /usr/lib64/cmake/hip/hip-config.cmake:160 (include)
  CMakeLists.txt:32 (find_package)


-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- hip::amdhip64 is SHARED_LIBRARY
-- Performing Test HIP_CLANG_SUPPORTS_PARALLEL_JOBS
-- Performing Test HIP_CLANG_SUPPORTS_PARALLEL_JOBS - Failed
-- Configuring done (0.6s)
-- Generating done (0.0s)
-- Build files have been written to: /var/tmp/portage/media-libs/oidn-2.2.2/work/oidn-2.2.2_build/devices/hip/build
Comment 8 Jan Henke 2024-05-03 21:18:25 UTC
Setting USE=-hip seems to unblock the build for the moment, even though at the loss of the functionality.

What is required to fix this bug?
Comment 9 alfwue 2024-05-15 12:50:43 UTC
On ubuntu, the original install location of rocm is /opt/rocm, the device libs are /opt/rocm/amdgcn. On gentoo the install location of rocm is /usr, the device libs are installed in /usr/lib/amdgcn. Adding a link in /user with

cd /usr
ln -s lib/amdgcn

fixes the build issue for me. The correct way would be to let cmake discover the right locaton, as he tries to do with

find_dependency(AMDDeviceLibs)

in /usr/lib64/cmake/hip/hip-config-amd.cmake

I don't know how to fix this.

By the way, i have a gfx1100 (7900 xt). The above link is a workaround to get oidn build with hip use flag. But on my gentoo os, blender crashes every time i try to load a cycles blend file. Maybe you have better luck.

On the amd website, there are only drivers for
ubuntu, redhat and suse enterprise linux. Ubuntu is the only one, which can be installed without bying a licence. And on this, my 7900 xt works with blender.
Comment 10 Alexander Helm 2024-05-21 21:30:49 UTC
(In reply to alfwue from comment #9)

Workaround works for me, albeit solution has to be adopted:

mkdir -p /opt/rocm
cd /opt/rocm
ln -s /usr/lib/amdgcn .

oidn can be compiled with hip-useflag afterwards.
Comment 11 Larry the Git Cow gentoo-dev 2024-06-28 17:00:44 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=346e44ed6db289af634a9f88a5624430ca13f3aa

commit 346e44ed6db289af634a9f88a5624430ca13f3aa
Author:     Aliaksei Urbanski <aliaksei.urbanski@gmail.com>
AuthorDate: 2024-06-26 03:54:29 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-06-28 16:59:57 +0000

    media-libs/oidn: fix missing ROCm in 2.x
    
    Closes: https://bugs.gentoo.org/930391
    Signed-off-by: Aliaksei Urbanski <aliaksei.urbanski@gmail.com>
    Signed-off-by: Sam James <sam@gentoo.org>

 media-libs/oidn/oidn-2.1.0.ebuild | 10 ++++++++++
 media-libs/oidn/oidn-2.2.2.ebuild |  6 ++++++
 2 files changed, 16 insertions(+)