Error building netCDF 3.6.3 with pgi 11.9

Hi all,

I’m trying to build netCDF 3.6.3 with PGI 11.9 but I’m getting error after the make step:

gcc: error trying to exec 'cc1plus': execvp: No such file or directory
make[2]: *** [netcdf.lo] Error 1
make[2]: Leaving directory `/usr/local/netcdf-3.6.3/cxx'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/netcdf-3.6.3'
make: *** [all] Error 2

I followed the procedure from http://www.pgroup.com/resources/netcdf/netcdf362_pgi2011.htm.

Does anyone has an idea of the problem? I’m on ubuntu 10.04.

Thanks in advance,

Greg

Hi Greg,

It appears that GCC is trying to invoke the GNU C++ front-end compiler, cc1plus, but either it’s not installed or not in your path.

If you have access to the PGI C and C++ compilers, pgcc and pgCC, please configure NetCDF to use these compilers. Otherwise, you will need to determine why gcc can’t find the C++ compiler. Maybe setting CXX to be g++ instead of gcc? Can gcc or g++ compile as simple C++ program?

  • Mat

Hi Mat,

Thanks for you answer.

This is the command I type to run the configure script:

ilab@Telesto:/usr/local/netcdf-3.6.2$ sudo env CC=pgcc CFLAGS="-O2 -Msignextend -V" FC=pgf90 F90=pgf90 FFLAGS="-O2 -w -V"  \
> CXX=pgcpp CPPFLAGS="-DNDEBUG -DpgiFortran" ./configure -prefix=/usr/local/netcdf-3.6.2

And I have this error:

configure: netCDF 3.6.2
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
configure: checking user options
checking whether CXX is set to ''... no
checking whether FC is set to ''... no
checking whether F90 is set to ''... no
checking whether documentation is to be installed... no
checking whether Fortran compiler(s) should be tested during configure... yes
checking whether configure should try to set compiler flags... yes
checking whether FFIO will be used... no
checking whether to skip C++, F77, or F90 APIs if compiler is broken... yes
checking whether only the C library is desired... no
checking whether examples should be built... yes
checking whether F77 API is desired... yes
checking whether F90 API is desired... yes
checking whether fortran type sizes should be checked... yes
checking whether C API is desired... yes
checking where to get netCDF C-only library for separate fortran libraries... 
checking whether CXX API is desired... yes
checking whether v2 netCDF API should be built... yes
checking whether the ncgen/ncdump should be built... yes
checking whether large file (> 2GB) tests should be run... no
checking whether extreme numbers should be used in tests... yes
checking where to put large temp files if large file tests are run... .
checking whether a win32 DLL is desired... no
checking whether separate fortran libs are desired... no
configure: finding C compiler
checking for C compiler default output file name... 
configure: error: C compiler cannot create executables
See `config.log' for more details.

If I set the environment variables in my .bashrc before, like that:


################## PGI environment variables ###################

PGI=/opt/pgi; export PGI
PATH=$PGI/linux86/11.9/bin:$PATH; export PATH
MANPATH=$MANPATH:$PGI/linux86/11.9/man; export MANPATH
LM_LICENSE_FILE=$PGI/license.dat; export LM_LICENSE_FILE


################## netCDF 3 environment variables ###################



export CC=/opt/pgi/linux86/11.9/bin/pgcc
export CFLAGS="-O2 -Msignextend -V"
export FC=/opt/pgi/linux86/11.9/bin/pgfortran
export F90=/opt/pgi/linux86/11.9/bin/pgfortran
export FFLAGS="-O2 -w -V"
export CXX=/opt/pgi/linux86/11.9/bin/pgcpp
export CPPFLAGS="-DNDEBUG -DpgiFortran"



export NETCDF=/usr/local/netcdf-3.6.2
export PATH=$PATH:/usr/local/netcdf-3.6.2

and just typing:

./configure --prefix=/usr/local/netcdf-3.6.2

I get a different message:


configure: netCDF 3.6.2
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
configure: checking user options
checking whether CXX is set to ''... no
checking whether FC is set to ''... no
checking whether F90 is set to ''... no
checking whether documentation is to be installed... no
checking whether Fortran compiler(s) should be tested during configure... yes
checking whether configure should try to set compiler flags... yes
checking whether FFIO will be used... no
checking whether to skip C++, F77, or F90 APIs if compiler is broken... yes
checking whether only the C library is desired... no
checking whether examples should be built... yes
checking whether F77 API is desired... yes
checking whether F90 API is desired... yes
checking whether fortran type sizes should be checked... yes
checking whether C API is desired... yes
checking where to get netCDF C-only library for separate fortran libraries... 
checking whether CXX API is desired... yes
checking whether v2 netCDF API should be built... yes
checking whether the ncgen/ncdump should be built... yes
checking whether large file (> 2GB) tests should be run... no
checking whether extreme numbers should be used in tests... yes
checking where to put large temp files if large file tests are run... .
checking whether a win32 DLL is desired... no
checking whether separate fortran libs are desired... no
configure: finding C compiler
checking for xlc... no
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of cc... gcc3
checking whether cc understands -c and -o together... yes
checking for an ANSI C-conforming const... yes
configure: finding Fortran compiler (will not be used if Fortran API is not desired)
checking for xlf90... no
checking for fort... no
checking for xlf95... no
checking for ifort... no
checking for ifc... no
checking for efc... no
checking for pgf95... no
checking for lf95... no
checking for gfortran... no
checking for f95... no
checking for f90... no
checking for f90... no
checking for xlf90... no
checking for pgf90... no
checking for epcf90... no
checking whether we are using the GNU Fortran compiler... no
checking whether  accepts -g... no
configure: WARNING: No F90 compiler found. F90 API will not be built.
checking for xlf... no
checking for fort... no
checking for xlf95... no
checking for ifort... no
checking for ifc... no
checking for efc... no
checking for pgf77... no
checking for lf95... no
checking for gfortran... no
checking for f77... no
checking for frt... no
checking for pgf95... no
checking for f95... no
checking for f90... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking for f90... no
checking for xlf90... no
checking for pgf90... no
checking for epcf90... no
checking for g77... no
checking whether we are using the GNU Fortran 77 compiler... no
checking whether  accepts -g... no
configure: WARNING: No F77 compiler found. F77 API will not be built.
configure: finding C++ compiler (will not be used if C++ API is not desired)
checking for cl... no
checking for KCC... no
checking for CC... no
checking for cxx... no
checking for cc++... no
checking for xlC... no
checking for aCC... no
checking for c++... no
checking for g++... no
checking for egcs... no
checking for gcc... gcc
checking whether we are using the GNU C++ compiler... no
checking whether gcc accepts -g... no
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 32768
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking how to recognise dependent libraries... pass_all
checking for ar... ar
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from cc object... ok
checking how to run the C preprocessor... cc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking whether we are using the GNU C++ compiler... (cached) no
checking whether gcc accepts -g... (cached) no
checking dependency style of gcc... (cached) gcc3
checking how to run the C++ preprocessor... /lib/cpp
checking for g77... no
checking for xlf... no
checking for f77... no
checking for frt... no
checking for pgf77... no
checking for cf77... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking for xlf90... no
checking for f90... no
checking for pgf90... no
checking for pghpf... no
checking for epcf90... no
checking for gfortran... no
checking for g95... no
checking for xlf95... no
checking for f95... no
checking for fort... no
checking for ifort... no
checking for ifc... no
checking for efc... no
checking for pgf95... no
checking for lf95... no
checking for ftn... no
checking whether we are using the GNU Fortran 77 compiler... (cached) no
checking whether  accepts -g... (cached) no
checking for gfortran... no
checking for g95... no
checking for xlf95... no
checking for f95... no
checking for fort... no
checking for ifort... no
checking for ifc... no
checking for efc... no
checking for pgf95... no
checking for lf95... no
checking for ftn... no
checking for xlf90... no
checking for f90... no
checking for pgf90... no
checking for pghpf... no
checking for epcf90... no
checking for g77... no
checking for xlf... no
checking for f77... no
checking for frt... no
checking for pgf77... no
checking for cf77... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking whether we are using the GNU Fortran compiler... (cached) no
checking whether  accepts -g... (cached) no
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
configure: finding other utilities
checking for a BSD-compatible install... /usr/bin/install -c
configure: trying to set flags for this platform
checking if _HPUX_SOURCE should be set... no
checking if Solaris -Xa option is needed... CFLAGS=-g -O2
checking if we need to set _LARGE_FILES despite results of previous tests... _LARGE_FILES=
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... 64
configure: displaying some results
checking CPPFLAGS... 
checking CC CFLAGS... cc -g -O2
checking type cc... cc is /usr/bin/cc
checking CXX... gcc
checking CXXFLAGS... 
checking type gcc... gcc is /usr/bin/gcc
checking FC... unset
checking F90... unset
checking AR... ar
checking ARFLAGS... 
checking type ar... ar is /usr/bin/ar
checking NM... /usr/bin/nm -B
checking NMFLAGS... 
configure: checking types, headers, and functions
checking for stdlib.h... (cached) yes
checking for sys/types.h... (cached) yes
checking for strlcat... no
checking for strerror... yes
checking for working alloca.h... yes
checking for alloca... yes
checking for struct stat.st_blksize... yes
checking for IEEE floating point format... yes
checking for size_t... yes
checking for off_t... yes
checking for ssize_t... yes
checking for ptrdiff_t... yes
checking for uchar... no
checking whether char is unsigned... no
checking whether byte ordering is bigendian... no
checking for short... yes
checking size of short... 2
checking for int... yes
checking size of int... 4
checking for long... yes
checking size of long... 4
checking for float... yes
checking size of float... 4
checking for double... yes
checking size of double... 8
checking for off_t... (cached) yes
checking size of off_t... 8
checking for size_t... (cached) yes
checking size of size_t... 4
checking for manual-page index command... 
checking binary distribution directory... /home/ftp/pub/binary/dummy_system
configure: generating header files and makefiles
configure: creating ./config.status
config.status: creating Makefile
config.status: creating man/Makefile
config.status: creating fortran/Makefile
config.status: creating libsrc/Makefile
config.status: creating nctest/Makefile
config.status: creating nc_test/Makefile
config.status: creating ncdump/Makefile
config.status: creating ncgen/Makefile
config.status: creating nf_test/Makefile
config.status: creating cxx/Makefile
config.status: creating f90/Makefile
config.status: creating examples/Makefile
config.status: creating examples/C/Makefile
config.status: creating examples/CDL/Makefile
config.status: creating examples/CXX/Makefile
config.status: creating examples/F90/Makefile
config.status: creating examples/F77/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: creating fortran/nfconfig1.inc
config.status: fortran/nfconfig1.inc is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands

