Linuxbrew-core: Rust: bottled binaries need resetting interpreter when installed in non-standard location

Created on 11 Jan 2019  路  18Comments  路  Source: Homebrew/linuxbrew-core

Please note we will close your issue without comment if you delete, do not read or do not fill out the issue checklist below and provide ALL the requested information. If you repeatedly fail to use the issue template, we will block you from ever submitting issues to Homebrew again.

  • [x] have a problem with brew install (or upgrade, reinstall) a single formula? If it's a general brew problem please file this issue at Linuxbrew/brew: https://github.com/Linuxbrew/brew/issues/new/choose. If it's a tap (e.g. Brewsci/homebrew-bio) problem please file this issue at the tap.
  • [x] ran brew update and can still reproduce the problem?
  • [x] ran brew doctor, fixed all issues and can still reproduce the problem?
  • [ ] ran brew gist-logs <formula> (where <formula> is the name of the formula that failed) and included the output link?
  • [ ] if brew gist-logs didn't work: ran brew config and brew doctor and included their output with your issue?

To help us debug your issue please explain:

  • What you were trying to do (and why)
    brew install rust --force-bottle
  • What happened (include command output)
    Installation is successful but the binaries can't be run because the interpreter path to ld.so is hardcoded to /home/linuxbrew/.linubrew/lib/ld.so

My linuxbrew is installed in ~/.linuxbrew. I can workaround the issue using patchelf --set-interpreter ~/.linuxbrew/opt/rust/bin/rustc for example. Can this be done in the formula when pouring the bottle?

bug outdated stale

All 18 comments

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

Weird. As the bottle is marked as relocatable, your probably do not need the --force-bottle flag. I see that patchelf is indeed run on rustc when the bottle is poured.

I am hitting another error thoug:

