Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: unable to find launch-cxx #5

Open
erri120 opened this issue Feb 7, 2021 · 7 comments
Open

Windows: unable to find launch-cxx #5

erri120 opened this issue Feb 7, 2021 · 7 comments
Labels
help wanted Extra attention is needed

Comments

@erri120
Copy link

erri120 commented Feb 7, 2021

MSVC:

'E:\Projects\rpgmpacker\cmake-build-debug-x64\_deps\ccache.cmake-build\launch-cxx' is not recognized as an internal or external command,
operable program or batch file.
NMAKE : fatal error U1077: 'E:\Projects\rpgmpacker\cmake-build-debug-x64\_deps\ccache.cmake-build\launch-cxx' : return code '0x1'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.

MinGW:

process_begin: CreateProcess(NULL, sh E:\Projects\rpgmpacker\cmake-build-debug-mingw\_deps\ccache.cmake-build\launch-cxx C:\PROGRA~1\MINGW-~1\X86_64~1.0-P\mingw64\bin\G__~1.EXE -DSIMDJSON_THREADS_ENABLED=1 -DSIMDJSON_USING_LIBRARY=1 -DSPDLOG_COMPILED_LIB @CMakeFiles/RPGMPacker.dir/includes_CXX.rsp -g -std=gnu++17 -o CMakeFiles\RPGMPacker.dir\src\main.cpp.obj -c E:\Projects\rpgmpacker\src\main.cpp, ...) failed.
make (e=2): The system cannot find the file specified.
mingw32-make.exe[3]: *** [CMakeFiles\RPGMPacker.dir\build.make:83: CMakeFiles/RPGMPacker.dir/src/main.cpp.obj] Error 2
mingw32-make.exe[3]: *** Waiting for unfinished jobs....
process_begin: CreateProcess(NULL, sh E:\Projects\rpgmpacker\cmake-build-debug-mingw\_deps\ccache.cmake-build\launch-cxx C:\PROGRA~1\MINGW-~1\X86_64~1.0-P\mingw64\bin\G__~1.EXE -DSIMDJSON_THREADS_ENABLED=1 -DSIMDJSON_USING_LIBRARY=1 -DSPDLOG_COMPILED_LIB @CMakeFiles/RPGMPacker.dir/includes_CXX.rsp -g -std=gnu++17 -o CMakeFiles\RPGMPacker.dir\src\md5.cpp.obj -c E:\Projects\rpgmpacker\src\md5.cpp, ...) failed.
make (e=2): The system cannot find the file specified.
mingw32-make.exe[3]: *** [CMakeFiles\RPGMPacker.dir\build.make:97: CMakeFiles/RPGMPacker.dir/src/md5.cpp.obj] Error 2
mingw32-make.exe[2]: *** [CMakeFiles\Makefile2:348: CMakeFiles/RPGMPacker.dir/all] Error 2
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:355: CMakeFiles/RPGMPacker.dir/rule] Error 2
mingw32-make.exe: *** [Makefile:206: RPGMPacker] Error 2

CMakeLists.txt:

if (USE_CCACHE)
    CPMAddPackage (
        NAME Ccache.cmake
        GITHUB_REPOSITORY TheLartians/Ccache.cmake
        VERSION 1.2
    )
endif()
@TheLartians
Copy link
Owner

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).

@TheLartians TheLartians added the help wanted Extra attention is needed label Feb 7, 2021
@erri120
Copy link
Author

erri120 commented Feb 8, 2021

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.

@TheLartians
Copy link
Owner

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!

@craigscott-crascit
Copy link

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

@cristianadam
Copy link

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.

@abdes
Copy link

abdes commented Mar 31, 2022

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()

@Banderi
Copy link

Banderi commented Jul 14, 2022

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants