Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

Building Libraries in Tutorial

This post was from a previous version of the WRF&MPAS-A Support Forum. New replies have been disabled and if you have follow up questions related to this post, then please start a new thread from the forum home page.


New member

I am going through the "Compiling WRF" tutorial and have come to the portion where I need to build the libraries. I am using Ubuntu and have the tcsh shell up and running in the cmd, but when I go to run the following code:

cd netcdf-4.1.3
./configure --prefix=$DIR/netcdf --disable-dap
--disable-netcdf-4 --disable-shared
make install
setenv PATH $DIR/netcdf/bin:$PATH
setenv NETCDF $DIR/netcdf
cd ..

in order to set up the library, it doesn't appear to be working correctly. I get the following responses from the prompt that I don't know what to make of:

checking for library containing deflate... no
configure: error: Can't find or link to the z library. Turn off netCDF-4 and opendap with --disable-netcdf-4 --disable-dap, or see config.log for errors.

--disable-netcdf-4 --disable-shared
--disable-netcdf-4: Command not found.

make: *** No targets specified and no makefile found. Stop.

~/Desktop/Programs/Build_WRF/LIBRARIES/netcdf-4.1.3> make install
make: *** No rule to make target 'install'. Stop.
~/Desktop/Programs/Build_WRF/LIBRARIES/netcdf-4.1.3> setenv PATH $DIR/netcdf/bin:$PATH
~/Desktop/Programs/Build_WRF/LIBRARIES/netcdf-4.1.3> setenv NETCDF $DIR/netcdf
~/Desktop/Programs/Build_WRF/LIBRARIES/netcdf-4.1.3> cd ..

Any ideas on where I am going wrong? Note, I have set up the directories already using:

setenv DIR /path_to_directory/Build_WRF/LIBRARIES
setenv CC gcc
setenv CXX g++
setenv FC gfortran
setenv FCFLAGS -m64
setenv F77 gfortran
setenv FFLAGS -m64
setenv JASPERLIB $DIR/grib2/lib
setenv JASPERINC $DIR/grib2/include
setenv LDFLAGS -L$DIR/grib2/lib
setenv CPPFLAGS -I$DIR/grib2/include

Does it matter what directory you're in when you set these paths? For example, could I be in Desktop or do I have to be in the "LIBRARIES' directory when I set these paths?

Any help is greatly appreciated.

Are you attempting to run this full set of commands at one time?
cd netcdf-4.1.3
./configure --prefix=$DIR/netcdf --disable-dap --disable-netcdf-4 --disable-shared
make install
setenv PATH $DIR/netcdf/bin:$PATH
setenv NETCDF $DIR/netcdf
cd ..

These are meant to be run separately, and the "./configure...." line is all one line (as I've indicated above).

Yes. I was trying to run everything at once since the prompt appeared to keep everything in order. Anyway, I've gone back through line-by-line and now have the following issue:

1. The 'present' command returns with 'command not found' and I'm not exactly sure how to fix this. I am in the process of searching out solutions for this.
2. I am able to cd into netcdf-4.1.3 and run the line ./configure.... with no troubles. I can run 'make' as well, but when I run 'make install' it returns with:

Making install in include
make[1]: Entering directory '/home/jmaloney1985/Desktop/Programs/Build_WRF/LIBRARIES/netcdf-4.1.3/include'
make[2]: Entering directory '/home/jmaloney1985/Desktop/Programs/Build_WRF/LIBRARIES/netcdf-4.1.3/include'
make[2]: Nothing to be done for 'install-exec-am'.
test -z "/path_to_directory/Build_WRF/LIBRARIES/netcdf/include" || /usr/bin/mkdir -p "/path_to_directory/Build_WRF/LIBRARIES/netcdf/include"
/usr/bin/mkdir: cannot create directory ‘/path_to_directory’: Permission denied
make[2]: *** [Makefile:282: install-includeHEADERS] Error 1
make[2]: Leaving directory '/home/jmaloney1985/Desktop/Programs/Build_WRF/LIBRARIES/netcdf-4.1.3/include'
make[1]: *** [Makefile:396: install-am] Error 2
make[1]: Leaving directory '/home/jmaloney1985/Desktop/Programs/Build_WRF/LIBRARIES/netcdf-4.1.3/include'
make: *** [Makefile:551: install-recursive] Error 1

There are clearly errors present, but I'm unfamiliar, so I'm not sure how to rectify them.
The "present" that you are seeing is actually a continuation of the note on the line above. It's not intended to be a command.

As for the errors you are getting, unfortunately we do not support/manage NetCDF. We can only suggest how to build it. You'll need to talk to a systems administrator at your institution to see what is going wrong on your particular system.