Mingw-packages: CMake with Ninja backend cannot compile using ccache (mingw-w64-ccache)

Created on 22 Jul 2019  路  1Comment  路  Source: msys2/MINGW-packages

How to reproduce:

export PATH=/mingw64/lib/ccache/bin/:$PATH
cmake .. -G Ninja
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Check for working C compiler: C:/msys64/mingw64/lib/ccache/bin/cc
-- Check for working C compiler: C:/msys64/mingw64/lib/ccache/bin/cc -- broken
CMake Error at C:/msys64/mingw64/share/cmake-3.14/Modules/CMakeTestCCompiler.cmake:60 (message):
  The C compiler

    "C:/msys64/mingw64/lib/ccache/bin/cc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: C:/msys64/home/az/projects/synfig-cmake/build222/CMakeFiles/CMakeTmp

    Run Build Command(s):C:/msys64/mingw64/bin/ninja.exe cmTC_e005c
    ninja: fatal: CreateProcess: %1 is not a valid Win32 application.

When ccache is activated, ninja tries to execute /mingw64/lib/ccache/bin/cc using cmd shell.
But because all links is bash stubs (https://github.com/msys2/MINGW-packages/blob/a12ff5d6abb7e4f1d1c2710014b4a70dfde7b95c/mingw-w64-ccache/PKGBUILD#L45) this doesn't work.

Most helpful comment

fwiw I just use

cmake -GNinja .. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache

which works for me

>All comments

fwiw I just use

cmake -GNinja .. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache

which works for me

Was this page helpful?
0 / 5 - 0 ratings