CNugteren / CLBlast

Tuned OpenCL BLAS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CMake find package paths broken in MSYS2

bandoti opened this issue · comments

After installing CLBlast (version 1.6.1) in MSYS2 using:
pacman -S mingw-w64-ucrt-x86_64-clblast

The CLBlastConfig-release.cmake file is using the lib directory instead of bin for libclblast.dll:

list(APPEND _cmake_import_check_files_for_clblast "${_IMPORT_PREFIX}/lib/libclblast.dll.a" "${_IMPORT_PREFIX}/lib/libclblast.dll" )

However, DLLs are installed into /ucrt64/bin, and cmake fails.

...

CMake Error at C:/msys64/ucrt64/lib/cmake/CLBlast/CLBlastConfig.cmake:80 (message):
  The imported target "clblast" references the file

     "C:/msys64/ucrt64/lib/libclblast.dll"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "C:/msys64/ucrt64/lib/cmake/CLBlast/CLBlastConfig.cmake"

...

Here's a printout of the CMake file.

guy@place UCRT64 /ucrt64/lib/cmake/CLBlast
$ cat CLBlastConfig-release.cmake
#----------------------------------------------------------------
# Generated CMake target import file for configuration "Release".
#----------------------------------------------------------------

# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)

# Import target "clblast" for configuration "Release"
set_property(TARGET clblast APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(clblast PROPERTIES
  IMPORTED_IMPLIB_RELEASE "${_IMPORT_PREFIX}/lib/libclblast.dll.a"
  IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE "/ucrt64/lib/libOpenCL.dll.a"
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libclblast.dll"
  )

list(APPEND _cmake_import_check_targets clblast )
list(APPEND _cmake_import_check_files_for_clblast "${_IMPORT_PREFIX}/lib/libclblast.dll.a" "${_IMPORT_PREFIX}/lib/libclblast.dll" )

# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)

Thank you for reporting. However, I'm not sure how to fix this. Actually, I'm not even sure this is an issue with CLBlast itself.

A quick search on the CMake filename CLBlastConfig-release.cmake lead me to this packaging script from MSYS2:
https://github.com/msys2/MINGW-packages/blob/ea5fbbec103438687ff5a3fe7f29532fca0af63b/mingw-w64-clblast/PKGBUILD#L56
My guess is that the issue is on that side and in particular related to these lines:

  # move the dll to bin
  mkdir -p ${pkgdir}${MINGW_PREFIX}/bin
  mv "${pkgdir}${MINGW_PREFIX}/lib/libclblast.dll" "${pkgdir}${MINGW_PREFIX}/bin"

Thanks for tracking that down. I submitted a bug report on the MSYS2 project. I will update this issue if more information comes to light.

My guess is that the issue is on that side and in particular related to these lines:

The actual issue is in this repository. Those command workaround the issue. I shall create a pull request here to fix the issue.