OpenCL on Fedora 40 with ROCm (AMD) not working

For me, on Fedora 41, the symptoms were similar but with llvm18/ in the path for opencl-c-base.h. The thing can be debugged pretty quickly with the namei tool (from the util-linux package) pasting the “could not find file …” path:

$ namei /usr/lib64/llvm18/bin/../../../lib/clang/18/include/opencl-c-base.h
f: /usr/lib64/llvm18/bin/../../../lib/clang/18/include/opencl-c-base.h
 d /
 d usr
 d lib64
 d llvm18
    bin - No such file or directory

And a simple dnf install clang18 fixed that for me:

$ namei /usr/lib64/llvm18/bin/../../../lib/clang/18/include/opencl-c-base.h
f: /usr/lib64/llvm18/bin/../../../lib/clang/18/include/opencl-c-base.h
 d /
 d usr
 d lib64
 d llvm18
 d bin
 d ..
 d ..
 d ..
 d lib
 d clang
 d 18
 d include
 - opencl-c-base.h

and

$ darktable-cltest  | grep -E 'FINALLY|opencl_init'
     0.0139 [opencl_init] opencl library 'libOpenCL' found on your system and loaded, preference 'default path'
     0.0607 [opencl_init] found 1 platform
[opencl_init] found 1 device
[opencl_init] OpenCL successfully initialized. internal numbers and names of available devices:
[opencl_init]		0	'AMD Accelerated Parallel Processing gfx1103'
     0.2765 [opencl_init] FINALLY: opencl PREFERENCE=ON is AVAILABLE and ENABLED.
[opencl_init] opencl_scheduling_profile: 'default'
[opencl_init] opencl_device_priority: '*/!0,*/*/*/!0,*'
[opencl_init] opencl_mandatory_timeout: 400

So either someone fixes the clang18-libs RPM to not go through the /usr/lib64/llvm18/bin directory, or adds that as a directory to the clang18-libs RPM, or makes darktable or clang18-libs depend on clang18, whichever is required to get things to work.

1 Like