Cannot brew install binutils with no sudo

Quick Summary of Problem:
Trying to install homebrew on the my home directory at HPC system (so no sudo rights). Successful install of brew but not able to install binutils.

Thanks for your guidance in advance!

Output from brew install binutils (started only after Download finishes)

Since new user can only include one media, i have to put the other media here, which is the output from brew config. Thanks a lot for your help!

In future, please post output in text form rather than screenshots, as text in images can be really hard to read even on desktops.

Based on your brew config output, you have a older version of gcc (v4.8.5) than the one with which all Homebrew software is built and tested on Linux (v5.5). Upgrading your GCC may well solve your problem, since otherwise you’re building a binutils that’s five years newer than your compiler.

Also check the log files in /afs/ to see where and why your build failed (if I typed that path wrong, you now know another reason why plain text is always preferred to screenshots for these purposes). As the first screenshot says, it’s only showing you the last 15 lines of one log file.

Lastly, since you’re installing Homebrew in a non-standard location, official support will probably not be forthcoming.

Sidenote: Despite your topic title, your issue has almost certainly nothing to do with sudo. Neither builds nor installs of Homebrew formulae involve root, though some formulae may have post-install instructions to perform certain actions as root.

Thank you for the bug report, Sen. I’ve opened and merged PR to fix your issue. Please run brew update and brew install glibc gcc.

Hi Shaun, thanks for the bug fix. It was a instant success after brew update. A following up question here. I then tried to brew install neovim which got stuck at installing “krb5” and also “neovim” itself. At both times the problem occurred at compiling. Followed up your commit and added cellar :any to both formula with brew edit <formula> and both times it worked.

It seems like a neat trick but I am just wondering if there are any potential issues here I should be careful about?

cellar :any tells Homebrew that the formulae so marked can be installed via bottle under any HOMEBREW_PREFIX, not just the standard /home/linuxbrew/.linuxbrew. This means that:

  1. All formulae thus marked will no longer be compiled from source by default, as is the standard procedure for all non-standard HOMEBREW_PREFIXes like your current installation.
  2. All binaries in these bottles will have their internal linkages (shared library references, mostly) rewritten to your current HOMEBREW_PREFIX after installation. This should work, but there are no guarantees. (This also happens with the standard HOMEBREW_PREFIX, but this is actively tested, so there are rarely any issues.)
  3. There may be other files (scripts, config files, etc.) in those bottles that are not redirected to HOMEBREW_PREFIX. You’d have to find and fix those manually, each time you install/upgrade these formulae. (This is never a problem with the standard HOMEBREW_PREFIX, since the “baked-in” paths are already correct by definition.)

Thanks a lot Adrian for the detailed response. That clears up my confusion. Cheers

Note, though, that adding cellar :any to your local copy of any formula is untested by definition. If it works for you, and brew test <formula> passes on your system, consider submitting a PR to make it official.

Sure. I am currently trying to install cgal and there are quite a few formulas that need to add cellar :any. I will do a bulk test on on formulae requiring that.

There seems to be a general pattern. ninja -v and explicit call on binaries in /usr/local seems to be the reason but that is just a gut feeling for now.

Thanks for the suggestion on submitting PR. Have to say brew is the only solution available for me as package-manager on HPC systems. Even with adding cellar :any once in a while, it is still far more convenient than alternative options.

This information is redundant with what Adrian posted, but I’ll post it here for completeness anyway. It’s my stock response.

Consider installing Linuxbrew in /home/linuxbrew/.linuxbrew/ if possible so that you can use precompiled binary packages (known as bottles) for non-relocatable formula like krb5. Another possible workaround for you is brew install --force-bottle krb5, but no promises.

If it’s an option for you, you could open a ticket with your information systems department to ask that they create a linuxbrew role account with home directory /home/linuxbrew.

The precompiled binary bottles of non-relocatable bottles can only be used if you install in /home/linuxbrew/.linuxbrew, otherwise they have to be built from source. See the documentation below. On macOS the default installation directory is /usr/local. On Linux the default installation directory is /home/linuxbrew/.linuxbrew.

The cellar :any status is determined by heuristics in brew bottle, so unfortunately it’s not as simple as opening a PR to add cellar :any (binutils is a special exception because it’s a dependency of glibc, which is an implicit dependency of all bottles). The heuristics are decidedly not perfect, and err on the side of caution, which means marking some formulae as not relocatable when the really are, sadly. The heuristics could be improved with work and PR.