Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 
Known Symptoms of a Broken netCDF Build

This is where we document some common symptoms of broken builds, and their resolution. Another place to look for fixes to problems installing netCDF on platforms not listed in the NetCDF Installation and Porting Guide is Other Builds of the netCDF Package.

Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

Known Symptoms of Broken netCDF Build


On Cygwin, Fortan test fails: can't link to any nf_* function

The fortran test fails:

make[1]: Entering directory `/home/Ed/netcdf-3/nf_test'
f77 -DHAVE_CONFIG_H -I. -I. -I.. -I../fortran  -I../libsrc
-Df2cFortran  -g -O2 -c -o test_get.o test_get.F
f77 -DHAVE_CONFIG_H -I. -I. -I.. -I../fortran  -I../libsrc
-Df2cFortran  -g -O2 -c -o test_put.o test_put.F
f77 -DHAVE_CONFIG_H -I. -I. -I.. -I../fortran  -I../libsrc
-Df2cFortran  -g -O2 -c -o nf_error.o nf_error.F
f77 -DHAVE_CONFIG_H -I. -I. -I.. -I../fortran  -I../libsrc
-Df2cFortran  -g -O2 -c -o nf_test.o nf_test.F
f77 -DHAVE_CONFIG_H -I. -I. -I.. -I../fortran  -I../libsrc
-Df2cFortran  -g -O2 -c -o test_read.o test_read.F
f77 -DHAVE_CONFIG_H -I. -I. -I.. -I../fortran  -I../libsrc
-Df2cFortran  -g -O2 -c -o test_write.o test_write.F
f77 -DHAVE_CONFIG_H -I. -I. -I.. -I../fortran  -I../libsrc
-Df2cFortran  -g -O2 -c -o util.o util.F
depbase=`echo fortlib.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`; \
if cc -DHAVE_CONFIG_H -I. -I. -I.. -I../fortran  -I../libsrc
-Df2cFortran  -g -O2 -MT fortlib.o -MD -MP -MF "$depbase.Tpo" -c -o
fortlib.o fortlib.c; \
then mv -f "$depbase.Tpo" "$depbase.Po"; else rm -f "$depbase.Tpo";
exit 1; fi
/bin/bash ../libtool --mode=link --tag=F77 f77  -g -O2 -L../libsrc
-o nf_test.exe  test_get.o test_put.o nf_error.o nf_test.o test_read.o
test_write.o util.o fortlib.o -lnetcdf -lm  
mkdir .libs
f77 -g -O2 -o nf_test.exe test_get.o test_put.o nf_error.o nf_test.o
test_read.o test_write.o util.o fortlib.o  -L/home/Ed/netcdf-3/libsrc
/home/Ed/netcdf-3/libsrc/.libs/libnetcdf.a
test_get.o(.text+0x31): In function `test_nf_get_var1_text__':
/home/Ed/netcdf-3/nf_test/test_get.F:25: undefined reference to
`_nf_open__'
test_get.o(.text+0xc3):/home/Ed/netcdf-3/nf_test/test_get.F:34:
undefined reference to `_nf_get_var1_text__'
test_get.o(.text+0x10f):/home/Ed/netcdf-3/nf_test/test_get.F:37:
undefined reference to `_nf_get_var1_text__'
test_get.o(.text+0x193):/home/Ed/netcdf-3/nf_test/test_get.F:43:
undefined reference to `_nf_get_var1_text__'
test_get.o(.text+0x282):/home/Ed/netcdf-3/nf_test/test_get.F:60:
undefined reference to `_nf_get_var1_text__'

etc.

This happens to me on Cygwin/Windows, if I have my windows directories ahead of my cygwin directories in my path. To fix it, move the cygwin /usr/bin directory to the front of your path.

Then cd to the netcdf build directory (the src subdirectory for release 3.6.1 and earlier, and the main netcdf directory for releases 4.0 onward). Execute the following:

make distclean && ./configure && make test

On Cygwin, libsrc build fails with ncx.c :1119:2: #error "ix_float implementation"

On Cygwin, the libsrc build fails:

make[2]: Entering directory
`/home/klindsay/netcdf-3.6.0-p1/src/libsrc'
gcc -c -g -I.  -Df2cFortran attr.c
gcc -c -g -I.  -Df2cFortran dim.c
gcc -c -g -I.  -Df2cFortran error.c
gcc -c -g -I.  -Df2cFortran -DVERSION=`cat ../VERSION` libvers.c
gcc -c -g -I.  -Df2cFortran nc.c
gcc -c -g -I.  -Df2cFortran ncio.c
gcc -c -g -I.  -Df2cFortran ncx.c
ncx.c:1119:2: #error "ix_float implementation"
ncx.c:1542:2: #error "ix_double implementation"
make[2]: *** [ncx.o] Error 1
make[2]: Leaving directory `/home/klindsay/netcdf-3.6.0-p1/src/libsrc'
make[1]: *** [subdir_target] Error 1
make[1]: Leaving directory `/home/klindsay/netcdf-3.6.0-p1/src'
make: *** [libsrc/all] Error 2