==> Finishing up
ln -s ../Cellar/rust/1.32.0/bin/cargo cargo
ln -s ../Cellar/rust/1.32.0/bin/racer racer
ln -s ../Cellar/rust/1.32.0/bin/rust-gdb rust-gdb
ln -s ../Cellar/rust/1.32.0/bin/rust-lldb rust-lldb
ln -s ../Cellar/rust/1.32.0/bin/rustc rustc
ln -s ../Cellar/rust/1.32.0/bin/rustdoc rustdoc
ln -s ../../Cellar/rust/1.32.0/share/doc/rust rust
ln -s ../../../Cellar/rust/1.32.0/share/man/man1/rustc.1 rustc.1
ln -s ../../../Cellar/rust/1.32.0/share/man/man1/rustdoc.1 rustdoc.1
ln -s ../Cellar/rust/1.32.0/share/rust rust
ln -s ../Cellar/rust/1.32.0/lib/libarena-36ec6e0ea3ada185.so libarena-36ec6e0ea3ada185.so
ln -s ../Cellar/rust/1.32.0/lib/libfmt_macros-7663dbafdf452605.so libfmt_macros-7663dbafdf452605.so
ln -s ../Cellar/rust/1.32.0/lib/libgraphviz-d77cc560f970f370.so libgraphviz-d77cc560f970f370.so
ln -s ../Cellar/rust/1.32.0/lib/librustc-d487f79bdc0d476a.so librustc-d487f79bdc0d476a.so
ln -s ../Cellar/rust/1.32.0/lib/librustc_allocator-cff02bbb4551c5d7.so librustc_allocator-cff02bbb4551c5d7.so
ln -s ../Cellar/rust/1.32.0/lib/librustc_borrowck-2d17012447025e7a.so librustc_borrowck-2d17012447025e7a.so
ln -s ../Cellar/rust/1.32.0/lib/librustc_codegen_ssa-ad2f2cf720e0e201.so librustc_codegen_ssa-ad2f2cf720e0e201.so
ln -s ../Cellar/rust/1.32.0/lib/librustc_codegen_utils-d5cc2e039de33fc4.so librustc_codegen_utils-d5cc2e039de33fc4.so
ln -s ../Cellar/rust/1.32.0/lib/librustc_cratesio_shim-9580821ddda02480.so librustc_cratesio_shim-9580821ddda02480.so
ln -s ../Cellar/rust/1.32.0/lib/librustc_data_structures-c02875b23dfb99bd.so librustc_data_structures-c02875b23dfb99bd.so
ln -s ../Cellar/rust/1.32.0/lib/librustc_driver-a68ec961234c2001.so librustc_driver-a68ec961234c2001.so
ln -s ../Cellar/rust/1.32.0/lib/librustc_errors-f9d34ebf3c6d3167.so librustc_errors-f9d34ebf3c6d3167.so
ln -s ../Cellar/rust/1.32.0/lib/librustc_fs_util-b13bcd72094ad2ae.so librustc_fs_util-b13bcd72094ad2ae.so
ln -s ../Cellar/rust/1.32.0/lib/librustc_incremental-8633562df6ca6992.so librustc_incremental-8633562df6ca6992.so
ln -s ../Cellar/rust/1.32.0/lib/librustc_lint-01e5c698edd360b0.so librustc_lint-01e5c698edd360b0.so
ln -s ../Cellar/rust/1.32.0/lib/librustc_metadata-07e7aa24fc1cc3c9.so librustc_metadata-07e7aa24fc1cc3c9.so
ln -s ../Cellar/rust/1.32.0/lib/librustc_mir-764ed89f33f1a669.so librustc_mir-764ed89f33f1a669.so
ln -s ../Cellar/rust/1.32.0/lib/librustc_passes-a87a6dc4c3c522e3.so librustc_passes-a87a6dc4c3c522e3.so
ln -s ../Cellar/rust/1.32.0/lib/librustc_platform_intrinsics-aa5b4fad417979c0.so librustc_platform_intrinsics-aa5b4fad417979c0.so
ln -s ../Cellar/rust/1.32.0/lib/librustc_plugin-aa7b0219f9712806.so librustc_plugin-aa7b0219f9712806.so
ln -s ../Cellar/rust/1.32.0/lib/librustc_privacy-1f903671c3b69e96.so librustc_privacy-1f903671c3b69e96.so
ln -s ../Cellar/rust/1.32.0/lib/librustc_resolve-2b8e3adf3ab53d0e.so librustc_resolve-2b8e3adf3ab53d0e.so
ln -s ../Cellar/rust/1.32.0/lib/librustc_save_analysis-cab8fa5916ca4907.so librustc_save_analysis-cab8fa5916ca4907.so
ln -s ../Cellar/rust/1.32.0/lib/librustc_target-c594bfa5c81bdc25.so librustc_target-c594bfa5c81bdc25.so
ln -s ../Cellar/rust/1.32.0/lib/librustc_traits-d04f06a6dd0904df.so librustc_traits-d04f06a6dd0904df.so
ln -s ../Cellar/rust/1.32.0/lib/librustc_typeck-9b9b471c6e8673e7.so librustc_typeck-9b9b471c6e8673e7.so
ln -s ../Cellar/rust/1.32.0/lib/libserialize-f1e42cfda55ce63e.so libserialize-f1e42cfda55ce63e.so
ln -s ../Cellar/rust/1.32.0/lib/libstd-be3f5b84c0422bf0.so libstd-be3f5b84c0422bf0.so
ln -s ../Cellar/rust/1.32.0/lib/libsyntax-9e0a1f1212139533.so libsyntax-9e0a1f1212139533.so
ln -s ../Cellar/rust/1.32.0/lib/libsyntax_ext-6552f5a34206d28f.so libsyntax_ext-6552f5a34206d28f.so
ln -s ../Cellar/rust/1.32.0/lib/libsyntax_pos-5ff96a3e62b2c0bd.so libsyntax_pos-5ff96a3e62b2c0bd.so
ln -s ../Cellar/rust/1.32.0/lib/libterm-1b83f14125db072d.so libterm-1b83f14125db072d.so
ln -s ../Cellar/rust/1.32.0/lib/libtest-187773f144ed2d0e.so libtest-187773f144ed2d0e.so
ln -s ../Cellar/rust/1.32.0/lib/rustlib rustlib
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/postinstall.rb (Formulary::FromPathLoader): loading /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/rust.rb
Error: Failure while executing; `readelf -d /home/linuxbrew/.linuxbrew/Cellar/rust/1.32.0/share/rust/rust_src/tools/lldb/unittests/ObjectFile/ELF/Inputs/early-section-headers.so` exited with 1. Here's the output:
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/utils/popen.rb:10:in `safe_popen_read'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/os/linux/elf.rb:136:in `needed_libraries_using_readelf'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/os/linux/elf.rb:111:in `needed_libraries'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/os/linux/elf.rb:87:in `initialize'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/os/linux/elf.rb:152:in `new'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/os/linux/elf.rb:152:in `metadata'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/os/linux/elf.rb:160:in `dynamically_linked_libraries'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/linkage_checker.rb:98:in `block in check_dylibs'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/pathname.rb:563:in `block in find'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/find.rb:49:in `block (2 levels) in find'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/find.rb:48:in `catch'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/find.rb:48:in `block in find'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/find.rb:43:in `each'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/find.rb:43:in `find'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/pathname.rb:563:in `find'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/forwardable.rb:202:in `find'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/linkage_checker.rb:91:in `check_dylibs'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/extend/os/linux/linkage_checker.rb:23:in `check_dylibs'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/linkage_checker.rb:25:in `initialize'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula_installer.rb:642:in `new'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula_installer.rb:642:in `block in finish'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/cache_store.rb:15:in `use'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula_installer.rb:639:in `finish'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula_installer.rb:592:in `install_dependency'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula_installer.rb:545:in `block in install_dependencies'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula_installer.rb:545:in `each'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula_installer.rb:545:in `install_dependencies'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula_installer.rb:254:in `install'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/cmd/install.rb:321:in `install_formula'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/cmd/install.rb:253:in `block in install'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/cmd/install.rb:251:in `each'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/cmd/install.rb:251:in `install'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb:105:in `<main>'

