Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve handling if runtime_library_dirs is set with cygwin/mingw #150

Merged
merged 1 commit into from
Jul 1, 2022

Conversation

lazka
Copy link
Contributor

@lazka lazka commented Jun 8, 2022

On Windows there is nothing like rpath, so when CygwinCCompiler()
tries to link it will assume unix and pass rpath flags to the linker,
which will fail.

In cygwin this is currently patched away:
https://cygwin.com/git-cygwin-packages/?p=git/cygwin-packages/python39.git;a=blob;f=3.1-enable-new-dtags.patch;h=716af3b14d3483e5a4
It is taking some macos fallback branch that is equal to library_dirs, which doesn't add much if
library_dirs is set, so in theory it should just return [] there.

This patch tries to bring it a bit closer to MSVCCompiler() which warns if
runtime_library_dirs is passed and raises if runtime_library_dir_option() is
called.

In the case of cygwin we only warn if runtime_library_dir_option() is called and return
nothing, so runtime_library_dirs is ignored. It's debatable if it should fail here,
but since cygwin is used to build unix software that might not be aware of this limitation
a warning seems more fitting.

In the mingw case we assume the user knows that they are targeting Windows and so we can be
more strict and error out like MSVCCompiler().

In both cases we warn if runtime_library_dirs is passed to the compiler, like with MSVC.

@lazka lazka mentioned this pull request Jun 8, 2022
On Windows there is nothing like rpath, so when CygwinCCompiler()
tries to link it will assume unix and pass rpath flags to the linker,
which will fail.

In cygwin this is currently patched away:
https://cygwin.com/git-cygwin-packages/?p=git/cygwin-packages/python39.git;a=blob;f=3.1-enable-new-dtags.patch;h=716af3b14d3483e5a4
It is taking some macos fallback branch that is equal to library_dirs, which doesn't add much if
library_dirs is set, so in theory it should just return [] there.

This patch tries to bring it a bit closer to MSVCCompiler() which warns if
runtime_library_dirs is passed and raises if runtime_library_dir_option() is
called.

In the case of cygwin we only warn if runtime_library_dir_option() is called and return
nothing, so runtime_library_dirs is ignored. It's debatable if it should fail here,
but since cygwin is used to build unix software that might not be aware of this limitation
a warning seems more fitting.

In the mingw case we assume the user knows that they are targeting Windows and so we can be
more strict and error out like MSVCCompiler().

In both cases we warn if runtime_library_dirs is passed to the compiler, like with MSVC.
@lazka lazka force-pushed the cygwin-no-rpath branch from b9a9390 to 7134521 Compare June 8, 2022 19:08
@lazka lazka changed the title Improve error handling if runtime_library_dirs is set with cygwin/mingw Improve handling if runtime_library_dirs is set with cygwin/mingw Jun 8, 2022
lazka added a commit to msys2/MINGW-packages that referenced this pull request Jun 12, 2022
Not supported on Windows

In our stdlib distutils it will end up using rpath, which clang errors out on,
and in upstream distutils there is a PR pending making it a proper error:
pypa/distutils#150
@jaraco jaraco merged commit 1b885fa into pypa:main Jul 1, 2022
@lazka
Copy link
Contributor Author

lazka commented Jul 1, 2022

Thanks!

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Jul 6, 2022
v63.1.0

Changes

Merge with pypa/distutils@152c13d including pypa/distutils#155 (improved compatibility for editable installs on homebrew Python 3.9), pypa/distutils#150 (better handling of runtime_library_dirs on cygwin), and pypa/distutils#151 (remove warnings for namespace packages).

v63.0.0

Breaking Changes

Drop setuptools' support for installing an entrypoint extra requirements at load time: - the functionality has been broken since v60.8.0. - the mechanism to do so is deprecated (fetch_build_eggs). - that use case (e.g. a custom command class entrypoint) is covered by making sure the necessary build requirements are declared.

Documentation changes

Updated the example pyproject.toml -- by :user:`jacalata`
This updates the documentation for the file_finders hook so that the logging recommendation aligns with the suggestion to not use distutils directly.
Fix reference for keywords to point to the Core Metadata Specification instead of PEP 314 (the live standard is kept always up-to-date and consolidates several PEPs together in a single document).
Reordered the User Guide's Table of Contents
@AlmogBaku
Copy link

Hi, noticed that this introduced a breaking change that was really hard to debug. see: pypa/setuptools#3450

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants