I've been trying for about two days to compile clang-llvm for amd gcn and I'm stuck. My goal here is to be able to compile a hip program using the triple amdgcn-amd-amdhsa.
- I cloned the project (llvm 16)
- Used the following compilation line:
cmake -S llvm-project/llvm -B llvm-project/build -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;lld" -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc -G "Unix Makefiles" -DLLVM_TARGETS_TO_BUILD="AMDGPU" -DLLVM_RUNTIME_TARGETS="amdgcn-amd-amdhsa" -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi"
- Then compiled with the following line:
cmake --build llvm-project/build
- Then I got:
../../examples/add.cpp:1:10: fatal error: 'hip/hip_runtime.h' file not found
#include <hip/hip_runtime.h>
^~~~~~~~~~~~~~~~~~~
So I ran 3 again with -I /opt/rocm/include
- Then I got:
/opt/rocm/include/hip/hip_runtime.h:54:10: fatal error: 'thread' file not found
#include <thread>
^~~~~~~~
So I ran 4 this time with a path to include/c++/v1
and then I got that
#include <__config_site>
^~~~~~~~~~~~~~~
couldn't be found.
I think it's because I didn't compile libcpp properly because I can't find this file in file system but I can't make it work. Thank you!