scikit-build-core icon indicating copy to clipboard operation
scikit-build-core copied to clipboard

cibuildwheel on Github Actions Windows runner uses GCC by default

Open planetmarshall opened this issue 2 years ago • 2 comments

Not sure which component to blame here, but this is not something that used to happen with scikit-build -

Build log using scikit-build

--------------------------------------------------------------------------------
  -- Trying 'Ninja (Visual Studio 17 2022 Win32 v143)' generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  Not searching for unused variables given on the command line.
  CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
    Compatibility with CMake < 3.5 will be removed from a future version of
    CMake.
  
    Update the VERSION argument <min> value or use a ...<max> suffix to tell
    CMake that the project does not need compatibility with older versions.
  
  
  -- The C compiler identification is MSVC 19.38.33133.0
...

Full log: https://github.com/planetmarshall/pillow-jpls/actions/runs/7324438660/job/19948011356

Build log using scikit-build-core

 loading initial cache file C:\Users\RUNNER~1\AppData\Local\Temp\tmpr7cco_vs\build\CMakeInit.txt
  Preset CMake variables:
  
    CMAKE_BUILD_TYPE="Release"
    CMAKE_COMPILE_WARNING_AS_ERROR="ON"
    CMAKE_PROJECT_TOP_LEVEL_INCLUDES="D:/a/pillow-jpls/pillow-jpls/cmake/conan_provider.cmake"
  
  -- The C compiler identification is GNU 12.2.0
  -- The CXX compiler identification is GNU 12.2.0

Full log: https://github.com/planetmarshall/pillow-jpls/actions/runs/7338592087/job/19981348413

I realise this may be more to do with how Github Runners are setup but as this is probably a common setup and is a change in behaviour from porting from scikit-build, it is probably worth noting.

planetmarshall avatar Dec 27 '23 13:12 planetmarshall

I believe it's due to

https://github.com/planetmarshall/pillow-jpls/blob/7c98ed7c282c75faed03f7bc9c53fab5089a94f5/.github/workflows/build_deploy.yml#L10-L12

GHA doesn't activate MSVC inside the bash shell automatically, so you have to do it manually if you really want that shell (there are actions to do it for you like https://github.com/ilammy/msvc-dev-cmd and https://github.com/TheMrMilchmann/setup-msvc-dev). Scikit-build classic queries the registry to find MSVC, while scikit-build-core assumes you want to build with whatever is active if MSVC is not (which is GCC for the bash shell). This is required if you are trying to build Fortran code, for example.

henryiii avatar Dec 27 '23 14:12 henryiii

Also, I'd highly recommend configuring cibuildwheel via pyproject.toml instead of bunch of CI-based environment variables, will be cleaner and easier to build locally too. :)

henryiii avatar Dec 27 '23 14:12 henryiii