This repository has been archived by the owner. It is now read-only.

Unable to bootstrap gcc #137

Closed
oneillkza opened this Issue Sep 25, 2014 · 51 comments

Comments

Projects
None yet
@oneillkza

oneillkza commented Sep 25, 2014

I'm trying to install linuxbrew on a machine running CentOS 6.5, which means that it has extremely outdated packages, such that linuxbrew does not want to use the system-installed gcc. I have no systems rights on the machine, so cannot upgrade these myself.

The suggested solution by linuxbrew is:

To install this formula, you may need to:
  brew install gcc

However, when I run brew install gcc, the following happens:

==> Installing dependencies for gcc: gmp, mpfr, libmpc, pkg-config, isl, 
==> Installing gcc dependency: gmp
Error: gmp cannot be built with any available compilers.
 To install this formula, you may need to:
  brew install gcc
@sjackman

This comment has been minimized.

Member

sjackman commented Sep 25, 2014

This might be resolved by 3353c34. Can you run brew update and try again?

@sjackman

This comment has been minimized.

Member

sjackman commented Sep 25, 2014

Are you using HOMEBREW_CC or --cc?

@sjackman

This comment has been minimized.

Member

sjackman commented Sep 25, 2014

Try

prefix=~/.linuxbrew
ln -s /usr/bin/gcc44 $prefix/bin/gcc-4.4
ln -s /usr/bin/g++44 $prefix/bin/g++-4.4
ln -s /usr/bin/gfortran44 $prefix/bin/gfortran-4.4
export HOMEBREW_CC=gcc-4.4
brew install hello && brew test -v hello; brew remove hello

See here:
https://github.com/Homebrew/linuxbrew/wiki/Standalone-Installation#use-a-compiler-other-than-gcc

@oneillkza

This comment has been minimized.

oneillkza commented Sep 25, 2014

Definitely not the update -- I downloaded and updated about half an hour ago, and when I re-ran update now it said it was already up to date.

Running your hello code (using the steps avoe), I get:

Error: The Homebrew GCC was not installed.
You must:
  brew install gcc
Error: No such keg: /home/koneill/.linuxbrew/Cellar/hello
@oneillkza

This comment has been minimized.

oneillkza commented Sep 25, 2014

Ah hang on, those symlinks don't look right.

@oneillkza

This comment has been minimized.

oneillkza commented Sep 25, 2014

Yeah, it looks like there's no gcc44 in/usr/bin

Symlinking to /usr/bin/gcc etc seems to work. Will this cause issues in future, though?

ln -s /usr/bin/gcc gcc-4.4 $prefix/bin/gcc-4.4
@oneillkza

This comment has been minimized.

oneillkza commented Sep 25, 2014

Yep that worked completely -- I was able to bootstrap gcc 4.9.

I guess shared.rb will need a little more tweaking to account for this particular case.

@sjackman

This comment has been minimized.

Member

sjackman commented Sep 25, 2014

Can you report the output of the following?

ls -l /usr/bin/cc* /usr/bin/gcc*
cc --version
gcc --version

@sjackman sjackman self-assigned this Sep 25, 2014

@sjackman sjackman added build-error bug and removed build-error labels Sep 25, 2014

@oneillkza

This comment has been minimized.

oneillkza commented Sep 26, 2014

[koneill@klesack01-centos Aly_meetings]$ ls -l /usr/bin/cc* /usr/bin/gcc*
lrwxrwxrwx. 1 root root      3 Jan 29  2014 /usr/bin/cc -> gcc
-rwxr-xr-x  1 root root  50216 Sep 23  2011 /usr/bin/ccache-swig
-rwxr-xr-x  2 root root 268224 Nov 21  2013 /usr/bin/gcc
[koneill@klesack01-centos Aly_meetings]$ cc --version
cc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[koneill@klesack01-centos Aly_meetings]$ gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

@oneillkza

This comment has been minimized.

oneillkza commented Sep 26, 2014

Basically there is only a gcc executable, and no version-specific executable name.

@sjackman

This comment has been minimized.

Member

sjackman commented Sep 26, 2014

That's fine.

prefix=~/.linuxbrew
ln -s /usr/bin/gcc $prefix/bin/gcc-4.4
ln -s /usr/bin/g++ $prefix/bin/g++-4.4
ln -s /usr/bin/gfortran $prefix/bin/gfortran-4.4
export HOMEBREW_CC=gcc-4.4
brew install hello && brew test -v hello; brew remove hello
@oneillkza

This comment has been minimized.

oneillkza commented Sep 26, 2014

Yes, that's what I did. I'm busy testing the complete procedure as listed at https://github.com/Homebrew/linuxbrew/wiki/Standalone-Installation

It's running fairly smoothly so far. I think my problem was that I jumped straight to trying to compile gcc without completing the other steps. I'll post again to close if this is sorted.

@oneillkza

This comment has been minimized.

oneillkza commented Sep 26, 2014

Yeah, I just needed to go back to the TL;DR steps and run through them (after correctly symlinking gcc and g++) . So basically this issue is resolved, although as I said before it may be a good idea to include this as a case in shared.rb (basically a modification on this : 3353c34)

Now, if I can just figure out how to get Mendeley in a cask and using the up-to-date linuxbrew libraries, I'll become very, very happy.

@oneillkza oneillkza closed this Sep 26, 2014

@sjackman

This comment has been minimized.

Member

sjackman commented Sep 26, 2014

brew cask install https://raw.githubusercontent.com/sjackman/homebrew-cask/mendeley/Casks/mendeley.rb

@sjackman

This comment has been minimized.

Member

sjackman commented Sep 26, 2014

@oneillkza

This comment has been minimized.

oneillkza commented Sep 27, 2014

[koneill@klesack01-centos lib]$ brew cask install https://raw.githubusercontent.com/sjackman/homebrew-cask/mendeley/Casks/mendeley.rb
Error: No available formula for brew-cask 
[koneill@klesack01-centos lib]$ brew install brew-cask
Error: No available formula for brew-cask 

I think the cask functionality hasn't been ported over? I did run brew update first.

@sjackman

This comment has been minimized.

Member

sjackman commented Sep 27, 2014

Sorry, I misunderstood. brew cask is not available for Linuxbrew. Sorry to get your hopes up.

@matope

This comment has been minimized.

Contributor

matope commented Sep 30, 2014

Hi, I hit this problem and it has been solved by your snippet.
#137 (comment)

Below snippet doesn't solve as /usr/bin/{gcc44,g++44,gfortran44} not found in my system.
https://github.com/Homebrew/linuxbrew/wiki/Standalone-Installation#use-a-compiler-other-than-gcc

@sjackman

This comment has been minimized.

Member

sjackman commented Sep 30, 2014

Try this instead:

ln -s `which gcc` ~/.linuxbrew/bin/gcc-`gcc -dumpversion |cut -d. -f1,2`
ln -s `which g++` ~/.linuxbrew/bin/g++-`g++ -dumpversion |cut -d. -f1,2`
ln -s `which gfortran` ~/.linuxbrew/bin/gfortran-`gfortran -dumpversion |cut -d. -f1,2`
@matope

This comment has been minimized.

Contributor

matope commented Oct 1, 2014

Thanks! It goes well in my CentOS 6.5.

@matope

This comment has been minimized.

Contributor

matope commented Oct 11, 2014

@sjackman Don't you include this trick into the omnibus installer?
(https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)
I originally wanted to make such a patch, but I couldn't find where the source code is.

@sjackman

This comment has been minimized.

Member

sjackman commented Oct 11, 2014

Yes, that's a good idea, but I think I'll instead put it somewhere in the Ruby code, probably where it looks for the default compiler, so as to support installs via a simple git clone.

The code for install is in the branch go.

@matope

This comment has been minimized.

Contributor

matope commented Oct 12, 2014

That sounds better way. So, I'm looking forwrad to the implementation as I'm not good at Ruby:)

@tseemann

This comment has been minimized.

Contributor

tseemann commented May 30, 2015

I just got burnt with this exact same issue when I decided to start from scratch after screwing up my existing Linuxbrew install. However I did not have to do this bootstrap the first time around? Has something changed since Feb 2015?

@wenerme

This comment has been minimized.

Contributor

wenerme commented Jun 2, 2015

After ls, I can install hello, but test not good

# brew -v test hello
Homebrew 0.9.5
Error: cannot load such file -- minitest/unit
Please report this bug:
    https://github.com/Homebrew/linuxbrew/blob/master/share/doc/homebrew/Troubleshooting.md#troubleshooting
/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/share/ruby/test/unit/assertions.rb:1:in `<top (required)>'
/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
/home/wener/.linuxbrew/Library/Homebrew/formula_assertions.rb:7:in `rescue in <module:Assertions>'
/home/wener/.linuxbrew/Library/Homebrew/formula_assertions.rb:4:in `<module:Assertions>'
/home/wener/.linuxbrew/Library/Homebrew/formula_assertions.rb:2:in `<module:Homebrew>'
/home/wener/.linuxbrew/Library/Homebrew/formula_assertions.rb:1:in `<top (required)>'
/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
/home/wener/.linuxbrew/Library/Homebrew/cmd/test.rb:2:in `<top (required)>'
/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
/home/wener/.linuxbrew/Library/brew.rb:58:in `require?'
/home/wener/.linuxbrew/Library/brew.rb:122:in `<main>'
@sjackman

This comment has been minimized.

Member

sjackman commented Jun 2, 2015

Please report ruby --version. This minitest issue has come up before. See #314

@wenerme

This comment has been minimized.

Contributor

wenerme commented Jun 3, 2015

ruby --version
ruby 2.0.0p598 (2014-11-13) [x86_64-linux]
@tseemann

This comment has been minimized.

Contributor

tseemann commented Jun 3, 2015

@wenerme I got the same problem. As #314 says, just use the Brew version of ruby: brew install ruby.

@wenerme

This comment has been minimized.

Contributor

wenerme commented Jun 11, 2015

Thanks @tseemann , the test pass now

@architectcodes

This comment has been minimized.

architectcodes commented Jun 20, 2015

#137 (comment) fails for me with gcc 5.1brew doesn’t seem to recognize the gcc-5.1 symlink as gcc:

$ brew install gcc
==> Installing dependencies for gcc: gmp, mpfr, libmpc, isl
==> Installing gcc dependency: gmp
Error: gmp cannot be built with any available compilers.
To install this formula, you may need to:
  brew install gcc

Here’s what seems to do the job – but I can’t help feeling it’s a hack:

$ ln -s $(which gcc) ~/.linuxbrew/bin/gcc-4.4
$ ln -s $(which g++) ~/.linuxbrew/bin/g++-4.4
$ brew install gcc g++

It needs time to compile – I’ll let you know as soon as I know the results.

@architectcodes

This comment has been minimized.

architectcodes commented Jun 20, 2015

Hmm, that’s a nope:

==> Installing gcc
#
==> make bootstrap
Makefile:20663: recipe for target 'stage3-bubble' failed
make[1]: *** [stage3-bubble] Error 2
make[1]: Leaving directory '/tmp/gcc20150620-26406-gm4c73/gcc-5.1.0/build'
Makefile:20726: recipe for target 'bootstrap' failed
make: *** [bootstrap] Error 2

READ THIS:
#
@DoomHammer

This comment has been minimized.

Contributor

DoomHammer commented Jun 21, 2015

Try perhaps ln -s $(which gcc) ~/.linuxbrew/bin/gcc-5 and ln -s $(which g++) ~/.linuxbrew/bin/g++-5

@paulhybryant

This comment has been minimized.

Contributor

paulhybryant commented Jun 23, 2015

My gcc installation also failed at Make bootstrap but for different reason.

gist logs here https://gist.github.com/anonymous/c7ac66274508a6525b8d

In short the error seems to be that it cannot find the shared library libisl.so.13
However, I can see isl installed with brew and it is available at
~/.linuxbrew/lib/

@paulhybryant

This comment has been minimized.

Contributor

paulhybryant commented Jun 23, 2015

OK I think my case is different from the above. The problem with my issue is ldconfig

ldconfig would report the following error:

ldconfig: Warning: ignoring configuration file that cannot be opened: $HOME/.linuxbrew/Cellar/glibc/2.19/etc/ld.so.conf: No such file or directory

I see that ld.so.cache symlinked to ld.so.cache in the same folder, but there is no ld.so.conf file.
Is this a bug?

@sjackman

This comment has been minimized.

Member

sjackman commented Jun 23, 2015

Linuxbrew does not use ld.so.conf. It uses rpath instead. Using ld.so.conf makes a lot of sense though, I think. In any case, it's not necessary, and you can ignore the ldconfig warning.

@sjackman

This comment has been minimized.

Member

sjackman commented Jun 23, 2015

https://gist.githubusercontent.com/anonymous/c7ac66274508a6525b8d/raw/02.make

make[3]: Leaving directory `/tmp/gcc20150622-5108-1qwsx8g/gcc-5.1.0/build/gcc'
mkdir -p -- x86_64-unknown-linux-gnu/libgcc
Checking multilib configuration for libgcc...
Configuring stage 2 in x86_64-unknown-linux-gnu/libgcc
…
checking for suffix of object files... configure: error: in `/tmp/gcc20150622-5108-1qwsx8g/gcc-5.1.0/build/x86_64-unknown-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[2]: *** [configure-stage2-target-libgcc] Error 1

Can you gist the appropriate config.log? There's more than one. The one with the most recent time stamp.

@diegocaro

This comment has been minimized.

diegocaro commented Jun 24, 2015

+1, I cant compile gcc (5.1). It seems to be related with a zlib dependency (not installed by default in most linux distros, but already installed in os x).
I tried installing zlib, but it fails after the bootstrap stage.

@sjackman

This comment has been minimized.

Member

sjackman commented Jun 24, 2015

@diegocaro Try brew install homebrew/dupes/zlib gcc

@kim612

This comment has been minimized.

kim612 commented Aug 12, 2015

In my case (CentOS 5.11 with gcc44),

prefix=~/.linuxbrew
ln -s /usr/bin/gcc44 $prefix/bin/gcc-4.4
ln -s /usr/bin/g++44 $prefix/bin/g++-4.4
ln -s /usr/bin/gfortran44 $prefix/bin/gfortran-4.4
export HOMEBREW_CC=gcc-4.4
brew install hello

Error: Homebrew GCC requested, but formula gcc44 not found!

unset HOMEBREW_CC
brew install hello 
(no error)
@sjackman

This comment has been minimized.

Member

sjackman commented Aug 13, 2015

Can you try

brew install hello --cc=gcc-4.4

and also

brew tap homebrew/versions
HOMEBREW_CC=gcc-4.4 brew install hello
@jorgebg

This comment has been minimized.

jorgebg commented Aug 25, 2015

This worked for me (CentOS):

brew install gcc --cc=gcc 
@dakl

This comment has been minimized.

dakl commented Sep 1, 2015

To get symlinking to work I've had to

prefix=~/.linuxbrew
ln -s /usr/bin/gcc $prefix/bin/gcc-4.4
ln -s /usr/bin/g++ $prefix/bin/g++-4.4
ln -s /usr/bin/gfortran $prefix/bin/gfortran-4.4
export HOMEBREW_CC=gcc-4.4
brew tap homebrew/versions
brew install hello && brew test -v hello; brew remove hello

brew tap homebrew/versions seems to be needed in there. The I don't have to use --cc=gcc at all it seems like.

@Scapadiver

This comment has been minimized.

Scapadiver commented Oct 13, 2015

@jorgebg's solution worked for me also - centos

@sjackman

This comment has been minimized.

Member

sjackman commented Oct 13, 2015

@jorgebg wrote…

brew install gcc --cc=gcc

And it doesn't work without --cc=gcc? That's odd. Thanks for the feedback.

@prologic

This comment has been minimized.

Contributor

prologic commented Oct 16, 2015

Disregard last comment (deleted) -- If you have modified changes in the git tree you'll cause problems with bew :)

@prologic

This comment has been minimized.

Contributor

prologic commented Oct 16, 2015

Actually I'm having a lot of trouble getting Homebrewed linux gcc bootstrapped.

  1. sudo yum groupinstall 'Development Tools'
  2. brew install gcc --cc=gcc
$ brew install gcc --cc=gcc
==> Installing dependencies for gcc: mpfr, libmpc, isl
==> Installing gcc dependency: mpfr
Error: /home/prologic/.linuxbrew/opt/xz not present or broken
Please reinstall xz. Sorry :(

Okay so let's install xz first:

$ brew install xz --cc=gcc
==> Downloading https://fossies.org/linux/misc/xz-5.2.2.tar.gz
Already downloaded: /home/prologic/.cache/Homebrew/xz-5.2.2.tar.gz
==> ./configure --disable-silent-rules --prefix=/home/prologic/.linuxbrew/Cellar/xz/5.2.2
==> make install
Error: No such file or directory - (unreachable)/

I've also tried and have in place @dakl's snippet which doesn't seem to help because tapping homebrew/versions yields:

$ brew tap homebrew/versions
==> Tapping homebrew/versions
fatal: Could not change back to '(unreachable)/': No such file or directory
Error: Failure while executing: git clone https://github.com/Homebrew/homebrew-versions /home/prologic/.linuxbrew/Library/Taps/homebrew/homebrew-versions --depth=1
@sjackman

This comment has been minimized.

Member

sjackman commented Oct 16, 2015

That's a strange error message Error: No such file or directory - (unreachable)/. I've not seen that before. Does brew install hello work?

@prologic

This comment has been minimized.

Contributor

prologic commented Oct 16, 2015

Nope :/

@sjackman

This comment has been minimized.

Member

sjackman commented Oct 17, 2015

Moved this discussion to #608.

@r41d

This comment has been minimized.

r41d commented Aug 1, 2017

I tried to use linuxbrew on a Gentoo server and my error looked like this:

==> Installing dependencies for ncdu: pkg-config, gpatch, ncurses
==> Installing ncdu dependency: pkg-config
gcc-config: error: could not run/locate 'gcc-5'
Error: pkg-config cannot be built with any available compilers.
Install Clang or brew install gcc

For me the command brew link --overwrite gcc did the trick and created all necessary symlinks so everything would work.

@Linuxbrew Linuxbrew locked and limited conversation to collaborators Aug 1, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.