1

I'm maintaining this GitHub repo - a simple C project with CMake for build configuration. It builds on Linux and MacOS fine.

Now I want to start having build tests on Windows using AppVeyor for one of my branches (and on Linux using Travis, but that just works so no questions about it). I've set up an appveyor account, edited settings and created an appveyor.yml file on the branch I want to test (drop_platform_spec), based on a similar file I saw on another project.

I don't have a Windows machine where I can test the build myself, making things more difficult (and perhaps foolhardy I guess) to get right.

Anyway, the build does happen, but fails for two reasons:

  1. sh.exe is in the build path
  2. CMake can't determine which C compiler to use

The build console output is attached below.

My questions: How do I fix this? Particularly, should I manually set the C compiler to some path, and if so, which path?


build console output:

git clone -q --depth=1 --branch=drop_platform_spec https://github.com/eyalroz/tpch-dbgen.git C:\projects\tpch-dbgen
git checkout -qf 4607da63ecaead909c4ba380c5097495655c592e
Running Install scripts
set "PATH=%mingw_bin%;%PATH%"
cmake -G "MinGW Makefiles" . && mingw32-make
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.10/Modules/CMakeMinGWFindMake.cmake:12 (message):
  sh.exe was found in your PATH, here:
  C:/Program Files/Git/usr/bin/sh.exe
  For MinGW make to work correctly sh.exe must NOT be in your path.
  Run cmake from a shell that does not have sh.exe in your PATH.
  If you want to use a UNIX shell, then use MSYS Makefiles.
Call Stack (most recent call first):
  CMakeLists.txt:7 (project)
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
Command exited with code 1

Note: This question describes an incompatible sh and make situation. I don't think that's what I have, so it's not a dupe but if you think that's relevant to my situation, please explain in an answer here rather than marking a dupe.

einpoklum
  • 118,144
  • 57
  • 340
  • 684
  • You can try `cmake -G "MSYS Makefiles" . && make` (I normally use this, because it makes less problems in MinGW/MSYS environments). – Florian Jan 29 '18 at 12:12
  • @Florian: While that question also involves sh, it doesn't look like it's a dupe. I mean, reading it, it seems like a different problem. Would you mind explaining and/or removing the "possible dupe" message? – einpoklum Jan 29 '18 at 12:59
  • @Florian: About MSYS - would I need to add anything else to my `appveyor.yml`? And how would this effect the C-compiler-not-found-issue? – einpoklum Jan 29 '18 at 13:00
  • Can you give `cmake -DCMAKE_IGNORE_PATH="C:/Program Files/Git/usr/bin" ..` a try? It's normally the method to hide things the `PATH` environment from CMake. So I thought it might work here also (to hide all shells in the `PATH`). But it won't work, if your compiler - or any other executable needed - is in the same path. – Florian Jan 29 '18 at 13:25
  • @Florian: So, that works, but not like I would like it to. That is, it resolves both problems, but the compiler used is GCC 6.3.0, while I would like MVSC. But you can make that an answer, though. Also note I had not switched from MinGW Makefiles to MSYS makefiles. – einpoklum Jan 29 '18 at 13:34
  • The default for MinGW is `gcc`. So you could try to also give `-DCMAKE_C_COMPILER=cl.exe`. – Florian Jan 29 '18 at 13:45

2 Answers2

2

Turning my comment into an answer

To hide things in the PATH environment from CMake you can use CMAKE_IGNORE_PATH.

So I thought it might work here also (to hide all shells in the PATH). But it won't work, if your compiler - or any other executable needed - is in the same path:

cmake -DCMAKE_IGNORE_PATH="C:/Program Files/Git/usr/bin" ..

References

Florian
  • 39,996
  • 9
  • 133
  • 149
0

Please check https://github.com/eyalroz/tpch-dbgen/pull/22/files, it is pretty self-describing. Mostly related to Windows command line syntax, e.g. set path and echo %variable% command line syntax. This is not alternate answer to what Florian wrote, rather addition.

Side note: not having Windows machine should not block you from debugging interactively, see https://www.appveyor.com/docs/how-to/rdp-to-build-worker/

Ilya Finkelsheyn
  • 2,851
  • 11
  • 20