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

[netCDF #NKE-128213]: Problem with Fortran90 API using Intel Compilers for NetCDF



Victor,

If the netCDF Fortran library was installed as a shared library in a location 
that 
is not searched by default, you will need to set the LD_LIBRARY_PATH 
environment 
variable (or DYLD_LIBRARY_PATH on OSX) to specify that directory before running 
a program linked to it, for example:

  export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/home/victor/local/sublocal/lib

Alternatively, you can use one of the methods that should have appeared in
the output from "make install":

  If you ever happen to want to link against installed libraries
  in a given directory, LIBDIR, you must either use libtool, and
  specify the full pathname of the library, or use the `-LLIBDIR'
  flag during linking and do at least one of the following:
     - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
       during execution
     - add LIBDIR to the `LD_RUN_PATH' environment variable
       during linking
     - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
     - have your system administrator add LIBDIR to `/etc/ld.so.conf'

  See any operating system documentation about shared libraries for
  more information, such as the ld(1) and ld.so(8) manual pages.

Shared libraries solve lots of problems, but require some configuration
or extra options when you link your own programs to shared libraries
installed in non-standard places ...

If that's not the problem, I'm not sure why you're getting the 
undefined symbol netcdf_mp_nf90_create_ .

--Russ



> Yes, netcdf.mod is at /home/victor/local/sublocal/include
> and indeed, that was the last modification at bash_history; now after using:
> *victor@antares:~/local/sublocal/netcdf-fortran-netcdf-fortran-4.2/examples/F90$
> ifort -o test90 -I/home/victor/local/sublocal/include simple_xy_wr.f90
> -lnetcdff -lnetcdf*
> 
> I get
> 
> /tmp/ifortRGOASm.o: In function `MAIN__':If you ever happen to want to link 
> against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.

> simple_xy_wr.f90:(.text+0x359): undefined reference to
> `netcdf_mp_nf90_create_'
> simple_xy_wr.f90:(.text+0x391): undefined reference to
> `netcdf_mp_nf90_def_dim_'
> simple_xy_wr.f90:(.text+0x3c5): undefined reference to
> `netcdf_mp_nf90_def_dim_'
> simple_xy_wr.f90:(.text+0x495): undefined reference to
> `netcdf_mp_nf90_def_var_manydims_'
> simple_xy_wr.f90:(.text+0x4be): undefined reference to
> `netcdf_mp_nf90_enddef_'
> simple_xy_wr.f90:(.text+0x4fb): undefined reference to
> `netcdf_mp_nf90_put_var_2d_fourbyteint_'
> simple_xy_wr.f90:(.text+0x51b): undefined reference to
> `netcdf_mp_nf90_close_'
> simple_xy_wr.f90:(.text+0x5a3): undefined reference to
> `netcdf_mp_nf90_strerror_'
> simple_xy_wr.f90:(.text+0x64f): undefined reference to
> `netcdf_mp_nf90_strerror_'
> simple_xy_wr.f90:(.text+0x6fb): undefined reference to
> `netcdf_mp_nf90_strerror_'
> simple_xy_wr.f90:(.text+0x7a7): undefined reference to
> `netcdf_mp_nf90_strerror_'
> simple_xy_wr.f90:(.text+0x853): undefined reference to
> `netcdf_mp_nf90_strerror_'
> /tmp/ifortRGOASm.o:simple_xy_wr.f90:(.text+0x904): more undefined
> references to `netcdf_mp_nf90_strerror_' follow
> 
> then I made:
> victor@antares:~/local/sublocal/netcdf-fortran-netcdf-fortran-4.2/examples/F90$
> ifort -o testF90_2 -I/home/victor/local/sublocal/include
> -L/home/victor/local/sublocal/lib simple_xy_wr.f90 -lnetcdff -lnetcdf
> 
> and it compiles!, however, at executing I got:
> victor@antares:~/local/sublocal/netcdf-fortran-netcdf-fortran-4.2/examples/F90$
> ./testF90_2
> ./testF90_2: symbol lookup error: ./testF90_2: undefined symbol:
> netcdf_mp_nf90_create_
> 
> Any idea?
> Thanks again
> vtp
> 
> 
> 2013/8/23 Unidata netCDF Support <address@hidden>
> 
> > Victor,
> >
> > > According to my .bash_histroy file I did:
> > > *
> > > ./configure --prefix=/home/victor/local/sublocal
> > > make
> > > make check >& makecheck.txt &
> > > ls -lt
> > > vi makecheck.txt
> > > make install*
> > >
> > > then I moved to the folder:
> > > victor@antares
> > > :~/local/sublocal/netcdf-fortran-netcdf-fortran-4.2/examples/F90/
> > >
> > > and there, at the command line, I entered:
> > >
> > > *ifort -o test90 -I/home/victor/local/sublocal/ simple_xy_wr.f90
> > -lnetcdff
> > > -lnetcdf*
> > > simple_xy_wr.f90(19): error #7013: This module file was not generated by
> > > any release of this compiler.   [NETCDF]
> >
> > OK, that error means that the netcdf.mod file found in
> > /home/victor/local/sublocal/ was
> > not generated by ifort.  I think the real propblem is that you should have
> > used
> >
> >   -I/home/victor/local/sublocal/include
> >
> > instead.  Just to make sure, check that there is a netcdf.mod file in that
> > directory
> > and that its last modification date corresponds to when you ran "make
> > install" after
> > building with ifort.
> >
> > --Russ
> >
> >
> >
> > > use netcdf
> > > ------^
> > > simple_xy_wr.f90(59): error #6404: This name does not have a type, and
> > must
> > > have an explicit type.   [NF90_CREATE]
> > > call check( nf90_create(FILE_NAME, NF90_CLOBBER, ncid) )
> > > --------------^
> > > simple_xy_wr.f90(62): error #6404: This name does not have a type, and
> > must
> > > have an explicit type.   [NF90_DEF_DIM]
> > > call check( nf90_def_dim(ncid, "x", NX, x_dimid) )
> > > --------------^
> > > simple_xy_wr.f90(72): error #6404: This name does not have a type, and
> > must
> > > have an explicit type.   [NF90_DEF_VAR]
> > > call check( nf90_def_var(ncid, "data", NF90_INT, dimids, varid) )
> > > --------------^
> > > simple_xy_wr.f90(75): error #6404: This name does not have a type, and
> > must
> > > have an explicit type.   [NF90_ENDDEF]
> > > call check( nf90_enddef(ncid) )
> > > --------------^
> > > simple_xy_wr.f90(80): error #6404: This name does not have a type, and
> > must
> > > have an explicit type.   [NF90_PUT_VAR]
> > > call check( nf90_put_var(ncid, varid, data_out) )
> > > --------------^
> > > simple_xy_wr.f90(84): error #6404: This name does not have a type, and
> > must
> > > have an explicit type.   [NF90_CLOSE]
> > > call check( nf90_close(ncid) )
> > > --------------^
> > > simple_xy_wr.f90(92): error #6404: This name does not have a type, and
> > must
> > > have an explicit type.   [NF90_NOERR]
> > > if(status /= nf90_noerr) then
> > > -----------------^
> > > simple_xy_wr.f90(93): error #6404: This name does not have a type, and
> > must
> > > have an explicit type.   [NF90_STRERROR]
> > > print *, trim(nf90_strerror(status))
> > > --------------------^
> > > simple_xy_wr.f90(93): error #6362: The data types of the argument(s) are
> > > invalid.   [TRIM]
> > > print *, trim(nf90_strerror(status))
> > > --------------------^
> > > compilation aborted for simple_xy_wr.f90 (code 1)
> > >
> > > However, If I do:*
> > > victor@antares
> > :~/local/sublocal/netcdf-fortran-netcdf-fortran-4.2/examples/F90$
> > > gfortran -o testF90 -I/usr/include/ simple_xy_wr.f90 -lnetcdff -lnetcdf*
> > >
> > > I got the file:
> > > victor@antares
> > :~/local/sublocal/netcdf-fortran-netcdf-fortran-4.2/examples/F90$
> > > ./testF90
> > > 0          12          24          36
> > > *** SUCCESS writing example file simple_xy.nc!
> > >
> > > It is weird because at the F77 folder, things work well:
> > > victor@antares
> > :~/local/sublocal/netcdf-fortran-netcdf-fortran-4.2/examples/F77$
> > > ifort -o testF77 -I/home/victor/local/sublocal/ simple_xy_wr.f -lnetcdff
> > > -lnetcdf
> > > victor@antares
> > :~/local/sublocal/netcdf-fortran-netcdf-fortran-4.2/examples/F77$
> > > ls -lt
> > > total 1640
> > > -rwxrwxr-x 1 victor victor 666014 Aug 23 13:25 testF77
> > > .
> > > .
> > > .
> > > then:
> > > victor@antares
> > :~/local/sublocal/netcdf-fortran-netcdf-fortran-4.2/examples/F77$
> > > ./testF77
> > > *** SUCCESS writing example file simple_xy.nc!
> > >
> > > Regards
> > > Victor Torres
> > >
> > >
> > > 2013/8/23 Unidata netCDF Support <address@hidden>
> > >
> > > > Hi Victor,
> > > >
> > > > The "make check" you attached shows all tests passes and the library
> > was
> > > > built successfully.
> > > >
> > > > Did you run "make install" after running "make check" to get the netCDF
> > > > Fortran library installed in /home/victor/local/sublocal/lib ?
> > > >
> > > > If not, that is the problem.
> > > >
> > > > Also, you say
> > > > > ifort -o testF90 -I/home/victor/local/sublocal/ simple_xy_wr.f90
> > > > -lnetcdff
> > > > > -lnetcdf .... DOES NOT WORK :S!!
> > > >
> > > > What is the error message that indicates the compile and link didn't
> > work?
> > > >
> > > > --Russ
> > > >
> > > > > I've trying to install the fortran 90 library for NetCDF using intel
> > > > > compilers, eveything succeeded but when I compile with F90 it does
> > not
> > > > work
> > > > > (it compiled with gfortran!!!), it works pretty well with intel C
> > (ICC),
> > > > > intel fortran77 (ifort), but not with intel fortran90 (ifort).
> > > > > Do you know why?
> > > > >
> > > > > I am using*:
> > > > > *Intel(R) Fortran Intel(R) 64 Compiler XE for applications running on
> > > > > Intel(R) 64, Version 13.1.3.192 Build 20130607
> > > > > Intel(R) C Intel(R) 64 Compiler XE for applications running on
> > Intel(R)
> > > > 64,
> > > > > Version 13.1.3.192 Build 20130607*
> > > > > ***
> > > > > The variables I am using are:
> > > > >
> > > > > 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'
> > > > > export CPPFLAGS='-I/home/victor/local/sublocal/include'
> > > > > export LDFLAGS='-L/home/victor/local/sublocal/lib'
> > > > > export F90FLAGS='-O3 -xHost -ip -no-prec-div -static-intel'
> > > > > *
> > > > > *Here I attach a "make check"-file and the config.log file.
> > > > >
> > > > > to run the programs I give the following orders:
> > > > > Using gfortran:
> > > > > gfortran -o test1 -I/usr/include/ simple_xy_wr.f90 -lnetcdff -lnetcdf
> > > > > (OK)
> > > > >
> > > > > Using intel C compiler
> > > > > icc -o testC -I/home/victor/local/sublocal/ simple_xy_wr.c -lnetcdff
> > > > > -lnetcdf      (OK)
> > > > >
> > > > > Using intel F77 compiler
> > > > > ifort -o testF77 -I/home/victor/local/sublocal/ simple_xy_wr.f
> > -lnetcdff
> > > > > -lnetcdf   (OK)
> > > > >
> > > > > Using intel F90 compiler
> > > > > ifort -o testF90 -I/home/victor/local/sublocal/ simple_xy_wr.f90
> > > > -lnetcdff
> > > > > -lnetcdf .... DOES NOT WORK :S!!
> > > > >
> > > > > Also, the version for the netcdf-fortran library is:
> > > > > netcdf-fortran-netcdf-fortran-4.2
> > > > >
> > > > > I hope you can help me.
> > > > >
> > > > > Regards
> > > > > Victor Torres
> > > > >
> > > > >
> > > > Russ Rew                                         UCAR Unidata Program
> > > > address@hidden                      http://www.unidata.ucar.edu
> > > >
> > > >
> > > >
> > > > Ticket Details
> > > > ===================
> > > > Ticket ID: NKE-128213
> > > > Department: Support netCDF
> > > > Priority: Normal
> > > > Status: Closed
> > > >
> > > >
> > >
> > >
> > Russ Rew                                         UCAR Unidata Program
> > address@hidden                      http://www.unidata.ucar.edu
> >
> >
> >
> > Ticket Details
> > ===================
> > Ticket ID: NKE-128213
> > Department: Support netCDF
> > Priority: Normal
> > Status: Closed
> >
> >
> 
> 
Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: NKE-128213
Department: Support netCDF
Priority: Normal
Status: Closed