brew: patchelf.rb fails on go bottling

brew config output

Linux CI / not necessary

brew doctor output

Linux CI / not necessary


  • The brew doctor above contains no “Warning” lines.

What were you trying to do (and why)?

Bottling go 1.16

What happened (include all command output)?

2021-02-24T13:07:05.0421541Z ==> brew bottle --verbose --json go --keep-old
2021-02-24T13:08:18.6409734Z ==> FAILED
2021-02-24T13:08:18.6423380Z ==> Installing patchelf...
2021-02-24T13:08:18.6425435Z /home/linuxbrew/.linuxbrew/bin/brew install patchelf
2021-02-24T13:08:18.6427118Z ==> Downloading https://linuxbrew.bintray.com/bottles/patchelf-0.12_4.x86_64_linux.bottle.tar.gz
2021-02-24T13:08:18.6435621Z ==> Downloading from https://akamai.bintray.com/56/56a0ff9acc9ab6c5d7f53d6f8ecce4878fd8c547a581960519504cf9e9dfac51?__gda__=exp=1614172746~hmac=244b54c7e503cb364eace097d882356e0ddff8e99b4d142f80efb8edcf1ddb63&response-content-disposition=attachment%3Bfilename%3D%22patchelf-0.12_4.x86_64_linux.bottle.tar.gz%22&response-content-type=application%2Fgzip&requestInfo=U2FsdGVkX1_jdUz69RdsWjsrSR4X_jmDg5dlt5h7Nb-yBuj-maRRdBkqSm_1Jz_-prCs2RbsOBOjQfpIjTD9WyBV3JbEQNepyLa4KE79tbIwbLbeqSBg516kV6h6N5EpkhIhtuYYsPUnKnNAfTw3Xw&response-X-Checksum-Sha1=584ea8b7f356dc8ebe6ca45f05c81fe8ebbe06d9&response-X-Checksum-Sha2=56a0ff9acc9ab6c5d7f53d6f8ecce4878fd8c547a581960519504cf9e9dfac51
2021-02-24T13:08:18.6442358Z ==> Pouring patchelf-0.12_4.x86_64_linux.bottle.tar.gz
2021-02-24T13:08:18.6443157Z /home/linuxbrew/.linuxbrew/Cellar/patchelf/0.12_4: 7 files, 942.3KB
2021-02-24T13:08:18.6444110Z ==> Bottling go--1.16.x86_64_linux.bottle.tar.gz...
2021-02-24T13:08:18.6445073Z tar cf /github/home/bottles/go--1.16.x86_64_linux.bottle.tar go/1.16
2021-02-24T13:08:18.6445811Z gzip -f go-bottle.tar
2021-02-24T13:08:18.6446721Z ==> Detecting if go--1.16.x86_64_linux.bottle.tar.gz is relocatable...
2021-02-24T13:08:18.6447840Z Warning: String '/home/linuxbrew/.linuxbrew/Cellar' still exists in these files:
2021-02-24T13:08:18.6448905Z /home/linuxbrew/.linuxbrew/Cellar/go/1.16/libexec/pkg/linux_amd64/runtime/cgo.a
2021-02-24T13:08:18.6450027Z  --> match '/home/linuxbrew/.linuxbrew/Cellar/go/1.16/libexec/src/runtime/cgo' at offset 0x5777
2021-02-24T13:08:18.6451524Z  --> match '/home/linuxbrew/.linuxbrew/Cellar/go/1.16/libexec/src/runtime/cgo' at offset 0x75cd
2021-02-24T13:08:18.6452717Z  --> match '/home/linuxbrew/.linuxbrew/Cellar/go/1.16/libexec/src/runtime/cgo' at offset 0xa6ec
2021-02-24T13:08:18.6453884Z  --> match '/home/linuxbrew/.linuxbrew/Cellar/go/1.16/libexec/src/runtime/cgo' at offset 0xe1be
2021-02-24T13:08:18.6455041Z  --> match '/home/linuxbrew/.linuxbrew/Cellar/go/1.16/libexec/src/runtime/cgo' at offset 0x10aeb

snip