This happens prior to 3.6.1-beta3. Get the latest beta and try again.


Fortan build fails with cfortran.h message: Can't find your environment

The fortran build fails:

make[1]: Entering directory `/home/ed/n3_temp/fortran'

depbase=`echo fort-attio.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`; \
if /bin/sh ../libtool --tag=CC --mode=compile cc -DHAVE_CONFIG_H
-I. -I. -I.. -I.  -I../libsrc    -g -O2 -MT fort-attio.lo -\
MD -MP -MF "$depbase.Tpo" -c -o fort-attio.lo fort-attio.c; \
then mv -f "$depbase.Tpo" "$depbase.Plo"; else rm -f "$depbase.Tpo";
exit 1; fi
mkdir .libs
 cc -DHAVE_CONFIG_H -I. -I. -I.. -I. -I../libsrc -g -O2 -MT
 fort-attio.lo -MD -MP -MF .deps/fort-attio.Tpo -c fort-attio.c  \
-fPIC -DPIC -o .libs/fort-attio.o

In file included from ncfortran.h:13,
                 from fort-attio.c:6:
cfortran.h:138:3: #error cfortran.h:  Can't find your environment
                 among:    
- MIPS cc and f77 2.0. (e.g. Silicon Graphics, DECstations, ...)         
- IBM AIX XL C and FORTRAN Compiler/6000 Version 01.01.0000.0000         
- VAX   VMS CC 3.1 and FORTRAN 5.4. 
- Alpha VMS DEC C 1.3 and DEC FORTRAN 6.0. 
- Alpha OSF DEC C and DEC Fortran for OSF/1 AXP Version 1.2
- Apollo DomainOS 10.2 (sys5.3) with f77 10.7 and cc 6.7. 
- CRAY
- NEC SX-4 SUPER-UX    
- CONVEX
- Sun     
- PowerStation Fortran with Visual C++                       \
- HP9000s300/s700/s800 Latest test with: HP-UX A.08.07 A9000/730        
- LynxOS: cc or gcc with f2c.          \
- VAXUltrix: vcc,cc or gcc with f2c. gcc or cc with f77. 
- f77 with vcc works; but missing link magic for f77 I/O.     
- NO fort. None of gcc, cc or vcc generate required names
- f2c    : Use #define    f2cFortran, or cc -Df2cFortran
- NAG f90: Use #define NAGf90Fortran, or cc -DNAGf90Fortran              
- Absoft UNIX F77: Use #define AbsoftUNIXFortran or cc -DAbsoftUNIXFortran     
- Absoft Pro Fortran: Use #define AbsoftProFortran     
- Portland Group Fortran: Use #define pgiFortran     
- PathScale Fortran: Use #define PATHSCALE_COMPILER
make[1]: *** [fort-attio.lo] Error 1

This means that a necessary (for Fortran) C pre-processor flag is absent. The flag tells the C compiler how many underscores the Fortran compiler likes to see in function names, and other interesting name-mangling facts. Here on the one-hundred and second floor of Unidata Tower 2, dozens of programmers await some standardization of the Fortran/C interface.

If you have are using g77, try:

export CPPFLAGS=-Df2cFortran

or (for csh fans):

setenv CPPFLAGS -Df2cFortran

If you have are a Portland Group or Intel compiler, try:

export CPPFLAGS=-DpgiFortran

or (for csh fans):

setenv CPPFLAGS -DpgiFortran

If you have another type of compiler, try one of the two above choices. (pgiFortran seems to work more often than f2cFortran on a totally random selection of Fortran compilers known about here at netCDF HQ.)

Then cd to the netcdf build directory (the src subdirectory for release 3.6.1 and earlier, and the main netcdf directory for releases 4.0 onward). Execute the following:

make distclean && ./configure && make test

ncfortran.h:27:42: NF_INT_IS_C_... not defined: No such file or directory

Making `all' in directory /home/ed/n3_tmp4/fortran

