cccl icon indicating copy to clipboard operation
cccl copied to clipboard

[BUG]: CMake fails when using nvc++ as a c++ compiler

Open zkhatami opened this issue 9 months ago • 4 comments

Is this a duplicate?

  • [x] I confirmed there appear to be no duplicate issues for this bug and that I agree to the Code of Conduct

Type of Bug

Something else

Component

Thrust

Describe the bug

After this commit: https://github.com/NVIDIA/cccl/commit/4f5c28783cd17926decebc274d9f68982b91b183

when using nvc++ as a c++ compiler, CMake fails with this error:

CMake Error at cmake/CCCLBuildCompilerTargets.cmake:34 (message):
  CCCL developer builds require that CMAKE_CUDA_HOST_COMPILER exactly matches
  CMAKE_CXX_COMPILER when using nvcc:

How to Reproduce

cmake /path/to/cccl

Expected behavior

To see thrust tests/examples being pulled and passed successfully.

Reproduction link

No response

Operating System

No response

nvidia-smi output

No response

NVCC version

No response

zkhatami avatar Mar 21 '25 18:03 zkhatami

This is expected when CMake has different settings for the CUDA host compiler and C++ compiler. Our build system for tests/examples requires that the CXX and CUDA_HOST compilers match. Try:

cmake -DCMAKE_CXX_COMPILER=nvc++ -DCMAKE_CUDA_HOST_COMPILER=nvc++ /path/to/cccl

These can also be set using the CXX and CUDAHOSTCXX environment variables.

alliepiper avatar Mar 21 '25 23:03 alliepiper

Do we always need to set CUDA-related environment variables, even if the tests are not meant to be compiled for the device? It seems that CUDA_COMPILER and CUDA_HOST_COMPILER are required even for host-only tests. Can we separate them?

zkhatami avatar Mar 24 '25 20:03 zkhatami

Can you share the full cmake command you're using to configure your build?

alliepiper avatar Apr 01 '25 14:04 alliepiper

Need more info to understand usescase to fix this.

alliepiper avatar Apr 23 '25 15:04 alliepiper