ROCm/HIPIFY

[HIPIFY] Linking fails when LLVM libraries were compiled as shared library.

karlwessel opened this issue · 1 comments

Problem Description

When trying to link HIPIFY on Arch linux using LLVM from the arch package repository I get the following error when linking:

[100%] Linking CXX executable hipify-clang
/usr/bin/ld: cannot find -lclangASTMatchers: No such file or directory
/usr/bin/ld: cannot find -lclangFrontend: No such file or directory
/usr/bin/ld: cannot find -lclangTooling: No such file or directory
/usr/bin/ld: cannot find -lclangParse: No such file or directory
/usr/bin/ld: cannot find -lclangSerialization: No such file or directory
/usr/bin/ld: cannot find -lclangSema: No such file or directory
/usr/bin/ld: cannot find -lclangEdit: No such file or directory
/usr/bin/ld: cannot find -lclangFormat: No such file or directory
/usr/bin/ld: cannot find -lclangLex: No such file or directory
/usr/bin/ld: cannot find -lclangAnalysis: No such file or directory
/usr/bin/ld: cannot find -lclangDriver: No such file or directory
/usr/bin/ld: cannot find -lclangAST: No such file or directory
/usr/bin/ld: cannot find -lclangToolingCore: No such file or directory
/usr/bin/ld: cannot find -lclangRewrite: No such file or directory
/usr/bin/ld: cannot find -lclangBasic: No such file or directory
/usr/bin/ld: cannot find -lLLVMProfileData: No such file or directory
/usr/bin/ld: cannot find -lLLVMMCParser: No such file or directory
/usr/bin/ld: cannot find -lLLVMMC: No such file or directory
/usr/bin/ld: cannot find -lLLVMBitReader: No such file or directory
/usr/bin/ld: cannot find -lLLVMOption: No such file or directory
/usr/bin/ld: cannot find -lLLVMCore: No such file or directory
/usr/bin/ld: cannot find -lclangToolingInclusions: No such file or directory
/usr/bin/ld: cannot find -lLLVMFrontendOpenMP: No such file or directory
/usr/bin/ld: cannot find -lLLVMWindowsDriver: No such file or directory
/usr/bin/ld: cannot find -lclangSupport: No such file or directory
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [CMakeFiles/hipify-clang.dir/build.make:663: hipify-clang] Error 1
make[1]: *** [CMakeFiles/Makefile2:219: CMakeFiles/hipify-clang.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

This is because on Arch the LLVM libraries are compiled with LLVM_LINK_LLVM_DYLIB=ON to one shared library llvm.so instead of multiple static ones.
The same goes for clang.

For LLVM it is recommended in llvm/llvm-project#34593 to use the "llvm_config" macro to get the correct library names for a list of modules.

For clang it seems one could use the clang_target_link_libraries function from the Clang package for cmake to get the correct library names for a list of modules.

Operating System

Arch Linux

CPU

Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz

ROCm Version

ROCm 6.0.0

ROCm Component

HIPIFY

Steps to Reproduce

  1. Compile LLVM with LLVM_LINK_LLVM_DYLIB=ON.
  2. Try to compile and link HIPIFY using that LLVM. For example by pointing CMAKE_PREFIX_PATH to the according LLVM directory.

(Optional for Linux users) Output of /opt/rocm/bin/rocminfo --support

No response

Additional Information

No response

ROCm HIP and HIPIFY tools do not support Arch Linux yet.