I don’t understand why I get a different configure message when I set the environment variables? It seems that the configure script do not use PGI fortran, C and C++ compilers I have set in my bashrc … Maybe it’s a problem from pgi installation? I tried to compile simple fortran and c programs with pgfortran and pgcc and it’s working perfectly! So I don’t understand why netCDF do not want to use pgi compilers! By the way, I have a trial license…

Thanks for you help,

Greg

Hi Greg,

It does appear to be a problem with your environment variables not being picked up by NetCDF’s configure script. Not all shells accept the ‘env’ command so this failure isn’t too surprising. However, adding the variables to your .bashrc should be ok provided you sourced it and/or opened a new shell.

From the command line, what is the output of “echo $CC”?

What happens if you export each variable from the command line before invoking configure?

  • Mat

Hi Mat,

I finally succeed to compile netCDF, invoking each environment variable from the command line:

> sudo ./configure --prefix=/usr/local/netcdf-3.6.3 \
> CC=/opt/pgi/linux86/11.9/bin/pgcc \
> CFLAGS="-O2 -Msignextend -V" \
> FC=/opt/pgi/linux86/11.9/bin/pgfortran \
> F90=/opt/pgi/linux86/11.9/bin/pgfortran \
> FFLAGS="-O2 -w -V" \
> CXX=/opt/pgi/linux86/11.9/bin/pgcpp \
> CPPFLAGS="-DNDEBUG -DpgiFortran"

And this worked! But I still don’t understand why It didn’t worked when putting all of them in the bashrc… Because when I did echo $CC for example, it gave me /opt/pgi/linux86/11.9/bin/pgcc, so I assume it was set correctly. Anyway, now netCDF is compiled! Do I need to put the environment variables in the bashrc anyway or it is not necessary?

Thanks for your help,

Greg

Hi Greg,

I’ve never tried invoking configure with sudo, but think it’s the cause. I don’t think sudo preserves your environment unless the “-E” flag is used. Try configure from a temp directory in your environment.

Do I need to put the environment variables in the bashrc anyway or it is not necessary?

It’s not necessary. Though, I would put add the PGI bin directory to your PATH variable. i.e. export PATH=/opt/pgi/linux86/11.9/bin:$PATH

  • Mat

Okay, thank you very much!