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

python@3.10: skip LTO on Linux #113036

Closed
wants to merge 1 commit into from

Conversation

carlocab
Copy link
Member

Fixes Homebrew/discussions#3734.

This is essentially the same issue as #112154, except that I'm not aware
of a way to convert the bitcode for GCC. It's possible that there is no
way to do this, given that GCC seems to consider its IR as an internal
implementation detail.


  • Have you followed the guidelines for contributing?
  • Have you ensured that your commits follow the commit style guide?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing brew install --build-from-source <formula>)? If this is a new formula, does it pass brew audit --new <formula>?

Fixes Homebrew/discussions#3734.

This is essentially the same issue as Homebrew#112154, except that I'm not aware
of a way to convert the bitcode for GCC. It's possible that there is no
way to do this, given that GCC seems to consider its IR as an internal
implementation detail.
@carlocab carlocab added the CI-skip-dependents Pass --skip-dependents to brew test-bot. label Oct 13, 2022
@BrewTestBot BrewTestBot added CI-linux-self-hosted Build on Linux self-hosted runner legacy Relates to a versioned @ formula labels Oct 13, 2022
@carlocab
Copy link
Member Author

This should probably be backported to the other python@3.* formulae.

@cho-m
Copy link
Member

cho-m commented Oct 13, 2022

Does this fix the vim issue (which is the main issue in the discussion rather than source-build)? We pretty much always hit vim failure in Homebrew Linux CI for every Python bump because the binary is burning in the Cellar paths.

@carlocab
Copy link
Member Author

It may. I'm not sure. One thing worth checking is the output of strings libpython3.10.a before and after this change.

My guess is that this does not fix it. Even Python.framework on macOS embeds a Cellar reference, so this path is likely referred explicitly in the source somewhere.

The proper fix for that would likely be to make sure Vim links with libpython3.so instead. Embedding the interpreter statically isn't that useful because you still need all the extra stuff that comes with Python (e.g. the bundled Python libraries). It's really not clear why you would link statically when you still need that.

@BrewTestBot
Copy link
Member

🤖 A scheduled task has triggered a merge.

@carlocab
Copy link
Member Author

carlocab commented Oct 13, 2022

I think we need to set

--enable-python3interp=dynamic

to make sure we link with the shared library on Linux when building Vim.

There is a libpython3.a on macOS, but that's just a symlink to the Python framework so you'll get shared linkage anyway.

carlocab added a commit to carlocab/homebrew-core that referenced this pull request Oct 14, 2022
Currently, the python3 interpreter is linked statically on Linux.
However, the embedded interpreter still needs the Python runtime to
function, and this runtime is provided by the linked Python formula.
The interpreter thus breaks whenever Python is updated, since it can no
longer find the runtime.

Let's try to fix this by making sure the interpreter is linked
dynamically instead.

See discussion at Homebrew#113036.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI-linux-self-hosted Build on Linux self-hosted runner CI-skip-dependents Pass --skip-dependents to brew test-bot. hacktoberfest-accepted legacy Relates to a versioned @ formula
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants