Skip to content

Conversation

@embray
Copy link
Contributor

@embray embray commented Oct 26, 2017

This is a fix/workaround to a rather old issue (https://bugs.python.org/issue2445) that still hasn't had a fix merged.

The original patch is by @ma8ma .

This simple patch allows UnixCCompiler.find_library_file, which searching library directories (e.g. /usr/lib), to recognize .dll.a as matches for the library. This is necessary on Cygwin where actual DLLs are not typically found under <prefix>/lib, but rather <prefix>/bin (because Windows searches PATH for DLLs). However one does .dll.a import libs under <prefix>/lib (these are simple static archives that contain stubs for symbols actually found in the DLL, which can be used in lieu of the DLL itself for linking). This satisfies that the library being searched for is typically found.

This is especially necessary now that the _ctypes module can only be built with --with-system-ffi; without this patch the system libffi cannot be found.

https://bugs.python.org/issue2445

@ma8ma
Copy link
Contributor

ma8ma commented Oct 26, 2017

FYI, https://bugs.python.org/issue4032 has a patch which changes to use UnixCCompiler lastingly on Cygwin. (probably, it cannot use as it is)

@embray
Copy link
Contributor Author

embray commented Oct 27, 2017

That is maybe a better patch. This patch is a bit janky because it reuses the dylib_lib_extension variable which previously only had meaning on OSX, but is a bit of a misnomer for searching for DLL import libs. The patch from issue4032 actually adds a separate implib_lib_extension variable that is only meaningful on *nix-on-Windows platforms; particularly Cygwin, though it could also be considered meaningful on mingw and the like i think...

@ma8ma
Copy link
Contributor

ma8ma commented Oct 27, 2017

Yeah, I think so too. I submit the bpo-4032 patch after modify it.

@embray
Copy link
Contributor Author

embray commented Dec 6, 2017

Closing in favor of #4153.

@embray embray closed this Dec 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants