Linuxbrew / brew

:beer::penguin: The Homebrew package manager for Linux
https://linuxbrew.sh
BSD 2-Clause "Simplified" License
2.65k stars 235 forks source link

Failure while executing git config, exit code 129 #921

Closed findingorder closed 5 years ago

findingorder commented 5 years ago

I am attempting to use Linuxbrew on a Red Hat Enterprise Linux Server 6.9 server where I do not have root. The server is configured with an outdated version of git, which I cannot change. In my home directory I cloned and built the latest version of git, and 'make install'ed it so that it sits in ~/bin. I changed my PATH so ~/bin is first. When I run "which git" it tells me the right location, ~/bin/git. When I run "git --version" it correctly gives me the version the git I installed, "git version 2.20.1.142.g7755635". So far so good.

When I try to "brew install" anything, brew throws the error "Error: Failure while executing; git config --local --replace-all homebrew.private false exited with 129." Error code 129 indicates bad arguments.

So I'm pretty sure it's running the right git, the one in ~/bin. Can anyone tell me what I can do to get past this error? Thanks, Phil

findingorder commented 5 years ago

P.S. Earlier in the output, it says

==> Installing dependencies for hello: patchelf, zlib, binutils, linux-headers, glibc, m4, gmp, mpfr, libmpc, isl@0.18 and gcc
==> Installing hello dependency: patchelf
error: unknown option `local'
usage: git config [options]
...

The "unknown option 'local'" message might mean brew is using the older get, the one found in /usr/bin. So is there a bug in brew where it does not respect the PATH and uses /usr/bin/git regardless of what is in the path?

sjackman commented 5 years ago

Hi, Phil. This is a bug in Linuxbrew. Try…

export HOMEBREW_GIT_PATH=$HOME/bin/git
brew config | grep Git
brew install hello
findingorder commented 5 years ago

Tried that just now, same error. BTW, I installed Linuxbrew using a variation of the "Alternative Installation" instructions, like this:

git clone https://github.com/Homebrew/brew ~/linuxbrew/Homebrew
mkdir ~/linuxbrew/bin
ln -s ../Homebrew/bin/brew ~/linuxbrew/bin
eval $(~/linuxbrew/bin/brew shellenv)

The only thing I did differently from the instructions was to make the "linuxbrew" directory visible, not hidden, by omitting the "."

sjackman commented 5 years ago

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 glibc.

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.

sjackman commented 5 years ago

Try…

export HOMEBREW_GIT_PATH=$HOME/bin/git
export HOMEBREW_NO_ENV_FILTERING=1
brew config | grep Git
brew install hello

Please report the output of brew config | grep Git

findingorder commented 5 years ago
> brew config | grep Git
Git: 1.7.1 => /usr/bin/git

So brew is configured to grab the wrong git version. Any way to change the brew config?

findingorder commented 5 years ago

Using your suggested environment variables,

export HOMEBREW_GIT_PATH=$HOME/bin/git
export HOMEBREW_NO_ENV_FILTERING=1

resolves the error I reported, and allows hello to be installed. The only anomaly I see is at the very beginning:

brew install hello
/home/m24390/linuxbrew/Homebrew/brew/Library/Homebrew/brew.sh: line 61: printf: g7755635: invalid number
/home/m24390/linuxbrew/Homebrew/brew/Library/Homebrew/brew.sh: line 61: printf: g7755635: invalid number
/home/m24390/linuxbrew/Homebrew/brew/Library/Homebrew/brew.sh: line 61: printf: g7755635: invalid number
==> Installing dependencies for curl: patchelf, zlib, binutils, linux-headers, glibc, m4, gmp, mpfr, libmpc, isl@0.18, gcc, openssl and pkg-config
==> Installing curl dependency: patchelf
==> Downloading https://linuxbrew.bintray.com/bottles/patchelf-0.9_1.x86_64_linux.bottle.tar.gz
Updating Homebrew...
######################################################################## 100.0%
==> Pouring patchelf-0.9_1.x86_64_linux.bottle.tar.gz
�  /home/m24390/linuxbrew/Cellar/patchelf/0.9_1: 6 files, 1.2MB
...
sjackman commented 5 years ago

You can ignore invalid number error. Though it's annoying, it's harmless.

brew install git and it may work without needing to set these environment variables. Let me know if that works.

findingorder commented 5 years ago

For both brew install hello and brew install git, it appears to download and install, but then throws the error:

configure: error:
*** These critical programs are missing or too old: compiler
*** Check the INSTALL file for required versions.

I can provide the complete install readout if you like. So a workaround might be to clone and build whatever it means by "compiler". I searched for a file called INSTALL but couldn't find it. Can anyone tell me what "compiler" I would need to install to make brew happy?

sjackman commented 5 years ago

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 glibc. Try…

sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
sjackman commented 5 years ago

You can if you like afterward create a symlink from /home/linuxbrew/.linuxbrew to ~/linuxbrew.

findingorder commented 5 years ago

Sorry, I don't have access to /home, it's locked down. BTW,

> gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18)
sjackman commented 5 years ago

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.

findingorder commented 5 years ago

Not really an option. Big company, big IT infrastructure, centrally managed, super tight security.

sjackman commented 5 years ago

Compiling glibc from source requires GCC 4.7 or newer. Do you have access to a more recent C compiler?

findingorder commented 5 years ago

I could clone and build a more recent C compiler in my home directory. Which do you recommend? GitHub URL? Perhaps this: https://jdhao.github.io/2017/09/04/install-gcc-newer-version-on-centos/ ?

sjackman commented 5 years ago

This is a bit tricky, but you can try building GCC 4.9 from source…

brew install -s gcc@4.9
sjackman commented 5 years ago

These instructions are a bit out of date, but they may help you: https://github.com/Linuxbrew/brew/wiki/CentOS6

findingorder commented 5 years ago

Trying brew install -s gcc@4.9, I get the same compiler too old error. So I think I'll need to clone and make rather than using brew to install.

sjackman commented 5 years ago

Try…

HOMEBREW_NO_AUTO_UPDATE=1 brew install -s gcc --without-glibc
findingorder commented 5 years ago

Try…

HOMEBREW_NO_AUTO_UPDATE=1 brew install -s gcc --without-glibc
error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
their locations.  Source code for these libraries can be found at
their respective hosting sites as well as at
ftp://gcc.gnu.org/pub/gcc/infrastructure/.  See also
http://gcc.gnu.org/install/prerequisites.html for additional info.  If
you obtained GMP, MPFR and/or MPC from a vendor distribution package,
make sure that you have installed both the libraries and the header
files.  They may be located in separate packages.

Looks like I'll have to traverse the dependency tree manually. My versions, in Homebrew: gmp 6.1.2_2 mpfr 4.0.1 libmpc 1.1.0

sjackman commented 5 years ago

brew deps --include-build gcc may be helpful to you.

findingorder commented 5 years ago

brew deps --include-build gcc may be helpful to you.

binutils
glibc
gmp
isl@0.18
libmpc
linux-headers
m4
mpfr
zlib
sjackman commented 5 years ago

Try…

export HOMEBREW_NO_AUTO_UPDATE=1
brew install patchelf binutils linux-headers zlib
brew install -s gmp isl@0.18 libmpc mpfr m4
brew install -s gcc --without-glibc
brew install -s glibc
findingorder commented 5 years ago

export HOMEBREW_NO_AUTO_UPDATE=1 brew install patchelf binutils linux-headers zlib brew install -s gmp isl@0.18 libmpc mpfr m4 brew install -s gcc --without-glibc

Same error as before, error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.... It seems brew is not seeing its own versions of those libraries, which as you can see in one of my previous comments, are all greater than the versions given in the error message. I would attempt to use the --with-gmp, --with-mpfr, and --with-mpc flags as suggested in the error message, but I don't think those flags are for brew install. It would be up to brew to provide those flags to the compile/make command(s).

sjackman commented 5 years ago

I'm not entirely sure what's going on, but try…

brew remove gmp isl@0.18 libmpc mpfr m4
brew install -s gmp isl@0.18 libmpc mpfr m4
brew install -s gcc --without-glibc
sjackman commented 5 years ago

If that fails, please report the output of brew gist-logs gcc