Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting configure error installing wgrib2 on macOS

I am trying to install wgrib2 on macOS Sierra. I've followed the instructions on this blog. Here is what's happening in the terminal:

rm tmpaec.tar
cd "/usr/local/grib2/libaec-1.0.0" && export CFLAGS="-I/usr/local/grib2/include -Wall -Wmissing-prototypes -Wold-style-definition -Werror=format-security --fast-math -O3 -DGFORTRAN -fopenmp -I/usr/local/grib2/jasper-1.900.1/src/libjasper/include -I/usr/include " && ./configure --disable-shared --prefix=/usr/local/grib2 && make check install
checking build system type... x86_64-apple-darwin16.7.0
checking host system type... x86_64-apple-darwin16.7.0
checking how to print strings... printf
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/usr/local/grib2/libaec-1.0.0':
configure: error: C compiler cannot create executables
See `config.log' for more details
make: *** [/usr/local/grib2/lib/libaec.a] Error 77

and here is what I can read in the config.log:

configure:2882: gcc -V >&5
clang: error: argument to '-V' is missing (expected 1 value)
clang: error: no input files
configure:2893: $? = 1
configure:2882: gcc -qversion >&5
clang: error: unknown argument: '-qversion'
clang: error: no input files
configure:2893: $? = 1
configure:2913: checking whether the C compiler works
configure:2935: gcc -I/usr/local/grib2/include -Wall -Wmissing-prototypes -Wold-style-definition -Werror=format-security --fast-math -O3 -DGFORTRAN -fopenmp -I/usr/local/grib2/jasper-1.900.1/src/libjasper$
clang: error: unsupported option '--fast-math'
clang: error: unsupported option '-fopenmp'
clang: error: unsupported option '-fopenmp'
configure:2939: $? = 1
configure:2977: result: no
configure: failed program was:

How can I fix this problem?

like image 407
yves Avatar asked Oct 28 '22 22:10

yves


1 Answers

You're not using gcc, you're using clang, per the clang: error: lines you see.

Clang describes itself as a gcc compatible compiler, but it's not gcc. As your linked blog post notes, in the case of libaec clang can trigger build errors. The NWS Climate Prediction Center, which publishes wgrib2, has specific recommendations for if you're building wgrib2 with clang, but I haven't been able to get it to work.

The best solution is to use gcc instead. The blog post you linked to does have instructions for installing it, using homebrew:

brew install gcc

Then follow the build instructions for wgrib2:

export CC=gcc-9   # Use the version listed in `ls /usr/local/bin/gcc-*`, not clang gcc
export FC=gfortran
make

That should solve your libaec problem, and wgrib2 should compile successfully afterward.

like image 100
Brad Koch Avatar answered Nov 08 '22 18:11

Brad Koch