Giter Site home page Giter Site logo

Comments (7)

abdes avatar abdes commented on May 26, 2024 2

The error does not come from ccache. It comes from the fact that you are using a wrapper shell script to invoke ccache on a windows platform. Here is what I do to work around this:


find_program(CCACHE_TOOL_PATH ccache)

if(NOT WIN32 AND USE_CCACHE AND CCACHE_TOOL_PATH)
  message(STATUS "Using ccache (${CCACHE_TOOL_PATH}) (via wrapper).")
  # see https://github.com/TheLartians/Ccache.cmake enables CCACHE support through
  # the USE_CCACHE flag possible values are: YES, NO or equivalent
  cpmaddpackage("gh:TheLartians/[email protected]")
elseif(WIN32 AND USE_CCACHE AND CCACHE_TOOL_PATH)
  set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_TOOL_PATH} CACHE STRING "" FORCE)
  set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_TOOL_PATH} CACHE STRING "" FORCE)
  message(STATUS "Using ccache (${CCACHE_TOOL_PATH}).")
endif()

from ccache.cmake.

cristianadam avatar cristianadam commented on May 26, 2024 1

I have my own fork of ccache which adds support for Visual C++. This works only in release mode. I haven't managed to finish pushing it upstream ccache/ccache#506

At https://github.com/cristianadam/HelloWorld I have a project using the binary artifacts from my ccache fork to build for Linux, Windows MinGW / MSVC, macOS.

Qt Creator is a bigger project that uses this https://github.com/qt-creator/qt-creator/actions.

from ccache.cmake.

TheLartians avatar TheLartians commented on May 26, 2024

Hey, thanks for the issue! Unfortunately I don't have access to a windows system atm, so I can't reproduce the bug locally. Does it still occur in version 1.2.2, which uses absolute paths to the scripts?

Also, it might be a good idea to adapt Ccache.cmake for better Windows support, e.g. by adding PowerShell scripts or changing the CMake logic to set the RULE_LAUNCH_COMPILE argument (in case it's supported on windows, which needs to be tested).

from ccache.cmake.

erri120 avatar erri120 commented on May 26, 2024

1.2.2 also fails.

Ninja fails with this error:

[0/2] Re-checking globbed directories...
ninja: fatal: CreateProcess: %1 is not a valid Win32 application.

from ccache.cmake.

TheLartians avatar TheLartians commented on May 26, 2024

Ok, thanks for testing! Yeah indeed seems like we need a separate conditional branch if we want to support windows targets. Unfortunately, I couldn't find too much infos on using CMake to activate Ccache on Windows, so if you have any leads or even a PR fixing it, it would be great!

from ccache.cmake.

craigscott-crascit avatar craigscott-crascit commented on May 26, 2024

@cristianadam may be able to offer some insights. I believe he was working on Windows support for ccache at one point.

from ccache.cmake.

Banderi avatar Banderi commented on May 26, 2024

The error does not come from ccache. It comes from the fact that you are using a wrapper shell script to invoke ccache on a windows platform. Here is what I do to work around this:


find_program(CCACHE_TOOL_PATH ccache)

if(NOT WIN32 AND USE_CCACHE AND CCACHE_TOOL_PATH)
  message(STATUS "Using ccache (${CCACHE_TOOL_PATH}) (via wrapper).")
  # see https://github.com/TheLartians/Ccache.cmake enables CCACHE support through
  # the USE_CCACHE flag possible values are: YES, NO or equivalent
  cpmaddpackage("gh:TheLartians/[email protected]")
elseif(WIN32 AND USE_CCACHE AND CCACHE_TOOL_PATH)
  set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_TOOL_PATH} CACHE STRING "" FORCE)
  set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_TOOL_PATH} CACHE STRING "" FORCE)
  message(STATUS "Using ccache (${CCACHE_TOOL_PATH}).")
endif()

This worked on my end. Thank you!
Hopefully a proper fix can be implemented soon!

from ccache.cmake.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.