Skip to content

Cygwin / MinGW32 build_ext broken (?) #109

Description

@loehnertj

Hey guys, after updating Setuptools to 60.something, my extension build broke.

I am using Python 3.9.4 and MinGW32 (64-bit).
My extension is a single-file C module, which doesn't use any particular libraries beyond the stdlib.

Build failed, because the linker tried to link -lucrt, which could not be found.

I could trace this down to cygwincompiler.py:93, where on Nov 15 2021, support for MSVC version 1900...2000 was added / Commit eca30e8.

Previously my build was working, because I monkeypatched this function on my own. It broke by the upgrade, because my monkeypatch only became active if the "native" get_msvcr() failed.

Now I am an amateur when it comes to C compilers. But it seems to me, that get_msvcr specifies that both ucrt (ucrtbase.dll) and vcruntime140 (vcruntime140.dll) shall be linked. This fails because Python (specifically my v3.9.4) only bundles vcruntime140.

From what I've read, ucrtbase is supposed to replace vcruntime. So I would only expect one of them has to be present? If this is correct, the compilation settings should not link both libraries, but rather pick one of them.

Possible workarounds are

  • downgrading Setuptools to 59.1.1 or earlier, for the time being
  • Monkeypatching cygwincompiler.get_msvcr to return ["vcruntime140"] only.

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidThis doesn't seem right
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions