CMake doesn't handle the case when multiple `opencl-c.h` are found

Open Beginner friendly
#314 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
cmake
Domain
build-system

Research direction

Start at IGC/BiFModule/CMakeLists.txt:48 and inspect how the opencl-c.h search result is passed to get_filename_component. Reproduce configuration with an LLVM installation containing both headers, then verify that configuration succeeds and selects a valid opencl-c.h path without requiring the other header to be renamed.

Written by the indexing model from the issue text.

Description

get_filename_component invocation fails because it's being done on a list (since multiple opencl-c.h can exist in a single LLVM installation)

-- =============================================================================
-- [IGC] : opencl-clang will be taken from prebuilds
-- [IGC] : Find CLANG_TOOL in : /home/pvelesko/install/llvm/14.0/dynamic/bin/clang
-- [IGC] : Find opencl-clang-lib in : /home/pvelesko/install/llvm/14.0/dynamic/lib/libopencl-clang.so
-- [CMFE] CM Frontend headers are taken from: /home/pvelesko/intel-compute-runtime-build/igc/IGC/CMFE/AdaptorCM
-- [CMFE] Using CMFE library name: libclangFEWrapper.so
-- +++ Source/IGC/VectorCompiler +++
-- [VC] Build proj: VectorCompiler
-- [VC] Using vc-intrinsics source from: /home/pvelesko/intel-compute-runtime-build/igc/IGC/VectorCompiler/../../../vc-intrinsics/GenXIntrinsics
 >>/home/pvelesko/intel-compute-runtime-build/igc/build/IGC/VectorCompiler/lib/GenXCodeGen/Utils/../<<  ->  /home/pvelesko/intel-compute-runtime-build/igc/build/IGC/VectorCompiler/lib/GenXCodeGen/Utils
 COMMAND ->  /usr/bin/python3 /home/pvelesko/intel-compute-runtime-build/igc/IGC/VectorCompiler/lib/GenXCodeGen/Utils/cisa_gen_intrinsics.py /home/pvelesko/intel-compute-runtime-build/igc/IGC/VectorCompiler/lib/GenXCodeGen/Utils/cisa_gen_intrinsics.json /home/pvelesko/intel-compute-runtime-build/igc/build/IGC/VectorCompiler/lib/GenXCodeGen/Utils/../ <-
 /home/pvelesko/intel-compute-runtime-build/igc/IGC/VectorCompiler/lib/GenXCodeGen/Utils
vc_build_bif - VCBiFPrintfOCL32 has extra dependencies: /home/pvelesko/intel-compute-runtime-build/igc/IGC/VectorCompiler/lib/BiF/printf_not_cm_common.h
vc_build_bif - VCBiFPrintfOCL64 has extra dependencies: /home/pvelesko/intel-compute-runtime-build/igc/IGC/VectorCompiler/lib/BiF/printf_not_cm_common.h
vc_build_bif - VCBiFPrintfZE32 has extra dependencies: /home/pvelesko/intel-compute-runtime-build/igc/IGC/VectorCompiler/lib/BiF/printf_not_cm_common.h
vc_build_bif - VCBiFPrintfZE64 has extra dependencies: /home/pvelesko/intel-compute-runtime-build/igc/IGC/VectorCompiler/lib/BiF/printf_not_cm_common.h
[IGC\BiFModuleCache] - IGC_BUILD__BIF_ROOT_DIR: /home/pvelesko/intel-compute-runtime-build/igc/build/IGC/Release/bif/
[IGC\BiFModuleCache] - Looking for files inside /home/pvelesko/install/llvm/14.0/dynamic/lib/clang/14.0.5/include/opencl-c.h
[IGC\BiFModuleCache] - BiFModule_SRC: /home/pvelesko/intel-compute-runtime-build/igc/IGC/BiFModule/cmake/../
CMake Error at IGC/BiFModule/CMakeLists.txt:48 (get_filename_component):
  get_filename_component unknown component
  /home/pvelesko/install/llvm/14.0/dynamic/lib/clang/14.0.5/include/opencl-c.h
╭─pvelesko@aurora-uan-0011 ~/install/llvm/14.0
╰─$ find ./ -name "opencl-c.h"
./include/cclang/opencl-c.h
./lib/clang/14.0.6/include/opencl-c.h

As a workaround I was able rename: ./include/cclang/opencl-c.h_BACKUP
or edit CMakeLists.txt to use the first found opencl-c.h

Dominant language
C++
Stars
718
Forks
191
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from intel/intel-graphics-compiler

All issues in intel/intel-graphics-compiler

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.