SPIR
SPIR copied to clipboard
Cannot build spirv compiler. What i am doing wrong?
Hello
I am trying to build SPIRV compiler. I think i do all according to instructions:
- git clone -b khronos/spirv-3.6.1 https://github.com/KhronosGroup/SPIRV-LLVM.git llvm
- cd llvm/tools
- git clone -b spirv-1.1 https://github.com/KhronosGroup/SPIR clang
- cd ../..
- mkdir build
- cd build
- ../llvm/configure --prefix=$PWD/done --enable-optimized --enable-targets=x86_64
- make
I get error during compiling:
make[2]: *** No rule to make target '/home/nick/opencl/build/Release+Asserts/lib/libLLVMSPIRVLib.a', needed by '/home/nick/opencl/build/Release+Asserts/bin/llvm-c-test'. Stop.
What i am doing wrong?
Besides that i was able to build older version of SPIR compiler from branch spir_12 But as i understand modern compiler is not a SPIR but SPIRV.. I think i should not study solution from older things..
Try to use SPIR’s spirv-1.0 branch rather than spirv-1.1, as SPIRV-LLVM’s readme points to SPIR’s spirv-1.0 branch.
i think i found solution for my issue: i should use "cmake" instead of "configure". "Configure" does not create proper Makefiles I guess. So full build process should be:
- git clone -b khronos/spirv-3.6.1 https://github.com/KhronosGroup/SPIRV-LLVM.git llvm
- cd llvm/tools
- git clone -b spirv-1.1 https://github.com/KhronosGroup/SPIR clang
- cd ../..
- mkdir build
- cd build
- cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=$PWD/done -DCMAKE_BUILD_TYPE=Release ../llvm
- make
- make install
These above steps allow to build both spirv-1.1 and spirv-1.0 branches properly (at least without compile errors). Result is clang compilers in folder build/done.
It would be good if You could add these description into README file because for me, as beginner, it took about 4 days to understand how to build everything.
Thank you soooooooooooo much marsohod4you!!!!!!!!!!!!!!!!!!!!
cool. random observation: seems there is a spirv-3.8 by now (one year later). I wonder if we should use that?
(khronos/spirv-3.6.1|✔) ~/git/marsohodmethod/llvm$ git branch -a
* khronos/spirv-3.6.1
remotes/origin/HEAD -> origin/khronos/spirv-3.6.1
remotes/origin/khronos/spirv-3.6.1
remotes/origin/khronos/spirv-3.8
(hmmm, using anything other than the branches marsohod supplies gave me errors actually:
trying spirv-3.8 of llvm:
-- Clang version: 3.8.1
CMake Error at tools/clang/CMakeLists.txt:150 (include):
include could not find load file:
LLVMParseArguments
trying spir_12
of the spir repo:
CMake Error at cmake/modules/LLVM-Config.cmake:143 (message):
Library `jit' not found in list of llvm libraries.