KhronosGroup / KhronosGroup/SPIRV-LLVM-Translator
llvm10 build with translator fails with BUILD_LLVM_DYLIB=on
- Dominant language
- LLVM
- Stars
- 625
- Forks
- 279
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 34
Description
Building llvm 10 with the translator fails if `-DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON` are enabled. Is this expected?
To reproduce:
```
git clone git@github.com:llvm/llvm-project.git -b release/10.x
git clone -b llvm_release_100 https://github.com/KhronosGroup/SPIRV-LLVM-Translator llvm-project/llvm/projects/llvm-spirv
mkdir build && cd build && cmake ../llvm-project/llvm/ -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_RTTI=on -DLLVM_USE_INTEL_JITEVENTS=on -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON -DLLVM_ABI_BREAKING_CHECKS=FORCE_OFF -DLLVM_ENABLE_ABI_BREAKING_CHECKS=0 -DLLVM_SPIRV_INCLUDE_TESTS=OFF -DLLVM_USE_LINKER=gold
make -j`nproc`
```
Results in:
```
CMakeFiles/llvm-spirv.dir/llvm-spirv.cpp.o:llvm-spirv.cpp:function convertSPIRV()::{lambda(std::ostream&)#1}::operator()(std::ostream&) const [clone ..0]: error: undefined reference to 'SPIRV::convertSpirv(std::istream&, std::ostream&, std::__cxx11::basic_string, std::altor >&, bool, bool)'
CMakeFiles/llvm-spirv.dir/llvm-spirv.cpp.o:llvm-spirv.cpp:function parseSpecConstOpt(llvm::StringRef, SPIRV::TranslatorOpts&): error: undefined refereto 'llvm::getSpecConstInfo(std::istream&, std::vector, std::allocator > >&
CMakeFiles/llvm-spirv.dir/llvm-spirv.cpp.o:llvm-spirv.cpp:function main: error: undefined reference to 'llvm::regularizeLlvmForSpirv(llvm::Module*, st_cxx11::basic_string, std::allocator >&, SPIRV::TranslatorOpts const&)'
CMakeFiles/llvm-spirv.dir/llvm-spirv.cpp.o:llvm-spirv.cpp:function main: error: undefined reference to 'llvm::readSpirv(llvm::LLVMContext&, SPIRV::TratorOpts const&, std::istream&, llvm::Module*&, std::__cxx11::basic_string, std::allocator >&)'
CMakeFiles/llvm-spirv.dir/llvm-spirv.cpp.o:llvm-spirv.cpp:function main: error: undefined reference to 'llvm::getSpecConstInfo(std::istream&, std::vecstd::pair, std::allocator > >&)'
CMakeFiles/llvm-spirv.dir/llvm-spirv.cpp.o:llvm-spirv.cpp:function main: error: undefined reference to 'llvm::writeSpirv(llvm::Module*, SPIRV::Translapts const&, std::ostream&, std::__cxx11::basic_string, std::allocator >&)'
CMakeFiles/llvm-spirv.dir/llvm-spirv.cpp.o:llvm-spirv.cpp:function main: error: undefined reference to 'llvm::writeSpirv(llvm::Module*, SPIRV::Translapts const&, std::ostream&, std::__cxx11::basic_string, std::allocator >&)'
CMakeFiles/llvm-spirv.dir/llvm-spirv.cpp.o:llvm-spirv.cpp:function main: error: undefined reference to 'SPIRV::SPIRVUseTextFormat'
collect2: error: ld returned 1 exit status
```
Contributor guide
Research direction
Start with the provided LLVM 10 checkout, SPIRV-LLVM-Translator llvm_release_100 checkout, and the CMake command enabling LLVM dylibs. Inspect how the llvm-spirv target links its translator sources and libraries, then rebuild with the reproduced command. Done means the llvm-spirv target links successfully with both dylib options enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100