distutils icon indicating copy to clipboard operation
distutils copied to clipboard

Port code from CygwinCCompiler to UnixCCompiler

Open DWesl opened this issue 1 year ago • 8 comments

https://github.com/python-pillow/Pillow/issues/7158#issuecomment-1546746716 and https://github.com/pypa/setuptools/blob/e76db4408e40a5c0a218ef6f652454f69c5aca59/setuptools/_distutils/ccompiler.py#L1055-L1058 suggest that Cygwin uses UnixCCompiler rather than CygwinCCompiler by default, so UnixCCompiler would also need to know how to find shared libraries, import libraries, and static libraries on Cygwin.

Port of #139 to UnixCCompiler

DWesl avatar May 14 '23 11:05 DWesl

UnixCCompiler.find_library_file now returns library names that are likely to occur on Cygwin, rather than those likely on Linux, which causes the doctest to fail. Should I fix that with # doctest: ELLIPSIS or something like

>>> result = compiler.find_library_file(dirs, 'abc').replace('\\', '/')
>>> if sys.platform == "cygwin":
...     print(result == "/foo/bar/existing/cygabc.dll")
... else:
...     print(result == "/foo/bar/existing/libabc.dylib")
True

DWesl avatar May 14 '23 11:05 DWesl

Given Cygwin seems to use UnixCCompiler rather than CygwinCCompiler, should we also drop cygwinccompiler.py?

DWesl avatar May 19 '23 14:05 DWesl

Given Cygwin seems to use UnixCCompiler rather than CygwinCCompiler, should we also drop cygwinccompiler.py?

#185 similarly feels CygwinCCompiler isn't used, although thinks it should be.

radarhere avatar May 22 '23 09:05 radarhere

How should I be fixing the doctests to not fail with working code on Cygwin?

DWesl avatar Jun 23 '23 12:06 DWesl

The odd doctests suggest having CygwinCCompiler be a thin wrapper around UnixCCompiler might be the way to go: the only thing I can think to change would be the doctests in this PR, as everything else seems fine.

DWesl avatar Aug 03 '23 16:08 DWesl

Oh, heck. Tests on cygwin are currently disabled because ruff fails to install there.

jaraco avatar Apr 14 '24 01:04 jaraco

There's some recent progress on rust-lang/rust#79854; I'm somewhat curious how well the work done to cross-compile from Linux would carry over to cross-compiling from Windows.

DWesl avatar Apr 18 '24 02:04 DWesl

I'm somewhat curious how well the work done to cross-compile from Linux would carry over to cross-compiling from Windows.

there wasn't any existing cygwin cross compiler available on mingw or msys, but there is one on fedora linux

i also tried to get a cygwin cross compiler on archlinux: arch-cygwin (unofficial), it uses PKGBUILD (which is the same as what MSYS2 is using), ~~might be useful if someone want to build them and package on msys2~~ EDIT: i made one for cross-compiling on windows

ghost avatar Apr 28 '24 17:04 ghost

How should I be fixing the doctests to not fail with working code on Cygwin?

I don't see any problem with the doctests. Perhaps they've been resolved.

The only failing test now is the failing coverage test, which is spurious and only there because the coverage is only checked on one platform, so it's ignorable.

jaraco avatar Jun 28 '24 15:06 jaraco

How should I be fixing the doctests to not fail with working code on Cygwin?

I don't see any problem with the doctests. Perhaps they've been resolved.

It was a failure on the Cygwin doctests, which I think got disabled because there's no Rust compiler for Cygwin

DWesl avatar Jun 28 '24 18:06 DWesl

How should I be fixing the doctests to not fail with working code on Cygwin?

I don't see any problem with the doctests. Perhaps they've been resolved.

It was a failure on the Cygwin doctests, which I think got disabled because there's no Rust compiler for Cygwin

the problem is usually path conversion

https://github.com/thepowersgang/mrustc

you can kinda get rust here on cygwin, but there are many problems with path conversion and cygwin not being linux

Kreijstal avatar Aug 17 '24 08:08 Kreijstal