[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #CBC-592345]: issues with compiling netcdf



Hello,

> Hi there,
> 
> I have the most recent version of netcdf installed on my system (CentOS 6),
> and was able to link my program with the lib. The program was compiled with
> no error, but gave the following error when running.
> 
> ./extract_data.exe: symbol lookup error: ./extract_data.exe: undefined
> symbol: netcdf_mp_nf90_open_
> 

I am less familiar with Fortran than C, but I will be as much help as I can.  I 
would refer you to these links discussing the same/similar issue:

https://software.intel.com/en-us/forums/topic/270732
http://www.unidata.ucar.edu/support/help/MailArchives/netcdf/msg11169.html
http://www.unidata.ucar.edu/support/help/MailArchives/netcdf/msg10104.html
http://ubuntuforums.org/archive/index.php/t-1033570.html

It would appear you may need to ensure you are using static netcdf libraries, 
and that the Fortran units calling netCDF function each have a 'use netcdf' 
statement in the declarations.

Hopefully the answer to your question is contained in one of the previous 
discussions of this issue; if not, please let me know.

-Ward

> Here is how my Makefile looks like when compiling the program
> FC    = ifort
> FFLAGS= -O3 -xHost -ip -no-prec-div -static-intel
> INCLUDE = -I/raid/save/WRF/local_intel/include
> LIB = -L/raid/save/WRF/local_intel/lib -lnetcdff -lnetcdf
> 
> SRC = $(wildcard *.f90)
> OBJ = $(SRC:.f90=.o)
> EXE = $(SRC:.f90=.exe)
> 
> .SUFFIXES : .f90 .exe
> 
> .f90.exe:
> $(FC) $(FFLAGS) $< $(INCLUDE) $(LIB) -o $@
> 
> all : $(EXE)
> 
> The same program was successfully compiled and linked with earlier version
> of netcdf (4.1.2), and runs without any error. So I believe the current
> issue is with the new netcdf installation, but I cannot figure out where I
> might have done wrong.  Here is what I did to install the new versions.
> 
> The directory where I installed netcdf is /raid/save/WRF/local_intel,  The
> versions I got are 4.3.2 for the C lib and 4.2 for the fortran lib.  I am
> using Intel compiler.  The compiler setting was the following and was used
> consistently in all steps
> 
> export CC=icc
> export CXX=icpc
> export CFLAGS='-O3 -xHost -ip -no-prec-div -static-intel'
> export CXXFLAGS='-O3 -xHost -ip -no-prec-div -static-intel'
> export F77=ifort
> export FC=ifort
> export F90=ifort
> export FFLAGS='-O3 -xHost -ip -no-prec-div -static-intel'
> export CPP='icc -E'
> export CXXCPP='icpc -E'
> 
> To compile netcdf-4.3.2 first, I used the following:
> ./configure --prefix=/raid/save/WRF/local_intel --disable-netcdf-4
> --disable-dap
> make check install
> 
> To compile netcdf-fortran-4.2, I used the following
> export LD_LIBRARY_PATH=/raid/save/WRF/local_intel/lib:${LD_LIBRARY_PATH}
> export CPPFLAGS=-I/raid/save/WRF/local_intel/include
> export LDFLAGS=-L/raid/save/WRF/local_intel/lib
> ./configure --prefix=/raid/save/WRF/local_intel
> make install
> 
> The installation process produced no error, so it looks like things are all
> in place.  However, that runtime error always show up when running a
> program linked with this netcdf lib.  Please help. Thanks!
> 
> -Lifeng
> 
> 
> -----------------------------
> Lifeng Luo, Ph.D.
> Assistant Professor
> Department of Geography
> Rm 124 Geography Building
> 673 Auditorium Road
> Michigan State University
> East Lansing, MI, 48824
> Tel: 517-884-0547
> Fax: 517-432-1671
> Web: http://www.msu.edu/~lluo
> -----------------------------
> 
> 

Ticket Details
===================
Ticket ID: CBC-592345
Department: Support netCDF
Priority: Normal
Status: Closed