-
-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Python: Change Homebrew includes into NODIST flags #68528
Python: Change Homebrew includes into NODIST flags #68528
Conversation
The Tcl/Tk tests are skipped on 3.8 and 3.9 for Big Sur. See #67378 for more details. If you want to include 3.7 in this PR you need to modify 3.7's test in the same way. (3.7 won't get bottled if its tests fail.) You should probably also fix your commit messages, as they look like they were cut off. |
Same should be done for the |
Also, #68365 has been merged. You'll need to rebase then give the |
@alebcay I would welcome your opinion on this |
This is a bit beyond my knowledge, so I don't really have much to add, but it looks like a fairly trivial patch in terms of what it fixes, which is good. As long as there are no regressions from dependent formulae, I have no objections. |
👍
I put the term
@mkoeppe Can you elaborate here? Are the
Radical, on it.
👍 cheers mate |
Yes, all of the variables listed here:
are taken from sysconfig. The configure-time value of
Like |
1292e11
to
32820d2
Compare
Setting up |
11c5466
to
07181ce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every usage of -I
in CFLAGS
/CPPFLAGS
has been moved to CPATH
, every usage of -L
in LD_FLAGS
has been moved to LIBRARY_PATH
Looks good to me |
This broke something, critically:
|
Yep, currently investigating. @carlocab two questions:
|
If you wait for all the tests to complete failure logs are uploaded as artifacts on GitHub's UI.
Well, if you consider running on slow Intel hardware an active issue, then, yes. I would be surprised if the tests perform differently on the Intel runners. |
Actually, I take it back. I think the |
Python not finding |
Hmm, I don't have an ARM machine locally here, so I'm going to dump some commits on this PR so I can test via that CI job. |
If you want to test whether your changes will work locally, you don't need an ARM machine. Just install Homebrew into a non-default prefix, say, https://docs.brew.sh/Installation#untar-anywhere Python CI runs take just over 24 hours to complete, so using them to experiment isn't really efficient. |
python's setup.py uses hardcoded directories where it's looking for Berkeley db. |
This will need to be patched out anyway if you don't want random stuff from users' Fink installations (/sw/include/db4 etc.) to be picked up on |
We really want to patch as few things as possible, it's not a sustainable long-term solution for managing formulas. setup.py looks for the db libraries in
We can't support every user configuration, we aim for things that build on our clean CI. Homebrew is not primarily a build-from-source package manager, but a binary package manager that happens to support build-from-source in some cases. |
You are right, the hardcoded |
f85affa
to
2f42abb
Compare
@mitchhentges For [email protected], how about something like: diff --git a/Formula/[email protected] b/Formula/[email protected]
index fb33f58fe1..4306ac0f4e 100644
--- a/Formula/[email protected]
+++ b/Formula/[email protected]
@@ -100,9 +100,11 @@ class PythonAT38 < Formula
--with-openssl=#{Formula["[email protected]"].opt_prefix}
]
- cflags = ["-I#{HOMEBREW_PREFIX}/include"]
- ldflags = ["-L#{HOMEBREW_PREFIX}/lib"]
+ cflags_nodist = ["-I#{HOMEBREW_PREFIX}/include"]
+ ldflags_nodist = ["-L#{HOMEBREW_PREFIX}/lib"]
cppflags = ["-I#{HOMEBREW_PREFIX}/include"]
+ cflags = []
+ ldflags = []
if MacOS.sdk_path_if_needed
# Help Python's build system (setuptools/pip) to build things on SDK-based systems
@@ -138,9 +140,11 @@ class PythonAT38 < Formula
f.gsub! "DEFAULT_FRAMEWORK_FALLBACK = [", "DEFAULT_FRAMEWORK_FALLBACK = [ '#{HOMEBREW_PREFIX}/Frameworks',"
end
+ args << "CFLAGS_NODIST=#{cflags_nodist.join(" ")}" unless cflags_nodist.empty?
+ args << "LDFLAGS_NODIST=#{ldflags_nodist.join(" ")}" unless ldflags_nodist.empty?
+ args << "CPPFLAGS=#{cppflags.join(" ")}" unless cppflags.empty?
args << "CFLAGS=#{cflags.join(" ")}" unless cflags.empty?
args << "LDFLAGS=#{ldflags.join(" ")}" unless ldflags.empty?
- args << "CPPFLAGS=#{cppflags.join(" ")}" unless cppflags.empty?
system "./configure", *args
system "make" you maybe need to retain the CFLAGS and LDFLAGS for the SDK section, but then move HOMEBREW_PREFIX/include and HOMEBREW_PREFIX/lib to CFLAGS_NODIST and LDFLAGS_NODIST. This lets me build/test [email protected] successfully, although I'm not on an ARM machine. You might want to do something similar for [email protected]. |
5a440d3
to
53bf9ec
Compare
I think CI looks happy, the only python-related failure was |
This is blocking though, as merging this will break the existing Big Sur bottle for |
I wonder how |
53bf9ec
to
62877a7
Compare
* Mac SDK include paths should be system include path. * The brew include path should only be added for building Python, and shouldn't be re-used after (use FLAG_NODIST).
* Mac SDK include paths should be system include path. * The brew include path should only be added for building Python, and shouldn't be re-used after (use FLAG_NODIST).
62877a7
to
7070112
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI failures look exactly the same as #69668, so this LGTM.
Thanks for your first contribution to homebrew/core, @mitchhentges. I hope it's the first of many high-quality contributions to come.
We forgot the |
Thanks very much for this work. This seems to work well. |
Glad it works for you, @mkoeppe. Thanks again for all the work you put into this, @mitchhentges! |
For the record, the brew upgrade didn't change the results of python3-config --cflags. I needed to manually do brew reinstall [email protected] to see the changes. |
That's because
That'll be fixed when #70177 is merged. |
brew install --build-from-source <formula>
, where<formula>
is the name of the formula you're submitting?brew test <formula>
, where<formula>
is the name of the formula you're submitting?brew audit --strict <formula>
(after doingbrew install <formula>
)?Python CFLAGS are put before all other arguments when compiling extensions for pip packages. This is causing collisions between vendored code in the pip package and libraries installed via
brew
.This patch:
brew
include path to[C|LD]FLAGS_NODIST
-I
to-isystem
to reduce their priority-isysroot
Fixes #68352