intel / intel-graphics-compiler

Other
606 stars 158 forks source link

IGC/BiFModule/CMakeLists.txt calls 'readelf' directly #147

Closed mkszuba closed 3 years ago

mkszuba commented 4 years ago

IGC/BiFModule/CMakeLists.txt uses readelf in order to extract the SONAME version from opencl-clang. Unfortunately it calls the tool in question as literally 'readelf', which will quietly fail (and result in a rather confusing message about opencl-clang being too old a moment later) e.g. on systems where only 'x86_64-pc-linux-gnu-readelf' is available.

Steps to reproduce:

  1. make sure opencl-clang is installed somewhere
  2. remove 'readelf' from PATH
  3. run 'cmake' or equivalent on IGC sources with -DIGC_OPTION__FORCE_SYSTEM_LLVM=ON

Proposed fix:

  1. In IGC/BiFModule/CMakeLists.txt:166 , call ${CMAKE_READELF} instead of readelf. At least on my system this is already set;
  2. Update IGC build scripts so that CMake detects the toolchain prefix, which will propagate to CMAKE_READELF;
  3. (optional but recommended) Verify that the execute_command() call in question has succeeded before proceeding.
pszymich commented 3 years ago

Hello Marek,

We have added verification to execute_process()'s result so that a potential error is properly communicated: https://github.com/intel/intel-graphics-compiler/commit/a57f361108a3172fae85b16ca43724d366804568. After an internal discussion, we've decided to leave the responsibility to include readelf in the PATH to the user.

Thank you for your contribution!