Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Cannot build spirv compiler. What i am doing wrong? #44

Open
marsohod4you opened this issue Jul 9, 2016 · 5 comments
Open

Cannot build spirv compiler. What i am doing wrong? #44

marsohod4you opened this issue Jul 9, 2016 · 5 comments

Comments

@marsohod4you
Copy link

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

@pierremoreau
Copy link

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.

@marsohod4you
Copy link
Author

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.

@higsyuhing
Copy link

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

@hughperkins
Copy link

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
Copy link

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

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants