Skip to content

[BUG] find_library_file doesn't find Cygwin import libraries or DLLs #3302

@DWesl

Description

@DWesl

setuptools version

setuptools==62.1.0, 61.3.1, 60.10.0

Python version

Python 3.8 (and 3.7, I think)

OS

32-bit and 64-bit Cygwin 3.4.4 on Windows 10

Additional environment information

Cygwin library naming scheme:

  • Shared library/DLL name: cyg${name}.dll
  • Static library: lib${name}.a
  • Import library: lib${name}.dll.a

GCC looks for the import library or static library at link time. The import library redirects calls in the resulting executable or library to the corresponding functions in the DLL. The result will require the DLL at runtime, and the DLL must have execute permissions.

I think this is similar to how .lib and .dll library files function on native Windows targets.

Description

Following up on python-pillow/Pillow#6216:

Attempting to run python setup.py build_ext in Pillow's main directory fails because Pillow can't find jpeg. Downgrading setuptools to version 59.8.0 and running the same command again runs to completion.

Expected behavior

Running under python 3.8 with setuptools 59.8.0:

>>> from distutils.cygwinccompiler import CygwinCCompiler
>>> comp = CygwinCCompiler()
dllwrap: WARNING: dllwrap is deprecated, use gcc -shared or ld -shared instead

>>> comp.find_library_file(["/usr/lib"], "uuid")
'/usr/lib/libuuid.dll.a'

How to Reproduce

Running under python 3.8 with setuptools 62.1.0):

>>> from setuptools._distutils.cygwinccompiler import CygwinCCompiler
>>> comp = CygwinCCompiler()
>>> comp.find_library_file(["/usr/lib"], "uuid")
>>> import os.path
>>> os.path.exists("/usr/lib/libuuid.dll.a")
True

Output

$ python3.8 -m pip install -U pip 'setuptools<60' wheel
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in ./.local/lib/python3.8/site-packages (22.0.4)
Collecting setuptools<60
  Using cached setuptools-59.8.0-py3-none-any.whl (952 kB)
Requirement already satisfied: wheel in ./.local/lib/python3.8/site-packages (0.37.1)
Installing collected packages: setuptools
  Attempting uninstall: setuptools
    Found existing installation: setuptools 62.1.0
    Uninstalling setuptools-62.1.0:
      Successfully uninstalled setuptools-62.1.0
Successfully installed setuptools-59.8.0

$ python3.8
Python 3.8.12 (default, Nov 24 2021, 12:34:46)
[GCC 11.2.0] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from distutils.cygwinccompiler import CygwinCCompiler
>>> comp = CygwinCCompiler()
dllwrap: WARNING: dllwrap is deprecated, use gcc -shared or ld -shared instead

>>> comp.find_library_file(["/usr/lib"], "uuid")
'/usr/lib/libuuid.dll.a'
>>>

$ python3.8 -m pip install -U pip 'setuptools' wheel                            
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in ./.local/lib/python3.8/site-packages (22.0.4)
Requirement already satisfied: setuptools in ./.local/lib/python3.8/site-packages (59.8.0)
Collecting setuptools
  Using cached setuptools-62.1.0-py3-none-any.whl (1.1 MB)
Requirement already satisfied: wheel in ./.local/lib/python3.8/site-packages (0.37.1)
Installing collected packages: setuptools
  Attempting uninstall: setuptools
    Found existing installation: setuptools 59.8.0
    Uninstalling setuptools-59.8.0:
      Successfully uninstalled setuptools-59.8.0
Successfully installed setuptools-62.1.0

$ python3.8
Python 3.8.12 (default, Nov 24 2021, 12:34:46)
[GCC 11.2.0] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from distutils.cygwinccompiler import CygwinCCompiler
>>> comp = CygwinCCompiler()
>>> comp.find_library_file(["/usr/lib"], "uuid")
>>>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs TriageIssues that need to be evaluated for severity and status.bug

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions