Using Homebrew with alternate GCC

前端 未结 4 896
走了就别回头了
走了就别回头了 2020-12-04 20:47

I\'ve installed gcc-4.6 using the homebrew-alternatives gcc formula, but I can\'t seem to get it to use that GCC to install other formulas. Specifi

4条回答
  •  醉酒成梦
    2020-12-04 20:48

    Homebrew can't adapt to other versions of gcc using command line options. You can easily override the older compiler, though, if you edit the open-mpi and boost formula. For example, you can add a few commands after the "def install" in open-mpi.rb:

      def install
        # Force compilation with gcc-4.6
        ENV['CC'] = '/usr/local/bin/gcc-4.6'
        ENV['LD'] = '/usr/local/bin/gcc-4.6'
        ENV['CXX'] = '/usr/local/bin/g++-4.6'
    
        # Compiler complains about link compatibility with FORTRAN otherwise
        ENV.delete('CFLAGS')
        ENV.delete('CXXFLAGS')
    

    That worked for me on Lion. Good luck.

提交回复
热议问题