Skip to content

Instantly share code, notes, and snippets.

@r35krag0th
Last active June 6, 2023 02:47
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save r35krag0th/ce83baab3b7da3157b74c7838a246d45 to your computer and use it in GitHub Desktop.
Building wgrib2
#!/usr/bin/env bash
# NOTE: This requires you to have Homebrew installed
# --> https://brew.sh/
# NOTE: You need to have Homebrew's GCC installed
# --> brew install gcc
wget ftp://ftp.cpc.ncep.noaa.gov/wd51we/wgrib2/wgrib2.tgz
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"
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
wget ftp://ftp.cpc.ncep.noaa.gov/wd51we/wgrib2/wgrib2.tgz
tar xvzf wgrib2.tgz
cd grib2/
export CC=gcc
export FC=gfortran
make && make lib
ls -alh wgrib2/wgrib2
wgrib2/wgrib2 -config
@bernatp3rs
Copy link

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!

@JMSnyder1980
Copy link

There is a major flaw in the compilation code: I get an error message:

Grib.c:(.text+0x3f0): undefined reference to `aec_grib_out'

Please help me resolve.

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