<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/159762>159762</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [OpenMP] nvptx64-nvidia-cuda device library ignores `LLVM_LIBDIR_SUFFIX`
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          tuliom
      </td>
    </tr>
</table>

<pre>
    Since the migration of the device libraries in #136729, we started seeing an unexpected behavior while building the nvptx64-nvidia-cuda device library.
The library does get built, but it the installation ignores the value from `-DLLVM_LIBDIR_SUFFIX=64`.

I investigated this a bit and the earliest point where `LLVM_LIBDIR_SUFFIX` is erased is the following.
Notice also the warning messages about LLVM and Clang not being found:

```
-- Detecting CXX compiler ABI info - failed
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Could NOT find LLVM (missing: LLVM_DIR)
-- Could NOT find Clang (missing: Clang_DIR)
CMake Warning at CMakeLists.txt:94 (message):
  debug-tm20 OPENMP_INSTALL_LIBDIR=


CMake Warning at CMakeLists.txt:95 (message):
 debug-tm20
 LLVM_LIBRARY_OUTPUT_INTDIR=/builddir/build/BUILD/llvm-22.0.0_pre20250909.g6a726e9a4d3d05-build/llvm-project-6a726e9a4d3d05f9aecf366fb6488d63135f04f3/llvm/redhat-linux-build/runtimes/runtimes-nvptx64-nvidia-cuda-bins/lib


CMake Warning at CMakeLists.txt:96 (message):
  debug-tm20 LLVM_LIBDIR_SUFFIX=


-- Performing Test CXX_SUPPORTS_UNWINDLIB_EQ_NONE_FLAG
-- Performing Test CXX_SUPPORTS_UNWINDLIB_EQ_NONE_FLAG - Failed
-- Performing Test CXX_SUPPORTS_NOSTDLIBXX_FLAG
-- Performing Test CXX_SUPPORTS_NOSTDLIBXX_FLAG - Failed
-- Performing Test CXX_SUPPORTS_NOSTDINCXX_FLAG
-- Performing Test CXX_SUPPORTS_NOSTDINCXX_FLAG - Failed
CMake Warning (dev) at /usr/share/cmake/Modules/GNUInstallDirs.cmake:253 (message):
  Unable to determine default CMAKE_INSTALL_LIBDIR directory because no
  target architecture is known.  Please enable at least one language before
 including GNUInstallDirs.
Call Stack (most recent call first):
 /builddir/build/BUILD/llvm-22.0.0_pre20250909.g6a726e9a4d3d05-build/llvm-project-6a726e9a4d3d05f9aecf366fb6488d63135f04f3/llvm/cmake/modules/AddLLVM.cmake:1 (include)
  CMakeLists.txt:202 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.
```

When setting `-DRUNTIMES_nvptx64-nvidia-cuda_LLVM_LIBDIR_SUFFIX=64` behavior does not reproduce, although the warnings about not finding LLVM and Clang are still there. A full build log is available at:
[builder-live.log.gz](https://github.com/user-attachments/files/22426569/builder-live.log.gz)

The amdgcn-amd-amdhsa library does not show the same issue after applying #159758 .
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzMVl1v6jwS_jXmZpQoOCSFCy5oKUdoKWULbLtXyIknibeOjWyHtvvrVzbQr9Nztue9eqVWJM7MPJ7PZ5i1olaIY5JdkmzaY51rtBm7Tgrd9grNX8ZroUoE1yC0ojbMCa1AV-GA40GUCFIUhhmBFoQCQtN-ml_QEaFX8IRgHTMOOVhEoWpgCjqFz3ss_WGBDTsIbeCpERKh6ITkXsobV4e9e84HkToILlhUdpx9BHyJSTLZNK-vwDVaqNEFO87jF50D4YI5oaxjUh7vL2qlDdrw4cBkh1AZ3QLJk2i6WPzrZreYX07nd7v1djabP5B0mg9Inng8kkzmINQBrRM18z64RlhgUAgHTPFgEpmRAq2DvRbKwVODBr3xL0znCQgLaJhF7p-8eqWl1E9C1R5wqZ13mUmrw8cnZpQPUYvWshotsEJ3DrzpgH8lmapBaQdFCHilO8VJOjneneTJ6S-ZRBFM0WHpvNjVwwOUut0LiQYml97HSkMEFRMS-W-koULmOoP2OzIQAdcKj6JXupMclrcbqITiRw8IHbbCWqF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