2

Does anyone know how to override the default location of where Linuxbrew looks for the gcc compiler? The system that I am asking on has gcc 4.1.2 while Linuxbrew requires 4.2. I've been able to get a binary of another gcc compiler and would like to point Linuxbrew to that binary.

I added the path of the gcc compiler to my $PATH, but when trying to run a brew install formula it still refers to the /usr/bin/gcc.

I haven't been able to find the answer looking around. If has any ideas that would be helpful. Thanks,

TinyHeero
  • 580
  • 1
  • 4
  • 18
  • Have you *added* it to your $PATH or *prepended* it? Also try setting `CC=/path/to/gcc CXX=/path/to/g++ LD=/path/to/ld`. – n. m. could be an AI Apr 27 '14 at 07:15
  • I prepended the path of the GCC compiler to the $PATH env variable. I tried setting the CC, CXX, and LD and it doesn't work unfortunately.. – TinyHeero Apr 27 '14 at 21:02

1 Answers1

3

Original answer:

brew install some_package --cc=your_desired_cc

Complete answer based on comments:

export PATH=<path-to-desired-cc>:$PATH
brew install <some_package> --cc=gcc
Tom Barron
  • 1,554
  • 18
  • 23
bainikolaus
  • 141
  • 1
  • 4
  • 2
    I don't understand how it works, but I first had to make my version of gcc to be found with `which` command. Then I set `--cc=gcc`, and NOT the full path to my `gcc`. – biocyberman Dec 30 '14 at 00:03
  • 1
    Thanks for this comment. This worked for me too. It's strange how setting it to the full path doesn't work. – TinyHeero Jan 09 '15 at 23:49
  • Answer edited to reflect the info in the comments; edit may not be visible until it gets peer reviewed. – Tom Barron Jul 29 '16 at 14:55