Cannot build with external Level Zero installation
- Dominant language
- LLVM
- Stars
- 1.5k
- Forks
- 854
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 137
Description
**Describe the bug**
When pointing to an external Level Zero installation via the `-DLEVEL_ZERO_LIBRARY` and `-DLEVEL_ZERO_INCLUDE_DIR` CMake variables, configuration completes but compilation fails with the following error:
```
args:Namespace(build_number=None, branch=None, base_branch=None, pr_number=None, builder_dir=None, src_dir=None, obj_dir=None, build_parallelism=None, verbose=False, build_target='deploy-sycl-toolchain')
[Cmake Command]: cmake --build /scratch/llvm/build -- deploy-sycl-toolchain -j 144
[0/2] Re-checking globbed directories...
ninja: error: 'lib/libze_loader.so', needed by 'lib/libpi_level_zero.so', missing and no known rule to make it
Traceback (most recent call last):
File "/scratch/llvm/build/../buildbot/compile.py", line 71, in
ret = main()
File "/scratch/llvm/build/../buildbot/compile.py", line 67, in main
return do_compile(args)
File "/scratch/llvm/build/../buildbot/compile.py", line 42, in do_compile
subprocess.check_call(cmake_cmd, cwd=abs_obj_dir)
File "/opt/intel/oneapi_nightly/intelpython/latest/lib/python3.9/subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '/scratch/llvm/build', '--', 'deploy-sycl-toolchain', '-j', '144']' returned non-zero exit status 1.
```
**To Reproduce**
Fetch all external dependencies:
```
mkdir external
cd external
git clone https://github.com/KhronosGroup/OpenCL-Headers.git
git clone https://github.com/KhronosGroup/OpenCL-ICD-Loader.git
git clone https://github.com/oneapi-src/level-zero.git
git clone https://github.com/boostorg/mp11.git
git clone https://github.com/intel/vc-intrinsics.git
git clone https://github.com/KhronosGroup/SPIRV-Headers
```
Build and install Level Zero:
```
cd level-zero
mkdir build
mkdir install
cd build
cmake -DCMAKE_INSTALL_PREFIX=../install ..
cmake --build . --config Release
cmake --build . --config Release --target install
```
Configure:
```
cd ../../../
mkdir build
cd build
python3 ../buildbot/configure.py --cmake-opt="-DOpenCL_HEADERS=/scratch/llvm/external/OpenCL-Headers/" --cmake-opt="-DOpenCL_LIBRARY_SRC=/scratch/llvm/external/OpenCL-ICD-Loader/" --cmake-opt="-DLEVEL_ZERO_LIBRARY=/scratch/llvm/external/level-zero/install/lib/" --cmake-opt="-DLEVEL_ZERO_INCLUDE_DIR=/scratch/llvm/external/level-zero/install/include/" --cmake-opt="-DBOOST_MP11_SOURCE_DIR=/scratch/llvm/external/mp11/" --cmake-opt="-DLLVMGenXIntrinsics_SOURCE_DIR=/scratch/llvm/external/vc-intrinsics/" --cmake-opt="-DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=/scratch/llvm/external/SPIRV-Headers"
```
Build (this step fails):
```
python3 ../buildbot/compile.py
```
Looking inside the `build.ninja` file, I noticed that it searches for the Level Zero libraries inside of `./lib/`, so I was able to workaround this issue simply by copying the libraries out of my Level Zero installation:
```
cp ../external/level-zero/install/lib/*so* lib/
```
**Environment (please complete the following information):**
- OS: Linux
- Target device and vendor: N/A
- DPC++ version: N/A
- Dependencies version: N/A
**Additional context**
Supporting this compilation flow is important for machines that don't have internet access.
Contributor guide
Assessment
This issue has not been assessed yet.