Open ThoreWietzke opened 1 month ago
Scikit-build-core should try to build with the compiler used to compile Python. So if you used an MSVC-compiled Python, you'll likely see the above. If you used a Python built with MinGW, it should work out of the box.
Though I think the actual problem here is CMake can't find MSVC, so it's falling back on NMake as a default generator. Can you set CMAKE_GENERATOR to Ninja (for example) and try again?
If you used a Python built with MinGW, it should work out of the box.
We test this, actually:
Though MSVC might still be detectable, so maybe we should make sure it's not used.
Scikit-build-core should try to build with the compiler used to compile Python. So if you used an MSVC-compiled Python, you'll likely see the above. If you used a Python built with MinGW, it should work out of the box.
Though I think the actual problem here is CMake can't find MSVC, so it's falling back on NMake as a default generator. Can you set CMAKE_GENERATOR to Ninja (for example) and try again?
That's good to know. It can't find MSVC, because it was not installed on that machine. I've encountered this problem when using a pre-compiled Python for Windows (Which are compiled with MSVC, I presume) with a machine with only GCC available.
Can scikit-build-core detect this? For me it's no problem to install MSVC, but it took 2 hours with a colleague to find the culprit (Missing MSVC on his machine).
Actually, sk-build is able to identify such a situation:
2024-09-14 09:09:38,634 - scikit_build_core - WARNING - Can't find a Python library, got libdir=None, ldlibrary=None, multiarch=None, masd=None
Maybe make it more verbose and hint on this error?
Actually, sk-build is able to identify such a situation:
2024-09-14 09:09:38,634 - scikit_build_core - WARNING - Can't find a Python library, got libdir=None, ldlibrary=None, multiarch=None, masd=None
Maybe make it more verbose and hint on this error?
Unfortunately that may not be desired. There are projects made in skbuild-core without python bindings like cmake or ninja. Maybe there could be a find_python
like option that would control finding python-devel
files and error if it couldn't.
I've encountered this problem when using a pre-compiled Python for Windows (Which are compiled with MSVC, I presume) with a machine with only GCC available.
Can scikit-build-core detect this?
Interesting idea, I think there could be a design for that if skbuild-core has a find_package(scikit-build-core)
I'll open an issue for that.
The problem I see here is, that the build process hints at the CMakeLists.txt file as the source of error, whereas the different compilers for Python and the bindings are the problem.
Installing e.g. the pybind11 example https://github.com/pybind/scikit_build_example with only MinGW (GCC) installed on Windows fails with a cryptic error message:
Building with MSVC works fine. I know that GCC is not recommended for building extensions on Windows. Thus, a descriptive error message should hint the user at this problem.