1936 Commits

Author SHA1 Message Date
Mike McQuaid
e2759fbdff
Deprecate reading all formulae through commands
We added the `--all` flag (now renamed to `--eval-all`) for various
commands for this behaviour so let's start deprecating this.

Also, introduce a `HOMEBREW_EVAL_ALL` environment variable to use the
existing, less secure, behaviour by default and avoid passing
`--eval-all` everywhere.
2022-09-05 13:57:22 +01:00
Carlo Cabrera
b2cc1720f8
Add comment explaining gcc exception for undeclared_deps. 2022-09-02 22:04:38 +08:00
Carlo Cabrera
ef7c9cf17c
linux/linkage_checker: remove gcc from undeclared_deps
This is causing warnings all over Homebrew/homebrew-core.

For example, there are dozens of warnings about this in the following CI
run:

    https://github.com/Homebrew/homebrew-core/runs/8116257943?check_suite_focus=true
2022-09-02 14:28:07 +08:00
Mike McQuaid
f788277b69
Merge pull request #13753 from Bo98/iced-formulae
Freeze formula definition once first instance is created
2022-09-01 14:15:25 +01:00
Daniel Nachun
451bded34d
Merge pull request #13770 from danielnachun/add_symlink_gcc_libs
Automatically add symlinks from gcc cellar to HOMEBREW_PREFIX/lib
2022-08-31 19:28:23 -07:00
danielnachun
3c014a0fc0
Library/Homebrew/extend/os/linux/install.rb: add symlink_gcc_libs 2022-08-31 17:39:55 -07:00
Bo Anderson
abfbb46678
Freeze formula definition once first instance is created 2022-08-31 20:40:42 +01:00
Shaun Jackman
d6368806e8
os/linux/dependency_collector: install gcc if glibc is too old.
gcc is required for libgcc_s.so.1 if glibc or gcc are too old.
2022-08-31 13:16:38 +01:00
Mike McQuaid
1f709d360d
extend/os/linux: improve glibc, gcc dependency handling.
- Add more early return checks
- Move to a recursive approach for more readability and avoiding a
  counter that we need to bump
- Perform more caching
- Keep class variable usage isolated into specific methods
2022-08-30 12:54:34 +00:00
Carlo Cabrera
ab696cbbb7
linux/diagnostic: fix rpath returning nil.
Fixes #13762.

There's still a bug in the GCC linkage check, but I'll need a bit more
time to work on a fix. This at least makes sure `brew doctor` will not
return the error in the issue linked above.
2022-08-26 22:23:02 +08:00
Mike McQuaid
3c5b55be82
linux/dependency_collector: bump maximum_tree_depth.
Fixes #13760.
2022-08-26 08:39:03 +01:00
Michka Popoff
d271614872
install glibc/gcc automatically if too old.
Right now this is done through the gcc@5 formula.
See 9692318ca6/Formula/gcc%405.rb (L33)

This is fragile because when we will migrate to gcc@11
we have to think about migrating the installation from one gcc formula to another..
Also, not having the right glibc version results in a non-functional brew
installation on an older Linux: the glibc installation needs
to be done by brew, and not by a workaround in a specific formula

Co-Authored-By: Mike McQuaid <mike@mikemcquaid.com>
Co-Authored-By: Bo Anderson <mail@boanderson.me>
Co-Authored-By: Shaun Jackman <sjackman@gmail.com>
2022-08-25 11:04:37 +01:00
Mike McQuaid
2415339124
Merge pull request #13745 from MikeMcQuaid/glibc-install-split
glibc related cleanup
2022-08-23 13:09:31 +01:00
Mike McQuaid
c294dcc616
glibc related cleanup
Extracted from https://github.com/Homebrew/brew/pull/13577
2022-08-23 12:42:02 +01:00
Bo Anderson
d9dc41bd38
linkage_checker: deprecate libnsl.so.1 linkage 2022-08-23 12:37:27 +01:00
Bo Anderson
4c643aed02
linkage_checker: disable libcrypt.so.1 linkage 2022-08-23 11:55:13 +01:00
Mike McQuaid
8f405d2c15
Merge pull request #13739 from Bo98/linkage-test
linkage_checker: don't reinstall formula on some linkage failures
2022-08-23 11:50:05 +01:00
Mike McQuaid
d550d57f78
Merge pull request #13639 from carlocab/linux-doctor-dependents
linux/diagnostic: add check for versioned GCC linkage
2022-08-23 11:46:08 +01:00
Bo Anderson
0593597a11
linkage_checker: don't reinstall formula on some linkage failures 2022-08-23 09:38:52 +01:00
Carlo Cabrera
c7030eaba0
formula: add optional source and target args to #rpath
There are about 10 formulae which need a bit more flexibility from
`#rpath`. Most of them use `Pathname#relative_path_from`, so we can
replace those instances with a call to `#rpath` instead once `#rpath`
knows how to handle this.
2022-08-19 17:32:43 +08:00
Carlo Cabrera
fb4c6d92bc
Merge pull request #13677 from carlocab/python-libexec
ENV/super: add Python's `libexec/"bin"` directory when applicable
2022-08-15 18:47:02 +08:00
Carlo Cabrera
8064a39c18
Prefer newer versions of Python
Some formulae declare multiple Python dependencies, and they can appear
in any order in the `deps` array. Let's make sure to prefer the newest
one when adding their `libexec/"bin"` directory to `PATH`.
2022-08-15 18:18:21 +08:00
Lukas Oberhuber
3d60d610dd Merge branch 'master' into debug-symbols 2022-08-10 18:44:09 -10:00
Carlo Cabrera
4a623e0a25
Merge pull request #13659 from carlocab/more-gcc-rpath
linux/super: add unversioned GCC lib directory to RPATH
2022-08-11 12:04:24 +08:00
Rylan Polster
43bbe2bcfc
Fix nil handling in arch cask DSL 2022-08-10 17:15:37 -04:00
Carlo Cabrera
999623b45d
ENV/super: add Python's libexec/"bin" directory when applicable
When Homebrew/homebrew-core#107517 is merged, builds will no longer be
able to find `python@3.9` as `python3`. This is also what is likely to
happen to `python@3.10` when we add a `python@3.11`.

This is likely to break many builds, so let's make sure they can keep
finding a `python3` for formulae that don't have a dependency on the
latest Python3.

This is arguably something we should've done earlier: it also means that
builds that go looking for an unversioned `python` end up finding our
Python3 (whenever present in the build environment) instead of, say,
`/usr/bin/python` which is typically Python2.
2022-08-10 22:51:44 +08:00
Carlo Cabrera
478e42d536
linux/linkage_checker: remove gcc from undeclared_deps 2022-08-10 19:04:35 +08:00
Rylan Polster
76ae20a12f
Re-add on_arch_conditional DSL 2022-08-09 11:34:52 -04:00
Carlo Cabrera
fa26b5a06d
linux/super: add unversioned GCC lib directory to RPATH
This adds GCC's runtime lib directory to the RPATH of every build on
Linux (unconditionally!).

This is useful for three things:

1. It fixes versioned GCC linkage for formulae that users build from
   source instead of pouring from a bottle. We currently only handle
   bottle installs. See #13633.

2. It helps minimise the GCC dependency explosion. When a formula has a
   Linux-only GCC dependency, then all its dependents that link with
   some GCC runtime library (typically `libstdc++`) must, before this
   change, also adopt a GCC dependency. This is a consequence of our
   injecting GCC's runtime library directory into RPATH only when a
   formula is built with GCC (this is done through the specs file). We
   can avoid the need to do this by always injecting this path instead.

3. This enables us to automatically install Homebrew GCC whenever the
   user's GCC is too old and the formula may need it. Without this
   change, auto-installing GCC is not that useful because formulae that
   need it may not know to look for our GCC, unless the formula already
   happened to be built with our GCC. With this change, these formulae
   will always be able to find our GCC when it is installed. This is
   particularly useful for when we start building with a version of GCC
   that is much closer to the latest than we currently do.

This approach comes with at least two drawbacks:

1. We will see spurious linkage warnings in CI about an undeclared
   dependency with linkage as soon as Homebrew GCC is installed, because
   formulae will link with our GCC instead of the host's. Users will
   also see a similar complaint if they do `brew linkage`.

2. This leans _very_ heavily on GCC delivering backward compatibility of
   their runtime libraries. If they do not, we could see different
   behaviour across different CI runs for the same formula depending on
   whether Homebrew GCC is installed.

It's worth noting that item 3 in the "useful" list above may rely on
features not yet implement in `brew`.
2022-08-06 13:21:18 +08:00
Lukas Oberhuber
6fbadb35e7
Style fix
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2022-08-05 16:06:22 -07:00
Carlo Cabrera
2d95b9acda
linux/keg_relocate: remove patchelf exemption
I don't think this is needed anymore. We probably needed this when we
used `patchelf` to do `RPATH` rewriting, but this is no longer the case.
2022-08-06 00:26:48 +08:00
Rylan Polster
d4ddfb88df
Merge pull request #13616 from Rylan12/simulate-macos-on-linux
Move `HOMEBREW_SIMULATE_MACOS_ON_LINUX` handling to `SimulateSystem`
2022-08-05 10:23:13 -04:00
Lukas Oberhuber
0b554a4138 Style 2022-08-04 08:53:07 -07:00
Carlo Cabrera
fec5b4080a
linux/diagnostic: add check for versioned GCC linkage
This complements my other two GCC-on-Linux PRs (#13631, #13633), however
they are both reliant on bottles eventually being (re-)poured.

Let's try to speed that up by returning an error message from `brew doctor`
whenever a user has formulae installed that would benefit from a `brew reinstall`.
2022-08-03 20:54:16 +08:00
Rylan Polster
7326019c93
Add clarification comment 2022-08-03 01:32:37 -04:00
Carlo Cabrera
1c0eac7874
Exclude GCC formulae from RPATH modification for GCC 2022-08-02 19:09:38 +08:00
Carlo Cabrera
532460c098
keg_relocate: fix new GCC lib directory
Also add comment explaining what this line does, along with a TODO
suggesting a replacement once we've shipped the GCC PR.
2022-08-02 13:29:14 +08:00
Carlo Cabrera
53fdb64113
keg_relocate (linux): prepend gcc/lib/current to RPATH when needed
This should help keep bottles that require GCC working when
Homebrew/homebrew-core#106755 is merged.

This only works on freshly-poured bottles. Previously installed bottles
will still break on systems with a host GCC older than GCC 11.
2022-08-02 11:02:47 +08:00
Lukas Oberhuber
bee3531090 Improve style 2022-08-01 15:25:34 -07:00
Rylan Polster
58be76bc9d
Fix on_{system} handling of generic macOS versions 2022-07-31 20:44:51 -04:00
Lukas Oberhuber
4eea117e84 ofail if debug-symbols cannot be extracted. 2022-07-30 11:41:05 +01:00
Lukas Oberhuber
cd9fe97c55 Improve style 2022-07-30 11:10:26 +01:00
Lukas Oberhuber
e46a61e181 rename & inline dsymutil to prepare_debug_symbols 2022-07-30 11:08:52 +01:00
Rylan Polster
ea1f2098ac
Move HOMEBREW_SIMULATE_MACOS_ON_LINUX handling to SimulateSystem 2022-07-28 15:04:25 -04:00
Rylan Polster
4cc0e854ce
Rename treat_as_*? to simulating_or_running_on_*? 2022-07-28 09:18:16 -04:00
Lukas Oberhuber
22b1b61b73 Fix brew typecheck 2022-07-26 19:36:43 +01:00
Lukas Oberhuber
215e545660 brew style 2022-07-26 19:28:30 +01:00
Lukas Oberhuber
6551b25b07 Compile with symbols when requested on all plats 2022-07-26 17:56:11 +01:00
Lukas Oberhuber
c2a95f077f Compiler -g flag set based on --debug-symbols 2022-07-26 17:18:01 +01:00
Lukas Oberhuber
d195f22522 Connecting up --debug-symbols flag
This connects the calling of dsymutil and the retention of temporary
files. Still need to connect compilation to flag.
2022-07-26 12:15:53 +01:00