[The latest version of this document can be found at http://www.ncl.ucar.edu/Download/build_from_src.shtml]
This document is meant to be an all-encompassing document on how to set up your environment to build NCL and NCAR Graphics, what external software packages you need and which are optional, and finally how to build and test NCL and NCAR Graphics. It's a bit long, but that's partially due to the itstructions on building external packages, and instructions on building on unsupported platforms. Take a deep breath before you proceed!
Note on building NCAR Graphics only:You do have the option during the build process to indicate you do not want to build NCL, effectively building just NCAR Graphics. This simplifies the build somewhat, since you can get by with not having to install most, if any, of the external software packages listed below.
If you are already familiar with building NCAR Graphics from source code, then all the instructions you know from before are the same. The one difference is that when you run "./Configure", be sure to answer "no" when it asks whether you want to build NCL.
This is a new venture for us, so please email ncl-talk@ucar.edu if you have any problems understanding this document or building any of this software.
Note that in the instructions below, "NCL" will sometimes be used to mean both NCL and NCAR Graphics. If something is for NCAR Graphics only, we try to indicate this.
You need a Fortran 77 or 90 compiler and an ANSI C compiler to build NCL. If your system has native Fortran and C compilers (for example "xlf" on IBM/AIX systems), we recommend using these. In addition to native compilers, NCL has been successfully built with a wide-range of compilers including gcc, g77, gfortran, g95, Intel Fortran and C, Portland Group.
Test that your Fortran compiler does blockdata initializations correctly
The NCL code depends heavily on Fortran blockdata variables being initialized correctly. We have found that some Fortran compilers don't handle blockdata initializations correctly, and hence can't be used to build NCL.
To test if your Fortran compiler handles blockdata initializations correctly, download the small blockdata_test.tar tar file, and untar it with:
tar -xvf blockdata_test.tarCd to "blockdata_test" and edit the "Makefile" to change "g77" to whatever compiler you are using. Then, type:
make main.good main.bad main.init ./main.good ./main.init ./main.badIf the "main.bad" and "main.init" programs give you the output:
TESTSUB: WK = 0...it should be 20then your compiler doesn't handle blockdata initializations correctly, and you won't be able to use this Fortran compiler to build NCL.
If "main.init" gives you the correct output, but "main.bad" doesn't, then you will be able to use this compiler, but you will need to include the special options "-ncarbd" and "-ngmathbd" if you compile an NCAR Graphics or HLU C or Fortran program using "ncargf77", "ncargf90", "ncargcc", "nhlf77", "nhlf90", and/or "nhlcc".
Install X11 libraries and include files needed
In order to build some of the X applications that are part of NCL (like idt), you must have some of the X11 libraries installed on your system. At a minimum, you should have the following libraries (and associated include files) installed on your system: X11, Xaw, Xext, Xm, Xmu, Xt.
These libraries are usually installed as part of an X developer's package, and will reside in a directory like /usr/X11R6/lib.
The software listed below is not optional if you plan to build NCL. If you are building NCAR Graphics only, then you need to build and install HDF-4 only if you need HDF support.
Once you download and install any external software to use with NCL, you must comply with the license of that software, regardless of what NCL's license is.
Note: it makes things easier if you install all of the external software needed (with the exception of the X11 libraries and X11 include files) to the same parent directory. This will be important later when you have to tell the NCL build system where all the external software has been installed. We will use /usr/local in all of our examples below for installing external software.
If you want to build NCAR Graphics only, then you only need to build and install HDF 4, and even this is optional unless you need HDF support in ctrans, ictrans, and idt.
Download version 3.6.1 or later. (Do not download version 4.x.x.)
Once you have the netCDF source code, you can build and install it with:
./configure --prefix=/usr/local make all install
Download version 6b or later.
Once you have the jpeg source code, you can build and install it with:
./configure --prefix=/usr/local make all install install-lib install-headers
Download version 1.2.3 or later.
Once you have the zlib source code, you can build and install it with:
./configure --prefix=/usr/local make all install
Once you have the HDF source code, set the environment variable CFLAGS to -DHAVE_NETCDF. For example:
export CFLAGS=-DHAVE_NETCDFor
setenv CFLAGS -DHAVE_NETCDFYou can then build and install HDF-4 with:
./configure --prefix=/usr/local --with-zlib=/usr/local \
--with-jpeg=/usr/local --includedir=/usr/local/include/hdf
make all install
The paths used for the "--with-zlib" and "--with-jpeg" options must be
set to whatever you used above for these two software packages.
Normally the HDF include files would get installed to /usr/local/include. Since this will cause some netCDF include files to get overwritten, you must use the "--includedir" option to install the HDF include files to an "hdf" subdirectory.
None of this software is needed if you are only building NCAR Graphics.
Again, as with the above section, it makes things easier if you install all of the external software needed to the same parent directory. We will use /usr/local in all of our examples below for installing external software.
GRIB2 software - not needed if you are only doing an NCAR Graphics build.
If you need support for reading GRIB2 files, then you will need to download and install the following packages:
Once you have the Jasper source code, you can build and install it with:
./configure --prefix=/usr/local make all install
Once you have the g2clib source code and the modified file, make changes to "makefile" to:
Now type:
make all install cp libgrib2c.a /usr/local/lib cp grib2.h" /usr/local/include
HDF-EOS 2 software - not needed if you are only doing an NCAR Graphics build.
If you need support for reading HDF-EOS 2 files, then you will need to download and install the following packages:
bin/INSTALL-HDFEOS
Answer questions about location of HDF-4 lib and include files. You must include "hdf" subdir for include directory (for example, "/usr/local/include/hdf").
Pay attention to where "libhdfeos.a" file gets installed under the hdfeos/lib directory, and move this file to where you are installing other libraries. Do not move libGctp.a! Cd to ../../include and copy all of the files there to the approriate include (/usr/local/include) directory.
cd gctp/srcCopy appropriate makexxxx file to "makefile", edit as necessary, and be sure to change LIBDIR appropriately (/usr/local/lib). Then type:
make all install
If you need support for reading/writing classic NetCDF-4 files, then you will need to download and install the following packages:
./configure --prefix=/usr/local --disable-shared make all install >& make-output
./configure --with-szlib=/usr/local --prefix=/usr/local --disable-shared make all install >& make-output
./configure --with-hdf5=/usr/local --prefix=/usr/local --disable-f90 \
--enable-netcdf4
make all install >& make-output
Triangle software - not needed if you are only doing an NCAR Graphics build.
If you need to use the Triangle code (for generating triangular meshes that you can contour), then you will need to download the source code, and copy over only the files "triangle.c" and "triangle.h" to the $NCL/ni/src/lib/hlu directory in the NCL source tree (you may not have downloaded the NCL source code yet, so wait until you get to this part to copy over the two files).
Note that Triangle has a more restrictive license than NCL's license which disallows you from selling any source code or product that contains Triangle. If you build NCL with Triangle included, you will be bound by Triangle's license.
OPeNDAP software - not needed if you are only doing an NCAR Graphics build.
If you need OPeNDAP support built into NCL for accessing remote data, then you'll need to download and install the following packages. OPeNDAP requires SSL (Secure Sockets Layer) libraries, which may or may not already be installed on your host.
Download version 0.9.8e or later. Once you have the source code, you can build and install it with:
./config --prefix=/usr/local make all install >& make-outputThis will determine your host and default compiler, and configure Open SSL properly.
Download version 7.16.4 or later. Once you have the source code, you can build and install it with:
./configure --prefix=/usr/local --with-zlib=/usr/local --with-pic make all install >& make-outputNote that you'll need to build and install the zlib software first.
Download version 2.6.27 or later. Once you have the source code, you can build and install it with:
./configure --prefix=/usr/local --with-zlib=/usr/local --with-pic make all install >& make-output
Download version 3.7.7 or later. Once you have the source code, you can build and install it with:
./configure --prefix=/usr/local --with-zlib=/usr/local --with-pic make all install >& make-output
Download version 3.7.0 or later. Once you have the source code, you can build and install it with:
./configure --prefix=/usr/local --enable-64bit --with-pic make all install >& make-output
Note that libnc-dap is only compatible with netCDF-3.
Udunits - not needed if you are only doing an NCAR Graphics build.
If you need the conversion functions ut_calendar and ut_inv_calendar, then you need to install Udunits.
Download the Udunits source code. Once you have the source code, you can build and install it with:
./configure --prefix=/usr/local make all install >& make-outputVis5D+ software - not needed if you are only doing an NCAR Graphics build.
If you need to use any of the v5d_xxx functions (see the "V" section of the NCL function list), then you need to install Vis5d+.
Download the vis5d+ source code. Once you have the source code, you can build and install it with:
./configure --prefix=/usr/local --with-netcdf=/usr/local/lib/libnetcdf.a make all install >& make-output
To download the NCL source code, follow the instructions at the URL:
http://www.ncl.ucar.edu/Download/The NCL source code you download will be a single compressed tar file (we'll call it "ncl_ncarg_src-5.0.0.tar.gz"). Move the "ncl_ncarg_src-5.0.0.tar.gz" file to a temporary directory where you have plenty of disk space (around 250 megabytes to hold all of the source code, object files, binaries, and so on). Then, uncompress and untar the file as follows:
gunzip ncl_ncarg_src-5.0.0.tar.gz tar -xvf ncl_ncarg_src-5.0.0.tarThe above steps will create a directory called "ncl_ncarg-5.0.0". For convenience, we'll use the notation $NCARG to mean the top level of the NCL/NCAR Graphics source tree. Set the environment variable NCARG to the full path of this directory. For example, if you untarred the files from the directory /usr/local/src, then you would do the following:
setenv NCARG /usr/local/src/ncl_ncarg-5.0.0or
export NCARG=/usr/local/src/ncl_ncarg-5.0.0
Before you try to build NCL, you need to quickly check if your system will be recognized by the NCL build environment. Type:
cd $NCARG/config ./ymake
If no output is echoed to the screen, then go to the next section on getting your configuration file name. Otherwise, go to Appendix A for information on modifying your system configuration files so they recognize your system.
If no output is echoed to the screen, then this most likely means that the NCL build environment recognizes your system. You can then get the name of your configuration file by typing (in the same directory):
grep SYSTEM_INCLUDE MakefileThis should echo something like:
SYSTEM_INCLUDE = "Darwin"which means "Darwin" is the name of the configuration file it will use in the $NCARG/config directory.
Once you've run "./Configure" and it successfully recognizes your system, you can type:
cd $NCARGto make sure your configuration is set up properly. The "make Info" command will report the installation directories, what C and Fortran compilers are being used, and what options to the compilers are being set. The name of the system configuration file being used will also appear on the line that starts with "System File".
make Info
If you need to change the compilers or the options used, then modify the file "$NCARG/config/system_file", where system_file is the system configuration file being used. See the "README" file in that directory for a description of some of the available configuration files.
When modifying your configuration file, you may want to pay particular attention to how the following macros are being set:
CCompiler
FCompiler
ExtraSysLibraries
CtoFLibraries
CcOptions
FcOptions
NgCallF
and change them as desired. If you don't see these macros being defined in your system configuration file, then that means that the default value, which is defined in the $NCARG/config/Template file, is being used. To change the default, just add it to your system configuration file with the new value.
For example, on Sun systems, the default "f77" compiler is used. If you want to change this to "g77", then modify the file $NCARG/config/Sun4Solaris, and add the line:
#define FCompiler g77along with the other macro definitions.
In order to build NCL from source, you must have a Fortran 77 or 90 compiler and an ANSI C compiler.
Here are the general steps for building NCL from source:
Before you build and install NCL, you need to run a script called "Configure" to answer several questions about where you want the software installed, what optional software you want to include, and the location of the optional software.
Enter the following commands to run this script (you must be running csh):
cd $NCARG ./Configure -vIf Configure doesn't recognize your system, it will quit right away with an error message. Otherwise, it will start asking you several questions.
If it quits with an error message that indicates it doesn't recognize your system, then read and follow the instructions in the section on testing if your system is recognized by the NCL build environment before running Configure again.
If Configure does recognize your system, then answer all of the questions about where you want the software installed, whether you want to use a Fortran 90 compiler, whether you want X11 support and/or HDF support, and so on.
Once you have finished running Configure, you should get a message indicating that the configuration process is complete, and that you can start building and installing the software. First verify that you have the correct compilers, options, and paths by typing:
make InfoIf everything looks okay, then you can skip the next few sections and go directly to "Start the build and install process."
If the installation paths look wrong, then rerun Configure and reenter the installation paths.
If something else looks wrong, like the name of the compilers or the compiler options listed, then go to the section "Modify system configuration file to change default values."
The configuration file for AIX is called "AIX_RS6000". If you are building on an AIX system in 32-bit mode, then you need to edit this file and change the appropriate options. See "AIX_RS6000.32" for a sample.
You can also setenv the OBJECT_MODE environment variable to 64 or 32, and this will build in that precision without having to set any compiler options.
The configuration file for SGI/IRIX is called "SGI_IRIX". If you are building on an IRIX system in 32-bit mode, then you need to edit this file and change the appropriate options. See "SGI_IRIX.n32" for a sample.
Special note for Linux systems
The default configuration file for Linux is "LINUX". You need to edit this file for i386, i686, and x86_64 systems. There are several LINUX.xxxx sample configuration files to help you modify this file for your purpose. Also, see the "README" file in the "config" directory for more information. Special note for MacOSX systems
To build NCL on an MacOSX system, you must first install a few supplemental packages:
If you have a "/Developers/Tools" directory, cd to that directory and search for a PDF file that will contain instructions on how to install the Developer's Tools.
Also, the developer's tools may be on a CD that you received with your Mac.
If you don't have the directory or the CD, you can get the Developer's Tools from the http://connect.apple.com site. (You may need to create an account with them first.) Once you are logged in, click on "Download Software", and then "Mac OS X". You should then see a link for downloading the Developer's Tools.
Fink is a must-have application for MacOSX users. In the words of the fink developers, fink "makes existing Open Source software easily available to casual users as a coherent, comfortable distribution that matches what Linux users are used to". (In this case, fink will be used to install the next required package, g77.)
To install fink, go to:
http://fink.sourceforge.netand click on "Download" on the left. Follow the instructions under "Quick Start". Basically, you just download the binary installer that they have a link to, and then click on the resultant "Fink-x.x.x-Installer.dmg" file that should have appeared on your Mac desktop window. Follow the rest of the instructions to make sure your fink environment is set up correctly.
Be sure to run:
fink selfupdate-cvs
to make sure all of the packages are up to date.
If you don't have a Fortran 77 compiler, then you can use "fink" to install a free one. Type:
fink install g77
This takes awhile, so grab some lunch or see a movie.
An X11 server will enable you to display NCL graphical output to your screen. We recommend that you install Apple's X11 server, which you can obtain from:
http://www.apple.com/macosx/features/x11/If you end up installing "xfree86" instead of Apple's X11 server, then be sure to run:
fink install system-xfree86
so fink will know about it.
cd $NCARGBe patient; this can take from thirty minutes to a few hours depending on your machine and its current load. During the installation, you may examine the contents of the make-output file with the command:
make Everything >& make-output &
tail -f make-outputIf you encounter errors during the build process, you can restart without losing any of the work already accomplished. Refer to the section "Restarting the installation" for details about recovering from errors that occur during installation.
If it looks like not all the files were installed, then take a look at the make-output file, and check for words like "fatal" or "error". Don't worry too much about warnings, unless they are followed by errors.
If you find an error, try to determine the nature of the error, make any necessary adjustments, and either start the build from scratch or from where it left off.
If the nature of the error appears to be something like an option not being included on every compile line, then you need to change the system configuration file in $NCARG/config, add the necessary option(s), and restart the build from scratch (using a different output file):
cd $NCARGIf the nature of the error is such that you just need to tweak a particular file or Makefile somewhere in the NCL/NCARG Graphics source tree, then cd to the problem directory, make the change, and then type the following to recompile the local change (to make sure your change was successful) and start the build from where it left off:
make Everything >& make-output.2
make meSee Appendix B for more information on editing configuration files and restarting the installation.
make includes depend all install
cd $NCARG
make all install >>& make-output
setenv NCARG_ROOT /usr/local
setenv PATH $NCARG_ROOT/bin:$PATH
setenv MANPATH $NCARG_ROOT/man:$MANPATH
ncl -V
ng4ex gsun01n
The ng4ex command will copy an NCL script called
gsun01n.ncl into your current working directory, and run it
with NCL. An X11 window should pop up with an XY plot drawn on it.
Click on this plot with your left mouse button to keep advancing to
the next frame.
Once this file is in your directory, you can also run it yourself with:
ncl gsun01n.ncl
If "ncl" seems to be working, then this indicates that your build
of NCAR Graphics was at least mostly successful, since NCL depends
on the NCAR Graphcis libraries.
To test NCAR Graphics only, there's an extensive suite of examples available. You should refer to the NCAR Graphics Fundamentals. It will show you how to run examples and test programs, and how to view the resulting graphics. Using the ncargex and ctrans programs is the easiest way to test the installation and become familiar with the use of NCAR Graphics.
For a quick test, try the following:
ncargex cpex08
ctrans -d X11 cpex08.ncgm
The first command will copy a file called cpex08.f into your
current working directory, compile, link, and execute it, and create a
graphics file called cpex08.ncgm. The second command will
display the graphic on an X11 window on your screen. You must have
your DISPLAY environment variable set correctly for this command to
work. Right-click on the X11 window to make the graphic go away.
The three steps you'll need to follow before building NCL on an unsupported system are:
1. Modify the "ymake" file to recognize your system
For the first step, modify the file $NCARG/config/ymake and go to the lines that read:
# Figure out what kind of system we are on. We need to know the OS
# and the machine architecture.
Notice that the UNIX command "uname" is used to determine the
architecture type and operating system name. Once you figure out what
the various options that uname reports on your system, add your
machine architecture and operating system names to the case statements
that follow in the same manner as the other systems are done. You also
need to come up with a name for your configuration file. This is the
value you'll give to the "sysincs" variable. An example will be provided below after
step 2.2. Set up a configuration file
For the second step, cd to $NCARG/config and prepare a configuration file for your system that has the same name you used for the "sysincs" variable in the ymake file. Use one of the existing configuration files as a foundation (for example, "Sun4Solaris"). You will notice several macros being defined in the configuration file. You only need to define a macro if you want it to be something different than what is defined in the "Template" file. The Template file is where all the default values are set. For example, the default Fortran compiler is set to "f77" in the Template file. If your Fortran compiler is called "g77", then you would add the following line to your configuration file:
#define FCompiler g77
To see what other macros are available and what the default values are
set to, see the Template file. In particular, you may need to change
the following macros:
CCompiler
FCompiler
ExtraSysLibraries
CcOptions
FcOptions
NgCallF
Example on how to modify ymake file and set up configuration file
As an example for the first two steps, suppose you are trying to build a configuration file for a Koblinsky Systems Inc. SlothStation running ChaOS version 5.4. Assume that the command "uname -s" returns "ChaOS" and that "uname -m" returns "Sloth999". Modify the file $NCARG/config/ymake and add:
case ChaOS:
right after the first occurrence of the statement:
switch ("$foo")
You should now see something like:
switch ("$foo")
case ChaOS:
case SunOS:
case AIX:
...
Then, after the first occurrence of the statement:
switch("$opsys")
add the lines:
case ChaOS:
set os = $opsys
set arch = $mach
set sysincs = Sloth
set vendor = Koblinsky
breaksw
and after the second occurrence add:
case ChaOS:
where appropriate to get the correct major and minor operating system
version numbers defined.Let's further assume that this system is similar to a Sun workstation running Solaris, so use the Sun4Solaris configuration file as a foundation:
cd $NCARG/configThe file name "Sloth" is used because this is the value we gave to the "sysincs" variable above. Make any obvious changes to the file "Sloth". As mentioned above, you may need to change the following macros:
cp Sun4Solaris Sloth
CCompiler
FCompiler
ExtraSysLibraries
CcOptions
FcOptions
NgCallF
Of particular note is the "NgCallF" macro. First, a little background:
the NCL code is predominantly Fortran code, but the Fortran
code relies on a number of C support routines. Since not all systems
support the same calling conventions (for example, some systems
require an underscore after a Fortran routine name, while others
require the name to be in uppercase), the installation system is
programmed to apply the macro "NgCallF" to all Fortran-called C
code.
The default value of this macro handles the case where an underscore is appended after the Fortran routine name, so you won't need to define this macro if this is the behavior of your compiler. If, however, your compiler does not append an underscore (the IBM xlf/xlf90 compilers are two such examples), then you need to set this macro as follows:
NgCallF reg
If your compiler converts the Fortran routine name to uppercase (this
is the case with old Cray and the Absoft ProFortran compilers),
then you need to set the macro to:
NgCallF caps
3. Modify machine-dependent routines
There are some machine dependent routines that you may need to modify to indicate things like the standard input/output units, the number of bits per integer, the smallest positive magnitude, and so on. All of these machine-dependent requirements have been isolated in several subroutines and it may be necessary to modify these subroutines before building the software.
The routines in question are:
GBYTES ISHIFT
G01MIO I1MACH
IAND R1MACH
IOR SBYTES
These routines are referred to as "low-level support routines" in the
remainder of this section. Complete functional descriptions for these
routines appear in the section "Machine-dependent support
routines". Examples of implementations of all of these subroutines
except G01MIO are given in the directory:
$NCARG/common/src/libncarg_cA Fortran implementation of the support routine G01MIO is contained in the directory:
$NCARG/ncarg2d/src/libncarg_gks/bwiG01MIO is the basic I/O routine for NCAR's GKS package, and it is not used anywhere else but in that package.
The subroutines in the above two directories are examples only. These examples may help you, and some may actually run on your machine, but care must be taken to ensure that the implemented routines satisfy the functional descriptions as given in the "Machine-dependent support routines" section. Some of the examples given are coded in C.
There is source code for creating an executable for testing implementations of the low-level routines in the directory:
$NCARG/ncarg2d/src/bin/impltestThe source in this directory may require changes only when moving to a machine with a word size other than 32 or 64.
This directory contains a program called "tlocal" that can be used to test the implementations of IOR, IAND, ISHIFT, GBYTES, and SBYTES. Read the prologue documentation in the code for tlocal for implementation instructions. Success or failure messages will be issued to Fortran unit 6. There are no tests for I1MACH and R1MACH, but the success of the tlocal test depends on proper implementation of I1MACH and R1MACH. Constants for I1MACH and R1MACH for a large number of computers appear in the comment cards of I1MACH and R1MACH. If constants for your host computer appear there, simply uncomment the appropriate cards for your implementation of I1MACH and R1MACH. Otherwise be very careful to implement I1MACH and R1MACH correctly since there is no test for them. The support routine G01MIO is used only by NCAR's GKS package, and no test for it is provided in tlocal.
Since many of the low-level support routines are executed frequently throughout the package, efficient versions are desirable. There are portable Fortran versions of GBYTES and SBYTES in the directory:
$NCARG/common/src/libncarg_cbut they run very slowly. GBYTES and SBYTES are used primarily in the NCGM translator; machine-language versions of these routines could greatly speed up the translator. Machine-language versions of IAND, IOR, and ISHIFT are also desirable.
Configuration files reside in the directory $NCARG/config. They have names like "Sun4Solaris" and "SGI_IRIX" to indicate the machine on which they operate. For example, If you are on a Sun running Solaris, you should make changes to the file $NCARG/config/SunSolaris. See the "README" file in this directory for more information about the various configuration files.
A few of the macros are quite likely to change from system to system, but most are not. The Configure script allows the installer to make some of these minor changes to the configuration file without editing it. You must be running csh in order to run Configure.
Everything = (Makefiles, clean, all, install)
All = (Makefiles, all, install)
all = (compile and build libraries)
install = (move objects to destinations)
clean = (remove object files, core dumps, etc.)
If a compilation fails halfway through the install process and you
have already created the Makefiles, cleaned out old object code, and
compiled a large number of files, you may first correct the problem and
then restart the install process.
To correct the problem, you need to first look carefully at the error
message in the make-output file. By looking at the last several lines
of the make-output file, you should be able to determine which
directory the make stopped in. For example, let's say see the
following in your make-output file:
... Making ./ncarview/src/lib/libncarg_ras cc -Xc -O -I../../../.././include -I/usr/openwin/include -I/usr/dt/include -DBuildRasterHDF -DSUN -DBuildRasterHPPCL -DBuildRasterNrif -DBuildRasterSun -DBuildRasterXWD -DBuildRasterAVS -DBuildRasterSGI -DBuildRasterAbekas -DBuildRasterBinary -DBuildRasterYUV -DNGTMPDIR='"tmp"' -Dsun4 -DSUN -DSYSV -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1 -D__EXTENSIONS__ -DNeedFuncProto -c raster.c cc -Xc -O -I../../../.././include -I/usr/openwin/include -I/usr/dt/include -DBuildRasterHDF -DSUN -DBuildRasterHPPCL -DBuildRasterNrif -DBuildRasterSun -DBuildRasterXWD -DBuildRasterAVS -DBuildRasterSGI -DBuildRasterAbekas -DBuildRasterBinary -DBuildRasterYUV -DNGTMPDIR='"tmp"' -Dsun4 -DSUN -DSYSV -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1 -D__EXTENSIONS__ -DNeedFuncProto -c hdf.c "hdf.c", line 44: cannot find include file: <hdf/hdf.h> "hdf.c", line 45: cannot find include file: <hdf/dfgr.h> "hdf.c", line 192: cannot recover from previous errors cc: acomp failed for hdf.c *** Error code 2 make: Fatal error: Command failed for target `hdf.o'You can see from the:
Making ./ncarview/src/lib/libncarg_ras
line that the make bombed in the directory
"ncarview/src/lib/libncarg_ras". The error message here indicates that
it can't find the HDF include files. To fix this problem, then, you
would need to do one of three things:
cd $NCARGIn our example above with the HDF software, the fix involved something that would affect the Makefiles. In this case, then, you need to regenerate the Makefiles. To do this, type:
make all install >& make-output &
cd $NCARG
make All >& make-output &
A file named yMakefile exists in each directory and is converted to a regular Makefile using the C preprocessor and a collection of general and system-specific macros. The ymake system resides in $NCARG/config. This allows the redundant information in each Makefile to be isolated, in addition to providing Makefile conditionals. The C preprocessor knows what system it is running on. (The same technique is being employed in other systems, including MIT's X Window System.) If you need to change a Makefile, implement the changes in the yMakefile and then type:
make meIf you completely destroy a Makefile, you can usually recover by typing:
$NCARG/config/ymkmfThere is more information about ymake in the ymake man page which resides in the directory $NCARG/config.
FUNCTION I1MACH(I)
This function is used to set up 16 machine constants.
I1MACH(1) = the standard input unitAssume that integers are represented in the S-digit, base-A form:
I1MACH(2) = the standard output unit
I1MACH(3) = the standard punch unit
I1MACH(4) = the standard error message unit
I1MACH(5) = the number of bits per integer storage unit
I1MACH(6) = the number of characters per integer storage unit
SIGN*(X(S-1)*A**(S-1)+...+X(1)*A+X(0))in which 0 .LT. X(I) .LT. A for I=0,...,S-1.
I1MACH(7) = A, the baseAssume that floating-point numbers are represented in the T-digit, base-B form:
I1MACH(8) = S, the number of base-A digits
I1MACH(9) = A**S-1, the largest magnitude
SIGN*(B**E)*((X(1)/B+...+(X(T)/B**T))in which 0 .LT. X(1), and EMIN .LE. E .LE. EMAX.
I1MACH(10) = B, the baseSingle-precision constants
I1MACH(11) = T, the number of base-B digitsDouble-precision constants
I1MACH(12) = EMIN, the smallest exponent E
I1MACH(13) = EMAX, the largest exponent E
I1MACH(14) = T, the number of base-B digitsFUNCTION R1MACH(I)
I1MACH(15) = EMIN, the smallest exponent E
I1MACH(16) = EMAX, the largest exponent E
This function sets five single-precision machine constants:
R1MACH(1) = B**(EMIN-1), the smallest positive magnitudeFUNCTION ISHIFT(IWORD,N)
R1MACH(2) = B**EMAX*(1-B**(-T)), the largest magnitude
R1MACH(3) = B**(-T), the smallest relative spacing
R1MACH(4) = B**(1-T), the largest relative spacing
R1MACH(5) = LOG10(B)
IWORD is shifted by N bits. If N > 0, a left circular shift is performed (all bits are shifted left N bits, and the bits that are shifted out of the word to the left are shifted back into the word at the right). If N < 0, a right end-off shift is performed (all bits are shifted right by N bits, and the bits that are shifted out of the right of the word are lost)-if the leftmost bit is 0, then the vacated positions are filled with zeros; if the leftmost bit is 1, then the vacated positions are undefined. The implementor may assume that IABS(N) .LE. word_length.
FUNCTION IAND(K1,K2)
The bit-by-bit logical product of K1 and K2. If K3 = IAND(K1,K2), then the nth bit of K3 is 0 if the nth bit of either K1 or K2 is 0; otherwise the nth bit of K3 is 1. FUNCTION IOR(K1,K2) The bit-by-bit logical sum of K1 and K2. If K3 = IOR(K1,K2), then the nth bit of K3 is 0 if and only if the nth bit of both K1 and K2 is 0.
SUBROUTINE G01MIO(IOP,IUNIT,FNAME,IBUFF,LENGTH,IERROR)
This output routine is the central one for the metafile generator. A Fortran implementation of this subroutine is in the directory:
$NCARG/ncarg2d/src/libncarg_gks/bwiInput arguments
This subroutine is used to unpack bit chunks from NPACK into the ISAM array. A portable Fortran version of this routine is distributed, but the Fortran version is inefficient and should be replaced with a more efficient implementation.
CALL GBYTES(NPB,ISB,3,6,9,2)
In this call, three bits would be skipped at the beginning of NPB; the
next six bits would be unpacked into ISB(1) and right-justified with
zero-fill; nine bits would be skipped in NPB, and then the next six
bits of NPB would be unpacked into ISB(2) and right-justified with
zero-fill.SUBROUTINE SBYTES(NPACK,ISAM,IBIT,NBITS,NSKIP,ITER)
This subroutine is the reverse of GBYTES as described above. NPACK-Address of first word of array to be packed. ISAM-Array to be packed into NPACK. The rightmost NBITS bits of each word will be packed. ISAM should be dimensioned for at least ITER. IBIT-A bit-count offset to be used before the first bits are packed into NPACK. For example, if IBIT=3, and NBITS=5, 3 bits in NPACK will be skipped before the rightmost 5 bits of ISAM(1) are packed into it. NBITS-The number of bits in each word of ISAM to be unpacked. An error condition occurs if NBITS exceeds the word size on the machine. NSKIP-The number of bits to skip between each bit chunk packed. ITER-The number of bit chunks to be packed.
For example:
CALL SBYTES(NPC,ISB,45,6,3,2)
In this call, 45 bits would be skipped at the beginning of NPC; the
rightmost 6 bits of ISB(1) would be packed into NPC; 3 bits would be
skipped in NPC, and the rightmost 6 bits of ISB(2) would be packed
into NPC.