Brew: gfortran compiler error - installing "control" package in octave on OS X El Capitan

Created on 24 Sep 2016  路  2Comments  路  Source: Homebrew/brew

Bug reports:

A gfortran compiler error is reported during the installation of "control" package in octave 4.0.3 in OS X El Capitan

Hereinafter the full message is reported:

pkg install -forge control

clang: warning: -lsuitesparseconfig: 'linker' input unused
clang: warning: -lmetis: 'linker' input unused
clang: warning: argument unused during compilation: '-L/Applications/Octave.app/Contents/Resources/usr/opt/suite-sparse/lib'
clang: warning: argument unused during compilation: '-L/Applications/Octave.app/Contents/Resources/usr/opt/metis/lib'
<built-in>: internal compiler error: Illegal instruction: 4

<built-in>: internal compiler error: Abort trap: 6
gfortran: internal compiler error: Abort trap: 6 (program f951)
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://github.com/Homebrew/homebrew/issues> for instructions.
make: *** [slicotlibrary.a] Error 4
make: *** Waiting for unfinished jobs....
clang: warning: argument unused during compilation: '-pthread'
tar -xzf slicot.tar.gz
/Applications/Octave.app/Contents/Resources/usr/Cellar/octave/4.0.3/bin/mkoctfile-4.0.3 __control_helper_functions__.cc
mkdir sltmp
mv slicot/src/*.f ./sltmp
mv slicot/src_aux/*.f ./sltmp
cp TG04BX.fortran ./sltmp/TG04BX.f
cp TB01ZD.fortran ./sltmp/TB01ZD.f
cd sltmp; /Applications/Octave.app/Contents/Resources/usr/Cellar/octave/4.0.3/bin/mkoctfile-4.0.3 -c *.f

pkg: error running `make' for the control package.
error: called from 'configure_make' in file /Applications/Octave.app/Contents/Resources/usr/Cellar/octave/4.0.3/share/octave/4.0.3/m/pkg/private/configure_make.m near line 96, column 9

Most helpful comment

I don't think this is a homebrew issue, but since this was the first Google hit I got when searching the error, I figured I'd write up how I resolved it:

Octave uses an internally-provided gfortran binary to compile parts of the control package, and for whatever reason, this produces an internal compiler error/illegal instruction when compiling control. (If I had to guess, I'm running El Capitan on a 2010 MacBook Pro, which is pretty old at this point, so there's a nonzero chance the bundled gfortran is compiled for a newer CPU and uses instructions that don't exist on this processor.)

This can be worked around by installing gfortran from brew:

brew install gcc

And, from inside Octave, telling it to use that binary instead via an environment variable:

setenv('F77', '/usr/local/bin/gfortran')
pkg install -forge control

To get this working I also had to upgrade my libgmp, which may be a quirk of my setup, but it's worth mentioning anyways:

brew install gmp
brew link gmp

All 2 comments

Sorry but you have not followed the requested steps on the Troubleshooting page

Please follow (all of) these steps and post the information here so we can help you with your problem.

Thanks!

I don't think this is a homebrew issue, but since this was the first Google hit I got when searching the error, I figured I'd write up how I resolved it:

Octave uses an internally-provided gfortran binary to compile parts of the control package, and for whatever reason, this produces an internal compiler error/illegal instruction when compiling control. (If I had to guess, I'm running El Capitan on a 2010 MacBook Pro, which is pretty old at this point, so there's a nonzero chance the bundled gfortran is compiled for a newer CPU and uses instructions that don't exist on this processor.)

This can be worked around by installing gfortran from brew:

brew install gcc

And, from inside Octave, telling it to use that binary instead via an environment variable:

setenv('F77', '/usr/local/bin/gfortran')
pkg install -forge control

To get this working I also had to upgrade my libgmp, which may be a quirk of my setup, but it's worth mentioning anyways:

brew install gmp
brew link gmp
Was this page helpful?
0 / 5 - 0 ratings

Related issues

JaKXz picture JaKXz  路  3Comments

JustinTArthur picture JustinTArthur  路  3Comments

vitahlin picture vitahlin  路  4Comments

mislav picture mislav  路  3Comments

cfredhart picture cfredhart  路  4Comments