Skip to content

sccache inconsistency with cl (Fatal error LNK1104: cannot open file) #2485

@Andrej730

Description

@Andrej730

Stumbled upon LINK : fatal error LNK1104: cannot open file 'main.dir\Debug\main.obj' trying to build visual studio project with cmake and sscache.

Managed to narrow it down to a simple snippet to reproduce.
Basically when compiling main.cpp with output path main.dir\Debug\\, cl outputs file as main.dir\Debug\main.obj.
But sccache cl outputs file as main.dir\Debug.obj.

rmdir /s /q main.dir
:: tree /F
::   CMakeLists.txt
::   main.cpp
mkdir main.dir\Debug

cl /c /Fo"main.dir\Debug\\" main.cpp
tree /F
:: Folder PATH listing for volume L Volume
:: Volume serial number is AACD-E6D9
:: L:.
:: │   CMakeLists.txt
:: │   main.cpp
::
:: └───main.dir
::     └───Debug
::             main.obj

rmdir /s /q main.dir
mkdir main.dir\Debug

sccache cl /c /Fo"main.dir\Debug\\" main.cpp
tree /F
:: Folder PATH listing for volume L Volume
:: Volume serial number is AACD-E6D9
:: L:.
:: │   CMakeLists.txt
:: │   main.cpp
::
:: └───main.dir
::     │   Debug.obj
::
::     └───Debug
// main.cpp
#include <iostream>

int main() {
    std::cout << "Hello, World!" << std::endl;
    return 0;
}

Related to #107

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