0

I am running this command on windows with pybind11:

>cmake . -G "MinGW Makefiles"

This command gives me an error:

  Python config failure: Python is 64-bit, chosen compiler is 32-bit
Call Stack (most recent call first):
  lib/pybind11/tools/pybind11Tools.cmake:16 (find_package)
  lib/pybind11/CMakeLists.txt:33 (include)

And yes, I have seen this post, so please don't mark this as duplicate. Its different because I'm trying to use MinGW, whereas the answers in this post all uses Visual Studio. My goal is to generate .pyd files with pybind11, but compiling the C++ source file gives me some weird .vcxproj files that I can't use.

Please teach me how to correctly specify 64-bit or 32-bit of MinGW so that I can generate a .pyd file.

Eric Kim
  • 2,493
  • 6
  • 33
  • 69
  • @BasileStarynkevitch No I have not. I haven't used C++ before, I've only used Python but I'm kind of forced to compile this file with pybind now cuz my coworker suddenly quit. I don't even know how to start with that documentation link you gave. – Eric Kim Nov 01 '21 at 08:30
  • The buy some books (on paper) about Python, and about C++. [this book on C++](https://www.stroustrup.com/programming.html) is excellent. Study also (for inspiration) the source code of C++ open source p^ojects (like [ninja](https://ninja-build.org/), [GCC](http://gcc.gnu.org/), or [RefPerSys](http://refpersys.org/)....). Feel free to contact me by email `basile@starynkevitch.net` (I am located near Paris in France) – Basile Starynkevitch Nov 01 '21 at 08:31
  • As far as I understand from [that answer](https://stackoverflow.com/a/54893215/3440745), for use 64-bit compiler with "MinGW Makefiles" generator you just need to set `PATH` variable to contain directory with that compiler. – Tsyvarev Nov 01 '21 at 08:33
  • @Tsyvarev That still gives me the same result. Does it have to do with the version of MinGW? When its installed, it gives me multiple combinations of versions I can install. I've tried many different versions, but none of them worked. I've set PATH variable everytime I installed different versions. – Eric Kim Nov 01 '21 at 08:48
  • 1
    MinGW has two versions MinGW32 and MinGW64. Seems like you are using MinGW32. How did you get your MinGW? Are you using MSYS2? – stardust Nov 01 '21 at 10:15
  • Did you consider installing some Linux distribution (like [Debian](https://debian.org/)...) on your laptop? It could make your life simpler (since Debian is very software developer friendly). And most Linux distributions are made of open source software, whose source code you can download and study and improve. See e.g. https://linuxfromscratch.org – Basile Starynkevitch Nov 01 '21 at 12:02

1 Answers1

0

As mixing 32-bit and 64-bit will cause trouble sooner or later unless you are extremely careful, I would recommend using seperate toolchains for Windows 32-bit and Windows 64-bit.

I recommend getting standalone builds of these toolchains from https://winlibs.com/

MinGW Makefiles are somewhat slow, so to speed things up you may also consider using Ninja instead (CMake flag -GNinja).

Brecht Sanders
  • 6,215
  • 1
  • 16
  • 40