make[2]: Entering directory `/home/ed/n3_tmp4/fortran'
cc -c -g -I.. -I../libsrc   -DpgiFortran fort-attio.c
In file included from fort-attio.c:6:
ncfortran.h:27:42: NF_INT_IS_C_... not defined: No such file or
directory
fort-attio.c:12: error: syntax error before "NF_INTEGER"
fort-attio.c:12: error: syntax error before '*' token
fort-attio.c:12: error: syntax error before numeric constant
fort-attio.c:12: warning: data definition has no type or storage class
fort-attio.c:12: error: syntax error before numeric constant
fort-attio.c:12: error: syntax error before '!' token
fort-attio.c:12: error: syntax error before numeric constant
etc.

This is another symptom of the Intel compiler missing library problem. See here for the solution.


The configure script fails to get Intel Fortran compiler working

When using the ifort compiler, configure reports that ifort can't be used to build f90 programs. The file config.log contains the following:

configure:3958: ./conftest
./conftest: error while loading shared libraries: libimf.so: cannot
open shared object file: No such file or directory
configure:3961: $? = 127
configure:3966: result: failed to build executable program

The problem is that the system doesn't know where to find libimf.so. Find this file, and set LD_LIBRARY_PATH to the directory that contains it, and try again.

Note that you must export LD_LIBRARY_PATH, something like this:

bash-3.00$ export LD_LIBRARY_PATH=/home/ed/local/lib

On our Intel fortran compiler there is a shell script that we must run (ifortvars.sh) which sets environment variables that are needed by the intel fortran compiler. Make sure you have run this script.


When autoreconf is run AM_INIT_AUTOMAKE isn't found

bash-3.00$ autoreconf
autoreconf: `configure.ac' and `configure.in' both present.
autoreconf: proceeding with `configure.ac'.
autoconf: warning: both `configure.ac' and `configure.in' are present.
autoconf: warning: proceeding with `configure.ac'.
autoconf: warning: both `configure.ac' and `configure.in' are present.
autoconf: warning: proceeding with `configure.ac'.
configure.ac:39: error: possibly undefined macro: AM_INIT_AUTOMAKE
      If this token and others are legitimate, please use
      m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:77: error: possibly undefined macro: AM_CONDITIONAL
configure.ac:190: error: possibly undefined macro: AM_PROG_CC_C_O
configure.ac:319: error: possibly undefined macro: AM_FFLAGS
configure.ac:413: error: possibly undefined macro:
AC_LIBTOOL_WIN32_DLL
configure.ac:416: error: possibly undefined macro: AC_PROG_LIBTOOL
autoreconf: /home/ed/local/bin/autoconf failed with exit status: 1

When autoreconf is run autoheader complains about HAVE_TRUNCATE

bash-3.00$ autoreconf
autoreconf: `configure.ac' and `configure.in' both present.
autoreconf: proceeding with `configure.ac'.
autoconf: warning: both `configure.ac' and `configure.in' are present.
autoconf: warning: proceeding with `configure.ac'.
autoconf: warning: both `configure.ac' and `configure.in' are present.
autoconf: warning: proceeding with `configure.ac'.
autoheader: `configure.ac' and `configure.in' both present.
autoheader: proceeding with `configure.ac'.
autoheader: warning: missing template: HAVE_FTRUNCATE
autoheader: Use AC_DEFINE([HAVE_FTRUNCATE], [], [Description])
autoheader: warning: missing template: NCBYTE_T
autoheader: warning: missing template: NCSHORT_T
autoheader: warning: missing template: NF_INT1_T
autoheader: warning: missing template: NF_INT2_T
autoheader: warning: missing template: NO_IEEE_FLOAT
autoheader: warning: missing template: SIZEOF_OFF_T
autoheader: warning: missing template: SIZEOF_SIZE_T
autoreconf: /home/ed/local/bin/autoheader failed with exit status: 1

Remove aclocal.m4 and try again.
 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Office of Programs University Corporation for Atmospheric Research (UCAR)   Unidata is a member of the UCAR Office of Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690