SPIR icon indicating copy to clipboard operation
SPIR copied to clipboard

Cannot build spirv compiler. What i am doing wrong?

Open marsohod4you opened this issue 8 years ago • 5 comments

Hello

I am trying to build SPIRV compiler. I think i do all according to instructions:

  1. git clone -b khronos/spirv-3.6.1 https://github.com/KhronosGroup/SPIRV-LLVM.git llvm
  2. cd llvm/tools
  3. git clone -b spirv-1.1 https://github.com/KhronosGroup/SPIR clang
  4. cd ../..
  5. mkdir build
  6. cd build
  7. ../llvm/configure --prefix=$PWD/done --enable-optimized --enable-targets=x86_64
  8. 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..

marsohod4you avatar Jul 09 '16 10:07 marsohod4you

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.

pierremoreau avatar Jul 10 '16 09:07 pierremoreau

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:

  1. git clone -b khronos/spirv-3.6.1 https://github.com/KhronosGroup/SPIRV-LLVM.git llvm
  2. cd llvm/tools
  3. git clone -b spirv-1.1 https://github.com/KhronosGroup/SPIR clang
  4. cd ../..
  5. mkdir build
  6. cd build
  7. cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=$PWD/done -DCMAKE_BUILD_TYPE=Release ../llvm
  8. make
  9. 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.

marsohod4you avatar Jul 11 '16 07:07 marsohod4you

Thank you soooooooooooo much marsohod4you!!!!!!!!!!!!!!!!!!!!

higsyuhing avatar Aug 15 '16 14:08 higsyuhing

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

hughperkins avatar Jun 25 '17 09:06 hughperkins

(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.

hughperkins avatar Jun 25 '17 09:06 hughperkins