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

[netCDF #RZH-144666]: NETCDF 4.1.1, ifort 12.0, Mac 10.6.6



> 
> 
> I have also sent this help request to Intel.
> 
> I am trying to build NETCDF 4.1.1, then linking to it from a Fortran
> application which is built using ifort. I am building from Makefile's,
> not Xcode.
> 
> The NETCDF library libnetcdff.a is a static library for linking to F90
> applications.
> 
> I cannot seem to get a combination of compiler/options for building
> NETCDF and for my app which doesn't run into a problem with trailing
> underscores. I have tried combinations of ifort and gfortran as well.
> 
> Variations of -assume underscore and -assume nounderscore just changes
> the set of symbols which are not resolved.
> 
> There is an article on building NETCDF, but it refers to NETCDF 3.6.s
> and ifort 10.0 (I'm using 4.1.1 and 12.0 resp.). The title is
> 
> "Performace Tools for Software Developers - Building NetCDF* with the
> Intel(R) Compilers"
> 
> As an aside: Can you tell me more about
> -assume (no)2underscores
> Does no2underscores cause "XXX_" to go to "XXX" or "XXX_"?
> 
> This is a messy problem. Any help appreciated.
> 
> I have additional information on this question:
> 
> As an example, I concentrate on the following symbol from libnetcdff.a:
> _netcdf_mp_nf90_get_var_2d_eightbyteint_
> 
> If I I link my in ifort application with
> -assume nounderscore -assume no2underscores
> the error message associate with this symbol indicates the linker is
> looking for
> _netcdf_mp_nf90_get_var_2d_eightbyteint
> That is, NO trailing underscore.
> 
> Similarly for the option combination
> -assume nounderscore -assume 2underscores
> 
> For
> -assume underscore -assume 2underscores
> the symbol being sought is
> _netcdf_mp_nf90_get_var_2d_eightbyteint__
> That is, TWO trailing underscores.
> 
> FInally, if I use
> -assume underscore -assume no2underscores
> I have not problem with this symbol.  BUT,
> in this case it appears that self-references within libnetcdff.a
> are screwed up.  Here is the beginning of the error listing:
> Building executable bin/main...
> 
> ifort -Llib/ -L/usr/local/lib/ -L/usr/local/silo/silo-4.8-bsd/lib/
> -L/opt/local/lib/ -L/opt/intel/mkl/lib/ -L/opt/intel/lib/  -o bin/main
> bin/main.o obj/constants.o obj/utilities.o obj/cdf.o -liomp5 -limf
> -lsvml -lifcoremt -lifport -lnetcdff -lsiloh5 -lhdf5 -lmkl_intel_ilp64
> -lmkl_intel_thread -lmkl_core -lmkl_intel_ilp64 -lmkl_intel_thread
> -lmkl_core -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core
> 
> Undefined symbols:
> "_nc_inq_varname", referenced from:
> _nf_inq_varname_ in libnetcdff.a(fort-genvar.o)
> "_nc_inq_enum_ident", referenced from:
> _nf_inq_enum_ident_ in libnetcdff.a(fort-nc4.o)
> "_nc_inq_vlen", referenced from:
> _nf_inq_vlen_ in libnetcdff.a(fort-nc4.o)
> "_nc_inq_opaque", referenced from:
> _nf_inq_opaque_ in libnetcdff.a(fort-nc4.o)
> "_nc_inq_var_endian", referenced from:
> _nf_inq_var_endian_ in libnetcdff.a(fort-nc4.o)
> 
> ...
> 
> So for instance, "_nc_inq_varname_", a symbol in libnetcdff.a is
> apparently trying to reference itself, but without the trailing
> underscore.
> 
> Again, any help appreciated.
> 
> –––––––––––––––––––––––––––––
> Jeffrey E. McAninch
> 
> address@hidden
> work: 505-471-2050
> cell: 505-412-5050
> 
> 
> 

Howdy Jeffrey!

It's ugly but netcdf uses a package called cfortran.h to fake up fortran 
functions for your compiler. It figures out what underscore system to use based 
on a C pre-processor flag that you set before building netCDF.

The flag for ifort is -DpgiFortran.

So do a make clean, rerun the netcdf configure after setting 
CPPFLAGS=-DpgiFortran.

Good luck,

Ed

Ticket Details
===================
Ticket ID: RZH-144666
Department: Support netCDF
Priority: Emergency
Status: Closed