netcdf?

I’m trying to compile netcdf 4.1.3 with PGI 12.5 on Ubuntu Linux (64 bit). When I run configure I get the following error message:


checking for gcc... pgcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... configure: error: in `/opt/tmp/netcdf-4.1.3':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details

I’ve set the following environment variables, in addition to those necessary for the PGI compilers to work:


    export CC=pgcc
    export FC=pgfortran
    export LD=pgfortran
    export F90=pgfortran
    export FFLAGS="-O2 -Msignextend" 
    export CXX=pgcpp
    export CPPFLAGS="-DpgiFortran"

So far, I haven’t been able to figure out how to work around this error message. I feel like I’m missing something obvious. Any help would be appreciated.

Hi tuckerm,

It’s a known issue where NetCDF requires some 32-bit comparability headers.

From http://www.pgroup.com/resources/netcdf/netcdf411_pgi2011.htm:

Missing 32-bit header files

If the configuration fails with the following error:


checking whether we are cross compiling… configure: error: in
/home/me/Documents/netcdf-4.1.3': configure: error: cannot run C compiled programs. If you meant to cross compile, use –host’.
See `config.log’ for more details

The cause is likely you’re building on a 64-bit machine. NetCDF requires some 32-bit header files. To install them, enter:

sudo apt-get install libc6-dev-i386

Once this package is installed, the configure should proceed without error.

Hope this helps,
Mat

Unfortunately, this package no longer seems to be part of Ubuntu (12.04)

# apt-get install libc6-dev-i386 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package libc6-dev-i386 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  libc6-i386

E: Package 'libc6-dev-i386' has no installation candidate

libc6-i386 was already installed. There does not seem to be a dev/headers package for the 32bit libs. Is there another way to get the package to build?[/quote]

Unfortunately, this package no longer seems to be part of Ubuntu (12.04)

I had a problem with my apt sources which I worked around. Now I’m having an issue with the actual make/compile process. I’m not sure if this is actually a PGI issue or something with netcdf.


Making all in libdispatch
make[2]: Entering directory `/opt/tmp/netcdf-4.1.3/libdispatch'
source='parallel.c' object='libdispatch_la-parallel.lo' libtool=yes \
        DEPDIR=.deps depmode=none /bin/bash ../depcomp \
        /bin/bash ../libtool  --tag=CC   --mode=compile pgcc -DHAVE_CONFIG_H -I. -I.. -I../fortran  -I../include    -DpgiFortran  -g -c -o libdispatch_la-parallel.lo `test -f 'parallel.c' || echo './'`parallel.c
libtool: compile:  pgcc -DHAVE_CONFIG_H -I. -I.. -I../fortran -I../include -DpgiFortran -g -c parallel.c -o libdispatch_la-parallel.o
PGC-F-0206-Can't find include file asm/errno.h (/usr/include/linux/errno.h: 4)
PGC/x86-64 Linux 12.5-0: compilation aborted
make[2]: *** [libdispatch_la-parallel.lo] Error 1
make[2]: Leaving directory `/opt/tmp/netcdf-4.1.3/libdispatch'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/opt/tmp/netcdf-4.1.3'
make: *** [all] Error 2

I think this is a “classic” Ubuntu issue. This file isn’t in, say, /usr/include/asm as in most places but in a directory like /usr/include/i386-linux-gnu or /usr/include/x86_64-linux-gnu (and then in the asm/ directory under there). I think the way around it is to add the correct directory to a CPPFLAGS:

CPPFLAGS=-I/usr/include/x86_64-linux-gnu

or to C_INCLUDE_PATH or the like.

Matt