2021-02-24T13:08:18.9431325Z  --> match '/home/linuxbrew/.linuxbrew/Cellar/go/1.16/libexec/src/runtime/profbuf.go' at offset 0x1b352f
2021-02-24T13:08:18.9432584Z  --> match '/home/linuxbrew/.linuxbrew/Cellar/go/1.16/libexec/src/runtime/rwmutex.go' at offset 0x1b3578
2021-02-24T13:08:18.9433833Z  --> match '/home/linuxbrew/.linuxbrew/Cellar/go/1.16/libexec/src/runtime/select.go' at offset 0x1b35c1
2021-02-24T13:08:18.9435084Z  --> match '/home/linuxbrew/.linuxbrew/Cellar/go/1.16/libexec/src/runtime/signal_amd64.go' at offset 0x1b3609
2021-02-24T13:08:18.9436364Z  --> match '/home/linuxbrew/.linuxbrew/Cellar/go/1.16/libexec/src/runtime/signal_linux_amd64.go' at offset 0x1b3657
2021-02-24T13:08:18.9437157Z Only the first 100 matches were output.
2021-02-24T13:08:18.9437510Z 
2021-02-24T13:08:18.9438176Z Error: undefined method `header' for nil:NilClass
2021-02-24T13:08:18.9439644Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/patchelf-1.3.0/lib/patchelf/alt_saver.rb:793:in `block in write_replaced_sections'
2021-02-24T13:08:18.9441343Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/patchelf-1.3.0/lib/patchelf/alt_saver.rb:792:in `each'
2021-02-24T13:08:18.9442983Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/patchelf-1.3.0/lib/patchelf/alt_saver.rb:792:in `write_replaced_sections'
2021-02-24T13:08:18.9444683Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/patchelf-1.3.0/lib/patchelf/alt_saver.rb:626:in `rewrite_sections_library'
2021-02-24T13:08:18.9446352Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/patchelf-1.3.0/lib/patchelf/alt_saver.rb:469:in `rewrite_sections'
2021-02-24T13:08:18.9447942Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/patchelf-1.3.0/lib/patchelf/alt_saver.rb:88:in `save!'
2021-02-24T13:08:18.9449480Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/patchelf-1.3.0/lib/patchelf/patcher.rb:191:in `save'
2021-02-24T13:08:18.9450843Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/os/linux/elf.rb:175:in `save_using_patchelf_rb'
2021-02-24T13:08:18.9451981Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/os/linux/elf.rb:105:in `patch!'
2021-02-24T13:08:18.9453168Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/extend/os/linux/keg_relocate.rb:48:in `change_rpath'
2021-02-24T13:08:18.9454595Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/extend/os/linux/keg_relocate.rb:16:in `block (2 levels) in relocate_dynamic_linkage'
2021-02-24T13:08:18.9455971Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/extend/pathname.rb:356:in `ensure_writable'
2021-02-24T13:08:18.9457334Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/extend/os/linux/keg_relocate.rb:15:in `block in relocate_dynamic_linkage'
2021-02-24T13:08:18.9458685Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/extend/os/linux/keg_relocate.rb:14:in `each'
2021-02-24T13:08:18.9460015Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/extend/os/linux/keg_relocate.rb:14:in `relocate_dynamic_linkage'
2021-02-24T13:08:18.9461415Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/keg_relocate.rb:65:in `replace_placeholders_with_locations'
2021-02-24T13:08:18.9462781Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/dev-cmd/bottle.rb:396:in `block (2 levels) in bottle_formula'
2021-02-24T13:08:18.9464001Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/utils.rb:424:in `ignore_interrupts'
2021-02-24T13:08:18.9465218Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/dev-cmd/bottle.rb:394:in `block in bottle_formula'
2021-02-24T13:08:18.9466363Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/lock_file.rb:35:in `with_lock'
2021-02-24T13:08:18.9467852Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/keg.rb:332:in `block in lock'
2021-02-24T13:08:18.9469187Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/lock_file.rb:35:in `with_lock'
2021-02-24T13:08:18.9470229Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/keg.rb:330:in `lock'
2021-02-24T13:08:18.9471341Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/dev-cmd/bottle.rb:301:in `bottle_formula'
2021-02-24T13:08:18.9472521Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/dev-cmd/bottle.rb:89:in `block in bottle'
2021-02-24T13:08:18.9473715Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/dev-cmd/bottle.rb:88:in `each'
2021-02-24T13:08:18.9474856Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/dev-cmd/bottle.rb:88:in `bottle'
2021-02-24T13:08:18.9475920Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb:122:in `<main>'
2021-02-24T13:08:18.9476405Z 
2021-02-24T13:08:18.9476954Z ==> brew linkage --test go
2021-02-24T13:08:20.2809156Z ==> brew install --only-dependencies --include-test go

What did you expect to happen?

Bottling should not fail

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

See commands used in the logs above

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (12 by maintainers)

Most upvoted comments

As my description in https://github.com/Homebrew/brew/issues/10696#issuecomment-787003167, I decide to properly handle the case when sections are not preset instead of raising an error: https://github.com/david942j/patchelf.rb/pull/34

Thanks for your input, @david942j!

I wouldn’t delete all of debug. Just the testdata subdirectory

Thanks that worked

It looks we have a workaround that got us past this issue. There were some test data ELF files in the go package that weren’t needed, so simply deleting them got us past this issue. So no changes are needed for patchelf.rb this time around. Sorry for the noise, and thanks for your help!

@rmNULL @david942j We’ve bene using patchelf.rb for some months now, and it’s been working great! We’ve just experienced our first failure in bottling go. Would either of you be interested in looking into this issue?

@iMichka Could you provide the ELF file that produces this error?