Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Building wgrib2
#!/usr/bin/env bash
# NOTE: This requires you to have Homebrew installed
# -->
# NOTE: You need to have Homebrew's GCC installed
# --> brew install gcc
tar xvzf wgrib2.tgz
cd grib2/
# NOTE: gfortran is provided by the GCC homebrew formula
export CC=$(brew --prefix gcc)/bin/gcc-8
export FC=$(brew --prefix gcc)/bin/gfortran
echo -e "\033[32m==> \033[0mRunning MAKE"
echo ""
echo -e "\033[32m==> \033[0mRunning MAKE LIB"
make lib
# Tested and Working on Ubuntu 14.04 and 18.04
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install gfortran build-essential
tar xvzf wgrib2.tgz
cd grib2/
export CC=gcc
export FC=gfortran
make && make lib
ls -alh wgrib2/wgrib2
wgrib2/wgrib2 -config

This comment has been minimized.

Copy link

@bernatp3rs bernatp3rs commented Feb 3, 2021

The make fails in the mac OS version. A couple of things need to be fixed:

  1. edit the makefile, set OpenMP to 0, line 145
    USE_OPENMP = 0 # 1
  2. Add the following line between lines 409 and 410
    FTN_LEGACY : = "-std = legacy -Wno-argument-mismatch"

Thank you!

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