I am currently investigating this latest issue. It may have something to do with the latest binutils update.

@sjackman did you ever see this error?

No, I have never seen this error.

readelf -d /home/linuxbrew/.linuxbrew/Cellar/rust/1.32.0/share/rust/rust_src/tools/lldb/unittests/ObjectFile/ELF/Inputs/early-section-headers.so
readelf: Warning: possibly corrupt ELF header - it has a non-zero program header offset, but no program headers

That's a test file, which is probably corrupted on purpose.

I am working on a patch

I'm seeing this error as well. Let me know if you need me to test anything. Not sure how to fix this.

Patch is here: https://github.com/Homebrew/brew/pull/5696

I think that it stumbles on the corrupted elf file, and then does not patch the rest of the files. Can you try if it helps?

@iMichka nope, doesn't seem like it. ldd $(brew --prefix rust)/bin/cargo still fails with /home/jchang/.linuxbrew/bin/ldd: /home/jchang/.linuxbrew/opt/rust/bin/cargo: /home/linuxbrew/.linuxbrew/lib/ld.so: bad ELF interpreter: No such file or directory. I checked the install log and it seems like patchelf worked just fine (or without an error at least)

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

I merged https://github.com/Homebrew/brew/pull/5696. @Char-Aznable can you update, brew uninstall rust and brew install rust again?

I just tried it with latest bottle 1.33.0 and the problem persists.

@Char-Aznable Please report brew --version and try brew update.

$brew --version Homebrew 2.0.3-41-g0f07fe5 Homebrew/linuxbrew-core (git revision f7d0dd; last commit 2019-03-11) $ brew update Already up-to-date.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

$brew --version
Homebrew 2.0.3-41-g0f07fe5
Homebrew/linuxbrew-core (git revision f7d0dd; last commit 2019-03-11)
$ brew update
Already up-to-date.

how about your result? I think the problem still exists

I does, as nobody worked on this. Pull requests are welcome though!

@xu-cheng submitted PR https://github.com/Homebrew/brew/pull/6303 to fix this issue.

Was this page helpful?
0 / 5 - 0 ratings