Skip to content

CYGWIN: fails to load modules, DLLs not found #148758

Description

@carlo-bramini

Bug report

Bug description:

The process for building Python for CYGWIN is executed well until it reaches the very last steps.
Then, these messages will appear on the console:

[ERROR] _asyncio failed to import: No module named 'math'
[ERROR] Cannot mark builtin module '_asyncio' as failed!
[ERROR] _elementtree failed to import: No module named 'pyexpat'
[ERROR] _asyncio failed to import:
 No module named 'math'
[ERROR] Cannot mark builtin module '_asyncio' as failed!
[ERROR] _elementtree (/home/carlo/packages/python/cygwin/build/lib.cygwin-3.6.7-x86_64-3.15/_elementtree.cpython-315d.dll) is missing
Following modules built successfully but were removed because they could not be imported:
_asyncio              _elementtree

Checked 115 modules (36 built-in, 76 shared, 1 n/a on cygwin-3.6.7-x86_64, 0 disabled, 0 missing, 2 failed on import)

When running the newly created executable, you can also see these results:

$ ./python.exe
Python 3.15.0a8+ (heads/main-dirty:3ab94d6, Apr 19 2026, 15:54:58) [GCC 13.4.0] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
warning: can't use pyrepl: No module named 'unicodedata'
>>> import math
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
    import math
ModuleNotFoundError: Standard library module 'math' was not found
>>>

However, all modules are created correctly, by inspecting the content of the build directory.
In this screenshot, you can see it yourself:

Image

The error is inside the file dynload_shlib.c because it doesn't handle the correct suffixes for the DLL files to be loaded.
In the above screenshot, you can see that the name of the module is math.cpython-315d.dll and not math.dll.
This means that the current code won't be able to find them until the only option available inside _PyImport_DynLoadFiletab[] will be just .dll.
So, like for other platforms, adding the missing suffixes is required for loading things correctly.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Windows

Linked PRs

Activity

  1. added a commit that references this issue on Apr 19, 2026
  2. added a commit that references this issue on May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-unsupportedinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions