Homebrew / brew

🍺 The missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
41.27k stars 9.7k forks source link

Installing Rust-based packages on Linux fails with "cannot normalize PT_NOTE segment" error #14130

Closed breqdev closed 1 year ago

breqdev commented 1 year ago

brew config output

HOMEBREW_VERSION: 3.6.10
ORIGIN: https://github.com/Homebrew/brew
HEAD: eaf887656ffb8e9e35ccf08081814d4735637564
Last commit: 10 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 02218094c06c0dac51214fb58814394223db799d
Core tap last commit: 10 minutes ago
Core tap branch: master
HOMEBREW_PREFIX: /home/linuxbrew/.linuxbrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 2
Homebrew Ruby: 2.6.8 => /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.8_1/bin/ruby
CPU: dual-core 64-bit zen
Clang: 14.0.0
Git: 2.34.1 => /bin/git
Curl: 7.81.0 => /bin/curl
Kernel: Linux 5.15.0-1021-oracle x86_64 GNU/Linux
OS: Ubuntu 22.04.1 LTS (jammy)
Host glibc: 2.35
/usr/bin/gcc: 11.3.0
/usr/bin/ruby: N/A
glibc: N/A
gcc@11: N/A
gcc: 12.2.0
xorg: N/A

brew doctor output

Your system is ready to brew.

Verification

What were you trying to do (and why)?

I was trying to set up a brand new Linux machine by installing a list of homebrew packages I usually use.

What happened (include all command output)?

All of the installs succeeded, except for several of the packages which were written in Rust. Specifically, attempting to brew install any of dog, dust, rm-improved, or zoxide yields the following error:

==> Downloading https://ghcr.io/v2/homebrew/core/zoxide/manifests/0.8.3
Already downloaded: /home/breq/.cache/Homebrew/downloads/bdd0e6ba45cfabe01c7681d06d90aa4f72e426e93a16f27e0cb6aac1bd638b32--zoxide-0.8.3.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/zoxide/blobs/sha256:518af8008a52ad206b92820ce1dca7eb713bdf63f4ba6509eca3441ef9b8b810
Already downloaded: /home/breq/.cache/Homebrew/downloads/47616426cb3d831cfcda6db9c906104354739366f16f41e5518d640f7c5057a7--zoxide--0.8.3.x86_64_linux.bottle.tar.gz
==> Pouring zoxide--0.8.3.x86_64_linux.bottle.tar.gz
Error: cannot normalize PT_NOTE segment: non-contiguous SHT_NOTE sections
Please report this issue:
  https://docs.brew.sh/Troubleshooting
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/patchelf-1.4.0/lib/patchelf/alt_saver.rb:682:in `normalize_note_segment'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/patchelf-1.4.0/lib/patchelf/alt_saver.rb:659:in `block in normalize_note_segments'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/patchelf-1.4.0/lib/patchelf/alt_saver.rb:955:in `block in phdrs_by_type'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/patchelf-1.4.0/lib/patchelf/alt_saver.rb:952:in `each'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/patchelf-1.4.0/lib/patchelf/alt_saver.rb:952:in `each_with_index'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/patchelf-1.4.0/lib/patchelf/alt_saver.rb:952:in `phdrs_by_type'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/patchelf-1.4.0/lib/patchelf/alt_saver.rb:653:in `normalize_note_segments'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/patchelf-1.4.0/lib/patchelf/alt_saver.rb:638:in `rewrite_sections_library'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/patchelf-1.4.0/lib/patchelf/alt_saver.rb:475:in `rewrite_sections'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/patchelf-1.4.0/lib/patchelf/alt_saver.rb:88:in `save!'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/patchelf-1.4.0/lib/patchelf/patcher.rb:191:in `save'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/os/linux/elf.rb:167:in `save_using_patchelf_rb'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/os/linux/elf.rb:112:in `patch!'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/extend/os/linux/keg_relocate.rb:53:in `change_rpath'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/extend/os/linux/keg_relocate.rb:15:in `block (2 levels) in relocate_dynamic_linkage'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/extend/pathname.rb:341:in `ensure_writable'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/extend/os/linux/keg_relocate.rb:14:in `block in relocate_dynamic_linkage'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/extend/os/linux/keg_relocate.rb:13:in `each'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/extend/os/linux/keg_relocate.rb:13:in `relocate_dynamic_linkage'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/keg_relocate.rb:132:in `replace_placeholders_with_locations'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula_installer.rb:1226:in `pour'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula_installer.rb:425:in `install'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/upgrade.rb:203:in `install_formula'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/install.rb:350:in `install_formula'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/install.rb:340:in `block in install_formulae'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/install.rb:339:in `each'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/install.rb:339:in `install_formulae'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/cmd/install.rb:233:in `install'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb:95:in `<main>'

What did you expect to happen?

I expected these packages to be installed without errors.

Step-by-step reproduction instructions (by running brew commands)

`brew install dog`, `brew install dust`, `brew install rm-improved`, or `brew install zoxide`.
Bo98 commented 1 year ago

We made a change that was incompatible with a small number of bottles that had previously unnoticed ELF corruption issues. It seems like Rust dependents were at the centre of most of them and I will do a check of them all this week. We have however already fixed some and I will fix the ones you've listed just now. I'll probably not be about when the fix gets through the queue and uploaded, but it will be up within the next few hours.

ivaquero commented 1 year ago

Same error for gitui, pueue and sd. Please help to fix.

svenlowrybjss commented 1 year ago

Getting the same thing for tokei and ripsecrets

Bo98 commented 1 year ago

All the ones mentioned here should be fixed now.

ivaquero commented 1 year ago

Thanks!

breqdev commented 1 year ago

Thanks for the quick fix! Much appreciated :heart:

tylerbutler commented 1 year ago

Still repros for fnm and viu.

Bo98 commented 1 year ago

Fixed fnm and viu.

I've now collected a full list of affected Rust dependents and will get them sorted over the next couple days.

melkir commented 1 year ago

~Having the same issue with htmlq since today.~ Looks good.

Moulick commented 1 year ago

Same with navi https://github.com/Homebrew/homebrew-core/actions/runs/3496636980/jobs/5854849904

Ikar123 commented 1 year ago

Have same issue with mcfly, when running brew install mcfly

Bo98 commented 1 year ago

This has been fixed for every Rust dependent except gnirehtet and spotifyd, which have further issues unrelated to this one that prevent it from working any further which I'll look into soon.

It's possible you may see this for a non-Rust dependent - please let me know if you do - but those seem to be very rare and I've not seen a report for one in a few weeks now.

melkir commented 1 year ago

The problem is back for htmlq since yesterday 🤔

Bo98 commented 1 year ago

The problem is back for html since yesterday 🤔

If you mean htmlq, you probably just have an outdated homebrew-core:

$ brew install htmlq
==> Downloading https://ghcr.io/v2/homebrew/core/htmlq/manifests/0.4.0-1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/htmlq/blobs/sha256:b93418d06723
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Pouring htmlq--0.4.0.x86_64_linux.bottle.1.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/htmlq/0.4.0: 7 files, 3.3MB
==> Running `brew cleanup htmlq`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
melkir commented 1 year ago

That was it! Adding brew update to my github actions before installing the modules solved the problem 😊

horious commented 1 year ago

Strill problem finefindus/tap/artem

Bo98 commented 1 year ago

Strill problem finefindus/tap/artem

That's from a third paty tap we do not maintain. You'll need to contact the maintainers of that tap and ask for a bottle rebuild as the original bottle is corrupt (and the cause of that has been fixed).