83 Commits

Author SHA1 Message Date
Douglas Eichelberger
adfd12cfd0 Enable more typing 2023-03-21 21:42:51 -07:00
Bo Anderson
1882ae4f6e
Update Linux requirements
* Glibc 2.26+ (we use 2.35) require Linux kernel 3.2 or later.
* Remove GCC requirement given it doesn't matter for bottles (we install GCC ourselves if too old) and is probably wrong for the build-from-source case.
* Remove libxcrypt-compat requirement given we don't use libcrypt.so.1 anymore.
2022-10-16 17:08:17 +01:00
Carlo Cabrera
25910b9c68
Use Array.
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2022-08-26 22:29:55 +08: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
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
Chris Araman
caf310038f
linkage: display executables with missing rpath
An executable that links against @rpath-prefixed dylibs must include at least
one runtime path. This will prevent issues like the one resolved in #91485.

Caveats:
1. This won't find executables that have only recursive dylib dependencies with
   @rpath prefixes.
2. This makes no attempt to resolve @rpath, @executable_path or @loader_path
   dylibs, or to verify the correctness of any LC_RPATH entries, or to
   otherwise simulate dlopen logic.
3. Weakly-linked dylibs are still excluded from the search for broken linkage.

The scope is narrow in order to focus on this particular problem. It is meant
only as a sanity check.
2021-12-20 13:44:35 -08:00
Bo Anderson
9493cbb80a
os/linux/elf: don't report missing libraries to dependents 2021-10-31 17:03:29 +00:00
Mike McQuaid
0cda6a0657
Only use patchelf.rb
Remove support for using the `patchelf` formula for writing as it's been
off by default for a long time now.
2021-10-19 15:15:56 +01:00
fn ⌃ ⌥
9638e3e8c0 development_tools: update type signatures 2021-09-29 17:44:26 -07:00
Carlo Cabrera
d696250ddb
Fix ELF architecture offset for x86_64
The current offset results in ELF binaries returning an `#arch` of
`:dunno`.

Also, skip the `check_binary_arches` audit on the generic OS.
2021-07-18 16:55:57 +08:00
Shaun Jackman
70292829f3
Cache glibc.system_version 2021-04-02 10:58:01 -07:00
Shaun Jackman
393027597b
Cache glibc.version
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2021-04-02 10:53:47 -07:00
Shaun Jackman
95e7e010ee Add OS::Linux::Glibc.version 2021-04-01 22:16:33 -07:00
Mike McQuaid
e65e310fd0
Fix brew style 2021-01-29 20:56:59 +00:00
EricFromCanada
2ed324ebc0 use backticks around suggested input, flags, and binaries 2021-01-26 16:19:47 -05:00
Seeker
32ebc02f2f version: enable Sorbet type checking 2021-01-19 09:28:37 -08:00
Maxim Belkin
45d67ef13e
brew.sh: define minimum required Glibc version 2020-12-24 09:10:53 -06:00
Shaun Jackman
81716100ae Enable HOMEBREW_PATCHELF_RB_WRITE by default
It may be disabled using HOMEBREW_NO_PATCHELF_RB_WRITE.

It is currently disabled in brew test-bot when building bottles.
2020-12-11 18:08:10 -08:00
Mike McQuaid
0f9bad0052
Fix bottle prefix and repository handling
We were previously only looking at the `cellar` value when pouring
bottles and ignoring the `prefix` and (implicit) `repository`.

Actually look at these values and set the defaults for each platform.

Also, when we're relocating to create or pour bottles when `prefix`
and `repository` are equal then skip relocating the `repository` and
always use references to the `prefix` instead.

Fixes #9453
2020-12-09 13:53:10 +00:00
Markus Reiter
fe2c201d00
Merge pull request #9268 from reitermarkus/type-signatures
Add more type signatures.
2020-11-30 15:16:05 +01:00
Mike McQuaid
96d3eb5cf1
Merge pull request #9280 from sjackman/sj/patchelf-rb-write
Enable HOMEBREW_PATCHELF_RB_WRITE for CI and HOMEBREW_DEV_CMD_RUN
2020-11-30 12:59:05 +00:00
Markus Reiter
7348185347 Reorder global. 2020-11-30 00:00:02 +01:00
Shaun Jackman
65bc39f952 HOMEBREW_PATCHELF_RB_WRITE: Move logic to test-bot 2020-11-26 11:53:31 -08:00
Shaun Jackman
8a4299d028 Enable HOMEBREW_PATCHELF_RB_WRITE for CI and HOMEBREW_DEV_CMD_RUN
Enable HOMEBREW_PATCHELF_RB_WRITE by default for HOMEBREW_DEV_CMD_RUN
and CI, but not when building bottles.
2020-11-26 11:23:38 -08:00
Shaun Jackman
4bbf92912b Enable HOMEBREW_PATCHELF_RB_WRITE by default
Enable HOMEBREW_PATCHELF_RB_WRITE by default for everyone except CI.
It may be disabled using HOMEBREW_NO_PATCHELF_RB_WRITE.
It may be enabled on CI using HOMEBREW_PATCHELF_RB_WRITE.
2020-11-24 10:52:11 -08:00
Markus Reiter
da9289eff0 Add more type signatures. 2020-11-13 12:26:36 +01:00
Mike McQuaid
5afff3f3aa
Handle macOS Homebrew on ARM
- Output `brew doctor` and `brew install` messages noting this configuration is (currently) unsupported and encourage use of Rosetta instead
- Output Rosetta 2 usage in `brew config` on ARM (whether in Rosetta 2 or not)
- Check the architecture of (newly installed) dependencies and ensure they are using the correct architecture.
- Don't allow installing macOS Intel Homebrew in macOS ARM Homebrew default prefix (and vice versa
- Actually write out the architecture of dependencies to the tab rather than generating and throwing them away
- Set and document the expected default prefix for macOS Intel Homebrew, macOS ARM Homebrew (`/opt/homebrew`) and Homebrew on Linux

While we're here:
- Don't say Big Sur is a prerelease version but still make it clear we
  don't support it (yet).
- Don't reference non-existent IRC channel
2020-11-12 17:06:47 +00:00
EricFromCanada
3768b7a6e9 apidoc: update comment wording, punctuation, formatting 2020-11-06 00:21:02 -05:00
Markus Reiter
24ae318a3d Move type annotations into files. 2020-10-10 14:59:39 +02:00
rmnull
0dcfdbe0eb
enable patchelf.rb writing for devs. 2020-08-29 00:45:25 +05:30
rmnull
649e02ba3d
patchelf.rb writing in ELFShim 2020-08-27 22:50:34 +05:30
Markus Reiter
f7cb6a95b6 Document Kernel. 2020-08-26 03:13:59 +02:00
Markus Reiter
6f0f8bd574 Document Glibc. 2020-08-26 03:13:59 +02:00
Markus Reiter
4304fa048e Document ELFShim. 2020-08-26 03:13:59 +02:00
Markus Reiter
e024b12d47 Remove os/linux/diagnostic. 2020-08-24 00:22:17 +02:00
Seeker
3379e3b5cf os: add kernel_version 2020-08-19 11:41:30 -07:00
Mike McQuaid
763bf6f699
Use vendored patchelf.rb. 2020-08-11 08:41:31 +01:00
rmnull
043719383b
remove code using patchelf, remove HOMEBREW_PATCHELF_RB var 2020-08-08 06:48:31 +05:30
rmnull
0c2d7659cf
patchelf.rb reading for everyone :) 2020-08-08 06:32:34 +05:30
rmnull
ce2eda5a26
remove PatchELF::Patcher refinements. 2020-07-29 09:38:15 +05:30
rmnull
e79eeb7560
Bug Fix: Don't search for needed libraries on non DYNAMIC ELFs. 2020-07-26 04:56:21 +05:30
rmnull
f92c7d30c1
let patchelf return nil on blank rpath 2020-07-25 01:07:52 +05:30
rmnull
d607528a5b
introduce ELFShim#rpath, refactor keg_relocate to use the same.
refines PatchELF #runpath, #rpath #soname #interpreter
to return nil.
let Brew hard exits on PatchELF::PatchError.

Co-authored-by: Shaun Jackman <sjackman@gmail.com>
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2020-07-25 01:07:24 +05:30
rmnull
2ca03610e2
update patchelf.rb to '~> 1.1' in Gemfile. Replace instance variable access with call to .elf.
patcher.elf was introduced in gem release v1.1.0.
2020-07-14 04:30:29 +05:30
rmnull
35328ed535
[draft] refactoring keg_relocate to use ELFShim#interpreter instead of .with_interpreter? 2020-06-26 05:34:41 +05:30
Shaun Jackman
de6fe2edc1 Revert "Enable patchelf.rb for HOMEBREW_DEVELOPERs."
This reverts commit 6106bfc4976dff2b03cf3fadbbf92dd1fd9e0f09.

Fix the error:
brew install patchelf
==> Pouring patchelf-0.10.x86_64_linux.bottle.1.tar.gz
Error: cannot load such file -- patchelf
2020-06-22 14:14:33 -07:00
Shaun Jackman
b79e047e12
Merge pull request #7780 from rmNULL/enable-patchelfrb-for-devs
enable patchelf.rb when HOMEBREW_DEVELOPER is set
2020-06-22 13:59:43 -07:00
rmnull
6106bfc497
Enable patchelf.rb for HOMEBREW_DEVELOPERs.
HOMEBREW_PATCHELF_RB is enabled on 2 cases.
1) `HOMEBREW_PATCHELF_RB` is set
2) `HOMEBREW_DEVELOPER` is set , and `HOMEBREW_NO_PATCHELF_RB` is not set.

use `HOMEBREW_NO_PATCHELF_RB` to turn it off for devs.

 Note: When HOMEBREW_PATCHELF_RB and HOMEBREW_NO_PATCHELF_RB both are
    present, it is on
2020-06-23 00:11:50 +05:30
rmnull
3f211415ca
don't warn "no interpreter found" for Shared ELF objects. 2020-06-22 01:24:03 +05:30
rmnull
486114282c
In ELFShim, #needed_libraries, #dynamic_elf? and #with_interpreter? check using patchelf gem.
Having HOMEBREW_PATCHELF_RB set in the ENV,
will conditionally install patchelf.rb gem,
use patchelf.rb in the above mentioned methods.
The installed vendored gems are listed in .gitignore
to maintain a clean state.
2020-06-19 21:23:57 +05:30