Local forecast by
"City, St" |
|
|
|
|
|
|
|
|
|
Degrib: UNIX / Linux Compile
Compiling (the ideal case)
The general idea is to:
- Use "/degrib/src/configure" to create several Makefile's from the Makefile.in templates
- Use "make" to then create the executables.
If you are unfamiliar with configure, you probably should start by reading
through "/degrib/src/README.config". Next, since the degrib package provides
(in "/degrib/src/") sample scripts which call configure for the major computer
platforms, you may want to look at the applicable one. If you have problems,
you may want to try "configure --help" to see what options it accepts. If you
still have problems, please contact me with the /degrib/src/config.log and
/degrib/src/config.status files.
The sample scripts located in /degrib/src/ which call configure can be broken
down as follows::
- "config-aix32.sh" : Configuration options for AIX IBM using 32 bit operating system.
- "config-aix64.sh" : Configuration options for AIX IBM using 64 bit operating system.
- "config-cyg.sh" : : Configuration options for MS-Windows using pure cygwin.
- "config-debug.sh" : Configuration options for MS-Windows using mingw and all the debug options.
- "config-linux.sh" : Configuration options for Linux 32 bit operating system.
- "config-macosx.sh" : Configuration options for Mac OS-X.
- "config-win.sh" : Configuration options for MS-Windows using mingw.
In the ideal case you choose the right configure script and do:
- ~taylor> cd ./degrib/src
- ~taylor/degrib/src> ./config-linux.sh
- ~taylor/degrib/src> make
If that worked, you can remove the temporary files by doing:
- ~taylor/degrib/src> make clean
Then click here to go to "How to Install".
What is a makefile?
A makefile is a file that contains instructions for the 'make'
program. The 'make' program follows the instructions which typically
instruct is as to how to compile a program or create a library. Typically
'make' is instructed to call a compiler ('gcc') to create object code,
and then either an archiver ('ar') to create a library from the object code,
or a linker ('ld') to create a program.
What do these makefiles do?
To understand what
"make" does, we first need to understand that the degrib program is dependent on
several libraries as follows:
- degrib (1.99) (10/23/2012)
- Author: Arthur Taylor (MDL/OST/NWS/NOAA)
- Purpose: Main Program
- Web Site: http://weather.gov/mdl/degrib/
- Depends on: emapf-c, mdl_g2c, gd, netcdf, dwmllib, (optionally Tcl/Tk)
- emapf-c (3.0) (3/23/2007)
- Author: Dr. Albion Taylor (ARL/NOAA)
- Purpose: (Library) Provides Lambert Conformal map projection capability. (This is a newer copy than the "official" one.)
- Web Site: http://www.arl.noaa.gov/HYSPLIT_cmapf.php
- mdl_g2c
- Author: Arthur Taylor (MDL/OST/NWS/NOAA)
- Purpose: (Library) Replaces the "grib2lib" library by providing API wrappers
around the g2clib library which match the original grib2lib API's.
- Depends on: libaat, g2clib
- libaat
- Author: Arthur Taylor (MDL/OST/NWS/NOAA)
- Purpose: (Library) Provides several generic utility functions.
- g2clib (1.0.5) (9/24/2007)
- jpeg2000 (1.700.5) (12/17/2003)
- libpng (1.2.5) (5/30/2003)
- zlib (1.1.4) (5/31/2003)
- gd (2.0.33) (7/12/2005)
- netcdf (3.5.1) (4/2/2004)
- dwmllib
- Purpose: (Library) Provides DWML support to degrib.
- Author: Paul Hershberg (MDL/OST/NWS/NOAA)
- Depends on: libxml
- libxml (2.6.23) (2/16/2006)
- Tcl/Tk (optional)
The makefile and configure script in /degrib/src/ are aware of the dependencies,
so it does the following:
- Configure determines setting shared by the following modules:
zlib, libpng, libaat, mdl_g2c, gd,
and degrib. This should create "Makefile" files in each directory
- For: jpeg2000, emapf-c, netcdf, and libxml,
it calls 'configure' multiple times to create "Makefile" files for each library.
- Complies zlib
- Complies libpng
- Complies jpeg2000
- Complies libaat
- Complies mdl_g2c & g2clib
- Complies gd
- Complies emapf-c
- Complies netcdf
- Complies dwmllib
- Complies libxml
- Complies degrib, degrib_DP, clock, drawshp,
tcldegrib, and tkdegrib
- Installs degrib, degrib_DP, clock, drawshp,
tcldegrib, and tkdegrib by copying them from /degrib/src/degrib/
to /degrib/bin/
What can go wrong?
You can't find the right config-???.sh flavor in "/degrib/src/".
- Solution 1: Ideally, you will find a similar sample script
file, modify it, use it, test it, and email it to me so I can release it
in the future.
- Solution 2: I may have left subdirectories called "scripts". These
would contain the original makefile.??? files. You may fine one applicable.
- Solution 3: You can cd to each library and create it using the library specific
configure (if applicable) and makefile.
- Solution 4: Some libraries are probably already on your system (most likely zlib, libpng),
so all you need is to make sure that the dependent libraries, or programs know
where to find them, by modifying their makefiles.
- Solution 5: Manually take the Makefile.in files and convert them
to Makefile files.
You don't have a C compiler.
- Solution 1: Ask your system administrator to install it.
'configure' doesn't work.
- Solution 1: 'configure' can depend on some other programs
(specifically it may use 'cat' and 'diff'). Occassionally these are
installed incorrectly. 'configure' will let you know if this is the case, in
which case you should see your system administrator.
'make' doesn't work.
- Solution 1: Ask your system administrator for help.
While it is theoretically possible to manually do the compiles, it is a lot
easier with 'make'. The main problem is that the libraries are complex,
so figuring out the right options would take a lot of effort.
'zlib' doesn't compile.
- Solution 1: Manually compile each .c file using something like:
"gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o trees.o trees.c".
Then link using:
"ar rc libz.a adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o"
- Solution 2: You can probably find a version of zlib in /usr/lib.
You should be able to copy /usr/lib/libz.a to /degrib/src/zlib.
- Solution 3: Most GRIB2 messages don't use zlib compression, so
it is theoretically possible to create degrib with zlib disabled.
It would require modifying some makefiles, which I haven't tried yet, so
please email me if you want to try.
'libpng' doesn't compile.
- Solution 1: It might not be able to find the right script in
"/degrib/src/libpng/scripts". If so, you need to go to the libpng site and
either download the right one, or ask them for help.
- Solution 2: You can probably find a version of libpng in "/usr/lib".
You should be able to copy /usr/lib/libpng.a to /degrib/src/libpng.
- Solution 3: Most GRIB2 messages don't use png compression, so
it is theoretically possible to create degrib with png disabled.
It would require modifying some makefiles, which I haven't tried yet, so
please email me if you want to try.
'emapf-c' doesn't compile.
- Solution 1: Check on "ARFLAGS". Do "echo $ARFLAGS". If it is
not "", you can try:
- cd /degrib/src/emapf-c
- configure ARFLAGS=
- make
- Solution 2: Manually compile each .c file using something like:
"gcc -O -g -O2 -c -o cc2gll.o cc2gll.c".
Then link using:
"ar r libemapf.a cc2gll.o cc2gxy.o ccurv.o cg2cll.o cgszll.o cgszxy.o cpolll.o cpolxy.o eqvlat.o logabova.o mkgeoid.o stcm1p.o stcm2p.o stlmbr.o ymercfns.o"
"ranlib libemapf.a"
'jpeg2000' doesn't compile
- Solution 1: jpeg2000 is a subset of the jasper library. Go
to the jasper web site, and try compiling the entire program.
- Solution 2: It is theoretically possible to run degrib with jpeg2000
disabled, as it could still handle NDFD data, but I don't
recommend it as NCEP generally uses jpeg2000.
'grib2lib' doesn't compile
- Solution 1: Attempt to compile without FORTRAN (by modifying
some makefiles). Email me if you want to try this.
- Solution 2: Email me for help.
'netcdf' doesn't compile
- Solution 1: degrib doesn't rely on netCDF except
as one output option, so it is theoretically possible to compile degrib
with netcdf disabled. It would require modifying some makefiles, which I
haven't tried yet, so please email me if you want to try.
'gdl' doesn't compile
- Solution 1: degrib doesn't rely on gd except
when as part of the map creation option, so it is theoretically possible to
compile degrib with libxml disabled. It would require modifying some
makefiles, which I haven't tried yet, so please email me if you want to try.
'libxml' doesn't compile
- Solution 1: degrib doesn't rely on libxml except
as part of the DWML XML generation option, so it is theoretically possible to
compile degrib with libxml disabled. It would require modifying some
makefiles, which I haven't tried yet, so please email me if you want to try.
'degrib' doesn't compile
- Solution 1: Email me for help.
'tcldegrib' couldn't find Tcl.h
- Solution 1: Skip the optional GUI part, (ie tcldegrib,
and tkdegrib), and simply copy degrib from /degrib/src/degrib
to /degrib/bin/.
- Solution 2a: You need Tcl/Tk to be installed on the system.
To find out if it is, you can try which wish or which tclsh.
Also, whereis wish sometimes helps. If you can not find it, ask your
system administrator to either install it or let you know where it is.
Source code for Tcl/Tk can be found at www.tcl.tk.
- Solution 2b: You need to find: tk.h, tcl.h, as well as where
libtcl*.a and libtk*.a are. Unfortunately I don't have any nice ways to
find them, other than the "find" command. On the hp they were in:
- /global/local/include/(tcl.h and tk.h)
- /global/local/lib/(libtcl8.0.a and libtk8.0.a)
On the Linux system they were in:
- /usr/local/tcltk/include/(tcl.h and tk.h)
- /usr/local/tcltk/lib/(libtcl8.3.a and libtk8.3.a)
- Solution 2c: You now need to let the makefiles in "/degrib/src/degrib/"
know where to find Tcl/Tk. Specifically you need to modify them with the
correct location for: "TCL_PREFIX". "Tcl.h" should be located in "$TCL_PREFIX/include".
'tcldegrib' or 'tkdegrib' couldn't find "init.tcl"
- Solution 1: Find "init.tcl", and add an environment variable for it.
Example: a pure cygwin compile of tkdegrib or tcldegrib appears to need:
"setenv TCL_LIBRARY /usr/share/tcl8.4", or
"export TCL_LIBRARY=/usr/share/tcl8.4".
Where do I go from here?
|