Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake --install . --prefix <some_path> failed in some cases #971

Open
vinser52 opened this issue Dec 5, 2024 · 0 comments
Open

cmake --install . --prefix <some_path> failed in some cases #971

vinser52 opened this issue Dec 5, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@vinser52
Copy link
Contributor

vinser52 commented Dec 5, 2024

Environment Information

  • UMF version (hash commit or a tag): main branch
  • OS(es) version(s): Ubuntu 22.04
  • cmake version : 3.22.1

Please provide a reproduction of the bug:

git clone https://github.com/oneapi-src/unified-memory-framework.git
cd unified-memory-framework
mkdir build && cd build
cmake .. \
    -DUMF_BUILD_EXAMPLES=OFF \
    -DUMF_BUILD_BENCHMARKS=OFF \
    -DUMF_BUILD_BENCHMARKS_MT=OFF \
    -DUMF_FORMAT_CODE_STYLE=OFF \
    -DUMF_DEVELOPER_MODE=ON \
    -DUMF_BUILD_SHARED_LIBRARY=ON \
    -DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON \
    -DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON \
    -DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON \
    -DUMF_BUILD_CUDA_PROVIDER=ON \
    -DUMF_BUILD_GPU_TESTS=OFF \
    -DUMF_BUILD_GPU_EXAMPLES=OFF \
    -DCMAKE_INSTALL_LOCAL_ONLY=TRUE

make -j$(nproc)

cmake --install . --prefix umf_install

How often bug is revealed:

Always when these two conditions are true:

  1. CMake version < 3.28
  2. The UMF_LEVEL_ZERO_INCLUDE_DIR is not specified and we fetch the Level Zero loader at the build time.

Actual behavior:

The cmake --install . --prefix umf_install fails with the following error:

-- Install configuration: "Release"
-- Installing: /workdir/umf_repo/build/umf_install/./include/level_zero/ze_api.h
-- Installing: /workdir/umf_repo/build/umf_install/./include/level_zero/ze_ddi.h
-- Installing: /workdir/umf_repo/build/umf_install/./include/level_zero/zes_api.h
-- Installing: /workdir/umf_repo/build/umf_install/./include/level_zero/zes_ddi.h
-- Installing: /workdir/umf_repo/build/umf_install/./include/level_zero/zet_api.h
-- Installing: /workdir/umf_repo/build/umf_install/./include/level_zero/zet_ddi.h
-- Installing: /workdir/umf_repo/build/umf_install/./include/level_zero/layers/zel_tracing_api.h
-- Installing: /workdir/umf_repo/build/umf_install/./include/level_zero/layers/zel_tracing_ddi.h
-- Installing: /workdir/umf_repo/build/umf_install/./include/level_zero/layers/zel_tracing_register_cb.h
-- Installing: /workdir/umf_repo/build/umf_install/./include/level_zero/loader/ze_loader.h
-- Installing: /workdir/umf_repo/build/umf_install/lib/libze_loader.so.1.19.2
-- Installing: /workdir/umf_repo/build/umf_install/lib/libze_loader.so.1
-- Installing: /workdir/umf_repo/build/umf_install/lib/libze_loader.so
CMake Error at _deps/level-zero-loader-build/source/cmake_install.cmake:99 (file):
  file cannot create directory: /usr/local/lib/pkgconfig.  Maybe need
  administrative privileges.
Call Stack (most recent call first):
  _deps/level-zero-loader-build/cmake_install.cmake:70 (include)
  cmake_install.cmake:47 (include)

Expected behavior:

The cmake --install . --prefix umf_install succeed.

Details

The root cause of the issue is the following:

  1. The macro FetchContent_MakeAvailable, used to fetch L0 loader, includes a subproject using the add_subdirectory command. As a result the L0 loader added as a subproject. And it is added to the installation rules, but it should not because we do not want to install L0 as a part of UMF installation.
  2. When we call FetchContent_MakeAvailable macro the EXCLUDE_FROM_ALL argument is provided which should fix the issue. But it was added in version 3.28. That is why the issue is reproduced only with cmake < 3.28. I caught the issue with cmake 3.22.1 on one machine, but it works with cmake 3.30.2 on another.

There is a discussion on StackOverflow about the same issue. It describes, as a possible solution for cmake < 3.28, exactly what we had in the past in our cmake config:

FetchContent_GetProperties(level-zero-loader)
if(NOT level-zero-loader_POPULATED)
    FetchContent_Populate(level-zero-loader)
endif()

But we switched to the FetchContent_MakeAvailable macro because the FetchContent_Populate is deprecated (see #734 and #814).

Additional information about Priority and Help Requested:

Are you willing to submit a pull request with a proposed change? No. I do not know what is the right solution.

Requested priority: (Showstopper, High, Medium, Low)

@vinser52 vinser52 added the bug Something isn't working label Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant