Skip to content

CUDA + MSVC + Ninja Multi-Config error: Could not parse shell line #2470

Open

Description

@nikolaseu

Using the latest sccache v0.12.0 installed with scoop I get an error using Ninja Multi-Config generator in CMake v4.1.2. It also happened with sccache 0.11.

Here's a small project demonstrating the issue (based on vectorAdd official CUDA sample):

example project.zip

Configure log when msvc-x64-multi-config preset is used:

proc] Executing command: C:\Users\nikol\scoop\shims\cmake.EXE -DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe "-DCMAKE_CONFIGURATION_TYPES=Debug;RelWithDebInfo;Release" -DCMAKE_CROSS_CONFIGS=all -DCMAKE_DEFAULT_BUILD_TYPE=Release -DCMAKE_DEFAULT_CONFIGS=Release -S C:/Users/nikol/Projects/tmp/sccache_cuda_multi_config -B C:/Users/nikol/Projects/tmp/sccache_cuda_multi_config/build/msvc-x64-multi-config -G "Ninja Multi-Config"
[cmake] -- Found sccache: C:/Users/nikol/scoop/shims/sccache.exe, using SCCACHE_DIRECT=true, SCCACHE_DIR=
[cmake] -- Using:
[cmake]     CMAKE_C_COMPILER_LAUNCHER=C:/Users/nikol/scoop/shims/sccache.exe
[cmake]     CMAKE_CXX_COMPILER_LAUNCHER=C:/Users/nikol/scoop/shims/sccache.exe
[cmake]     CMAKE_CUDA_COMPILER_LAUNCHER=C:/Users/nikol/scoop/shims/sccache.exe
[cmake] 
[cmake] -- The C compiler identification is MSVC 19.44.35217.0
[cmake] -- The CXX compiler identification is MSVC 19.44.35217.0
[cmake] -- The CUDA compiler identification is NVIDIA 13.0.88 with host compiler MSVC 19.44.35217.0
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - done
[cmake] -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64/cl.exe - skipped
[cmake] -- Detecting C compile features
[cmake] -- Detecting C compile features - done
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - done
[cmake] -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64/cl.exe - skipped
[cmake] -- Detecting CXX compile features
[cmake] -- Detecting CXX compile features - done
[cmake] -- Detecting CUDA compiler ABI info
[cmake] -- Detecting CUDA compiler ABI info - done
[cmake] -- Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v13.0/bin/nvcc.exe - skipped
[cmake] -- Detecting CUDA compile features
[cmake] -- Detecting CUDA compile features - done
[cmake] -- Found CUDAToolkit: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v13.0/include;C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v13.0/include/cccl (found version "13.0.88")
[cmake] -- Configuring done (10.4s)
[cmake] -- Generating done (0.1s)
[cmake] -- Build files have been written to: C:/Users/nikol/Projects/tmp/sccache_cuda_multi_config/build/msvc-x64-multi-config

The error when building:

[build] Starting build
[proc] Executing command: C:\Users\nikol\scoop\shims\cmake.EXE --build C:/Users/nikol/Projects/tmp/sccache_cuda_multi_config/build/msvc-x64-multi-config --
[build] [1/3] Building CUDA object CMakeFiles\vectorAdd.dir\Release\vectorAdd.cu.obj
[build] FAILED: CMakeFiles/vectorAdd.dir/Release/vectorAdd.cu.obj 
[build] C:\Users\nikol\scoop\shims\sccache.exe C:\PROGRA~1\NVIDIA~2\CUDA\v13.0\bin\nvcc.exe -forward-unknown-to-host-compiler -DCMAKE_INTDIR=\"Release\" -IC:\Users\nikol\Projects\tmp\sccache_cuda_multi_config\. -D_WINDOWS -Xcompiler=" /EHsc" -Wno-deprecated-gpu-targets -lineinfo -Xcompiler="-O2 -Ob2" -DNDEBUG -std=c++17 "--generate-code=arch=compute_75,code=[compute_75,sm_75]" "--generate-code=arch=compute_80,code=[compute_80,sm_80]" "--generate-code=arch=compute_86,code=[compute_86,sm_86]" "--generate-code=arch=compute_87,code=[compute_87,sm_87]" "--generate-code=arch=compute_89,code=[compute_89,sm_89]" "--generate-code=arch=compute_90,code=[compute_90,sm_90]" "--generate-code=arch=compute_100,code=[compute_100,sm_100]" "--generate-code=arch=compute_110,code=[compute_110,sm_110]" "--generate-code=arch=compute_120,code=[compute_120,sm_120]" -Xcompiler=-MD -Xcompiler=-Z7 --extended-lambda -MD -MT CMakeFiles\vectorAdd.dir\Release\vectorAdd.cu.obj -MF CMakeFiles\vectorAdd.dir\Release\vectorAdd.cu.obj.d -x cu -rdc=true -c C:\Users\nikol\Projects\tmp\sccache_cuda_multi_config\vectorAdd.cu -o CMakeFiles\vectorAdd.dir\Release\vectorAdd.cu.obj -Xcompiler=-FdCMakeFiles\vectorAdd.dir\Release\,-FS
[build] sccache: encountered fatal error
[build] sccache: error: Could not parse shell line
[build] sccache: caused by: Could not parse shell line
[build] ninja: build stopped: subcommand failed.
[proc] The command: C:\Users\nikol\scoop\shims\cmake.EXE --build C:/Users/nikol/Projects/tmp/sccache_cuda_multi_config/build/msvc-x64-multi-config -- exited with code: 1
[driver] Build completed: 00:00:04.473
[build] Build finished with exit code 1

The msvc-x64 preset works fine (it uses Ninja generator).

Everything works fine in Linux (CMake 3.31, gcc & clang, CUDA 13)

Activity

  1. trxcllnt commented on Oct 27, 2025

    @trxcllnt
    Contributor

    Do you get this error if you use the windows binaries from the latest release in https://github.com/rapidsai/sccache/releases?

  2. mkucmpro commented on Dec 17, 2025

    @mkucmpro

    I faced a similar problem with CUDA compilation with sccache. I tried to provide a minimal reproduction snippet (reproduced with 0.12.0):

    ############ create a simple file
    D:\temp>type main.cpp
    int main(){}
    
    ############ works
    D:\temp>nvcc.exe -DXD=\"xd\" -c main.cpp                      
    main.cpp
    
    ############ also works
    D:\temp>nvcc.exe -DXD="xd" -c main.cpp                        
    main.cpp
    
    ############ works
    D:\temp>sccache nvcc.exe -DXD="xd" -c main.cpp                
    main.cpp
    
    ############ doesn't work :(
    D:\temp>sccache nvcc.exe -DXD=\"xd\" -c main.cpp              
    sccache: encountered fatal error
    sccache: error: Could not parse shell line
    sccache: caused by: Could not parse shell line
    
  3. AJIOB commented on Dec 30, 2025

    @AJIOB
    Contributor

    Hi @mkucmpro,

    Thanks for minimal example. I have no nvcc, but with classic cl.exe all variants from your example works fine.

    Do you use sccache from the provided distro or try to build it from sources?

    P.S. Do you use the cmd or powershell or other terminal to launch your example. I'm using developer command prompt for VS 2022

  4. nikolaseu commented on Jul 3, 2026

    @nikolaseu
    Author

    I think I found the issue. The Ninja Multi-Config generator adds -DCMAKE_INTDIR="<config>" into every compile, even for .cu files. For CUDA, nvcc --dryrun re-emits this as -D "CMAKE_INTDIR=\"RelWithDebInfo\"" and sccache fails to parse that. So yes, \" \" is the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions