Skip to content

Debug commands that have rsp files #2698

@Andrej730

Description

@Andrej730

ninja -v -n Target is super useful for debugging, since it typically gives you the exact command ninja would use for compiling or linking, so user can just copy it and run it themselves - change flags, change order of arguments, etc.

But it gets trickier when command is getting to long and ninja is using .rsp files.

cd . && "L:\Software\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E vs_link_dll --msvc-ver=1944 --intdir=src\FoundationClasses\TKernel\CMakeFiles\TKernel.dir --rc=L:\WINDOW~1\10\bin\100261~1.0\x64\rc.exe --mt=L:\WINDOW~1\10\bin\100261~1.0\x64\mt.exe --manifests  -- L:\Software\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1444~1.352\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\TKernel.rsp  /out:win64\vc14\bin\TKernel.dll /implib:win64\vc14\lib\TKernel.lib /pdb:win64\vc14\bin\TKernel.pdb /dll /version:8.0 /machine:x64 /INCREMENTAL:NO && cd .

Running example command above by itself won't be any good and will result in LINK : fatal error LNK1104: cannot open file 'CMakeFiles\TKernel.rsp' - .rsp file is generated implicitly by ninja (see #1760), not by command.

It's also not possible to run ninja -v Target to generate those files before running the command, as ninja removes .rsp file, after it's used. If ninja -v Target takes long enough, you can catch .rsp file in the process and then resave it, but that's only for the cases when linking is not quick.

Are there other workarounds for debugging - to either make ninja produce a command without rsp file, or force it to produce .rsp and keep it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions