NVIDIA / NVIDIA/stdexec

can't use CPM to link stdexec

Open
#948 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
2.4k
Forks
270
Avg merge
3d 6h
Merged PRs (30d)
39

Description

Hello stdexec developers,

I ran into issue with CPM linking to stdexec. The followings are cmake output and CMakeLists.txt.

Any suggestions?

wwei@login39:~/src/test-snd/build> CXX=$(which nvc++) cmake ..
-- The C compiler identification is NVHPC 23.1.0
-- The CXX compiler identification is NVHPC 23.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/nvidia/hpc_sdk/Linux_x86_64/23.1/compilers/bin/nvc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/nvidia/hpc_sdk/Linux_x86_64/23.1/compilers/bin/nvc++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Downloading CPM.cmake to /global/homes/w/wwei/src/test-snd/build/cmake/CPM_0.34.0.cmake
-- CPM: adding package stdexec@ (main)
-- System           : Linux-5.14.21-150400.24.46_12.0.72-cray_shasta_c
-- System name      : Linux
-- System ver       : 5.14.21-150400.24.46_12.0.72-cray_shasta_c
-- 
-- Library ver      : 0.8.0
-- Build date       : 2023-05-24
-- Build year       : 2023
-- 
CMake Warning (dev) at build/cmake/CPM_0.35.6.cmake:37 (message):
  CPM: stdexec: A dependency is using a more recent CPM version (0.35.6) than
  the current project (0.34.0).  It is recommended to upgrade CPM to the most
  recent version.  See https://github.com/cpm-cmake/CPM.cmake for more
  information.
Call Stack (most recent call first):
  build/_deps/rapids-cmake-src/rapids-cmake/cpm/detail/download.cmake:85 (include)
  build/_deps/rapids-cmake-src/rapids-cmake/cpm/init.cmake:65 (rapids_cpm_download)
  build/_deps/stdexec-src/CMakeLists.txt:82 (rapids_cpm_init)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- CPM: stdexec: adding package Catch2@2.13.6 (2.13.6)
CMake Warning (dev) at /global/common/software/nersc/pm-2022q4/spack/linux-sles15-zen/cmake-3.24.3-k5msymx/share/cmake-3.24/Modules/FetchContent.cmake:1267 (message):
  The DOWNLOAD_EXTRACT_TIMESTAMP option was not given and policy CMP0135 is
  not set.  The policy's OLD behavior will be used.  When using a URL
  download, the timestamps of extracted files should preferably be that of
  the time of extraction, otherwise code that depends on the extracted
  contents might not be rebuilt if the URL changes.  The OLD behavior
  preserves the timestamps from the archive instead, but this is usually not
  what you want.  Update your project to the NEW behavior or specify the
  DOWNLOAD_EXTRACT_TIMESTAMP option with a value of true to avoid this
  robustness issue.
Call Stack (most recent call first):
  build/cmake/CPM_0.34.0.cmake:780 (FetchContent_Declare)
  build/cmake/CPM_0.34.0.cmake:667 (cpm_declare_fetch)
  build/cmake/CPM_0.34.0.cmake:262 (CPMAddPackage)
  build/_deps/rapids-cmake-src/rapids-cmake/cpm/find.cmake:167 (CPMFindPackage)
  build/_deps/stdexec-src/CMakeLists.txt:88 (rapids_cpm_find)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Configuring done
CMake Error at CMakeLists.txt:33 (target_link_libraries):
  Target "main" links to:

    stdexec::stdexec

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.



-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

project(stdexecExample)

set(CPM_DOWNLOAD_VERSION 0.34.0)

if(CPM_SOURCE_CACHE)
  set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
elseif(DEFINED ENV{CPM_SOURCE_CACHE})
  set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
else()
  set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
endif()

if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION}))
  message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}")
  file(DOWNLOAD
       https://github.com/TheLartians/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
       ${CPM_DOWNLOAD_LOCATION}
  )
endif()

include(${CPM_DOWNLOAD_LOCATION})

CPMAddPackage(
  NAME stdexec
  GITHUB_REPOSITORY NVIDIA/stdexec
  GIT_TAG main # This will always pull the latest code from the `main` branch. You may also use a specific release version or tag
)

add_executable(main main.cpp)

target_link_libraries(main stdexec::stdexec)

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

Start with the CPMAddPackage and target_link_libraries calls in the supplied CMakeLists.txt, then compare them with the targets produced by the fetched stdexec project. Reproduce the configuration using the shown NVHPC command and inspect the CMake output for the exported target name. Done means the stdexec target resolves and CMake generation completes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.