How to compile clang llvm to amd gcn on linux ubuntu

98 Views Asked by At

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.

  1. I cloned the project (llvm 16)
  2. 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"
  1. Then compiled with the following line:
cmake --build llvm-project/build
  1. 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

  1. 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!

0

There are 0 best solutions below