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

[netCDF #OAL-569939]: link issue



I see. It must be a typo. Let me see if I can find it.

> 
> No, I have the libnetcdf.a also linked.
> 
> When I use nm on libnetcdf.a , it gives the following:
> nm libnetcdf.a | grep nc_inq_type
> U nc_inq_type
> 00000000000011c0 T nc_inq_type
> 
> but there is nothing for nc_inq_types
> nm libnetcdf.a | grep nc_inq_types
> 
> Liz
> 
> 
> 
> ________________________________
> From: Unidata netCDF Support <address@hidden>
> Sent: Tuesday, April 30, 2019 2:04 PM
> To: Adams, Liz
> Cc: address@hidden
> Subject: [netCDF #OAL-569939]: link issue
> 
> Those undefines in libnetcdff should match defined symbols in libnetcdf.
> Did you forget to add -lnetcdf to your linking commands?
> 
> >
> > I am seeing that the symbol is undefined when I use nm to look at the 
> > libnetcdff.a
> > Is there an incompatibility between the C and Fortran version I am using?
> >
> > /proj/ie/proj/staff/lizadams/netcdf-c-4.6.2-rc2/netcdf-fortran/fortran/nf_lib.c:184:
> >  undefined reference to `nc_inq_typeids'
> >
> > [lizadams@dogwood-login1 lib]$ nm libnetcdff.a | grep nc_inq
> > U nc_inq_base_pe
> > U nc_inq_path
> > U nc_inq_dim
> > U nc_inq_dimid
> > U nc_inq_dimlen
> > U nc_inq_dimname
> > U nc_inq_libvers
> > U nc_inq_att
> > U nc_inq_attid
> > U nc_inq_attlen
> > U nc_inq_attname
> > U nc_inq_atttype
> > U nc_inq
> > U nc_inq_format
> > U nc_inq_natts
> > U nc_inq_ndims
> > U nc_inq_nvars
> > U nc_inq_unlimdim
> > U nc_inq_var
> > U nc_inq_vardimid
> > U nc_inq_varid
> > U nc_inq_varname
> > U nc_inq_varnatts
> > U nc_inq_varndims
> > U nc_inq_vartype
> > U nc_inq_varndims
> > U nc_inq_varndims
> > U nc_inq_varndims
> > U nc_inq_varndims
> > U nc_inq_compound_field
> > 0000000000000250 T nc_inq_compound_field_f
> > 0000000000000230 T nc_inq_compound_field_ndims
> > U nc_inq_dimids
> > 00000000000000b0 T nc_inq_dimids_f
> > U nc_inq_grps
> > 0000000000000310 T nc_inq_numgrps
> > 0000000000000320 T nc_inq_numtypes
> > U nc_inq_typeids
> > U nc_inq_varids
> > 0000000000000000 T nc_inq_varids_f
> > U nc_inq_compound
> > U nc_inq_compound_fielddim_sizes
> > U nc_inq_compound_field_f
> > U nc_inq_compound_fieldindex
> > U nc_inq_compound_fieldname
> > U nc_inq_compound_fieldndims
> > U nc_inq_compound_field_ndims
> > U nc_inq_compound_fieldoffset
> > U nc_inq_compound_fieldtype
> > U nc_inq_compound_name
> > U nc_inq_compound_nfields
> > U nc_inq_compound_size
> > U nc_inq_dimids_f
> > U nc_inq_enum
> > U nc_inq_enum_ident
> > U nc_inq_enum_member
> > U nc_inq_grp_full_ncid
> > U nc_inq_grpname
> > U nc_inq_grpname_full
> > U nc_inq_grpname_len
> > U nc_inq_grp_ncid
> > U nc_inq_grp_parent
> > U nc_inq_grps
> > U nc_inq_ncid
> > U nc_inq_numgrps
> > U nc_inq_numtypes
> > U nc_inq_opaque
> > U nc_inq_type
> > U nc_inq_typeid
> > U nc_inq_typeids
> > U nc_inq_user_type
> > U nc_inq_var_chunking_ints
> > U nc_inq_var_deflate
> > U nc_inq_var_endian
> > U nc_inq_var_fill
> > U nc_inq_var_fletcher32
> > U nc_inq_varids_f
> > U nc_inq_varndims
> > U nc_inq_var_szip
> > U nc_inq_vlen
> > U nc_inq_attlen
> > U nc_inq_atttype
> > U nc_inq_dimlen
> > U nc_inq_vardimid
> > U nc_inq_varndims
> > U nc_inq_vartype
> > U nc_inq_dimlen
> > U nc_inq_vardimid
> > U nc_inq_varndims
> > U nc_inq_vartype
> > U nc_inq_varndims
> >
> > These symbols were also unresolved for other compilers such as intel, but 
> > only gcc complained.
> >
> > I was able to get the mcip.exe to build using
> > https://stackoverflow.com/questions/5555632/can-gcc-not-complain-about-undefined-references
> >
> > LIBS    = -L$(IOAPI_ROOT) -lioapi  \
> > -L$(NETCDF)/lib -lnetcdff -lnetcdf -lnetcdf 
> > -Wl,--unresolved-symbols=ignore-in-object-files
> >
> > [https://cdn.sstatic.net/Sites/stackoverflow/img/address@hidden?v=73d79a89bded]<https://stackoverflow.com/questions/5555632/can-gcc-not-complain-about-undefined-references>
> >
> > c - Can GCC not complain about undefined references? - Stack Overflow - 
> > Stack Overflow - Where Developers Learn, Share, & Build 
> > Careers<https://stackoverflow.com/questions/5555632/can-gcc-not-complain-about-undefined-references>
> > It does not make sense at all: symbols that you wish to import aren't 
> > undefined, they are just dynamically bound. I doubt very much that you've 
> > actually tried it out and can provide some real scenario - think of a 
> > series of bash commands that create the sources, compile and link them, and 
> > dump the binaries and demonstrate those undefined-at-link-time symbols.
> > stackoverflow.com
> >
> >
> >
> > ________________________________
> > From: Unidata netCDF Support <address@hidden>
> > Sent: Monday, April 29, 2019 6:35 PM
> > To: Adams, Liz
> > Cc: address@hidden
> > Subject: [netCDF #OAL-569939]: link issue
> >
> > Hello,
> >
> > I believe you need to change the link command so that it is linking 
> > libnetcdf and then libnetcdff.  You might also try updating to the most 
> > recent versions of netCDF-C (4.6.3 at this moment, 4.7.0 later today) and 
> > netCDF-Fortran (4.4.5).
> >
> > I hope this helps,
> >
> > -Ward
> >
> > > Hi,
> > >
> > > I tried using linuxbrew on a linux server to build netcdf fortran and c 
> > > libraries.
> > > netcdf-c-4.6.2-rc2
> > >
> > > ./nc-config --all
> > >
> > > This netCDF 4.6.2-rc2 has been built with the following features:
> > >
> > > --cc            -> gcc
> > > --cflags        -> 
> > > -I/proj/ie/proj/staff/lizadams/netcdf-c-4.6.2-rc2/openmpi_3.0.0_gcc_6.3.0/include
> > > --libs          -> 
> > > -L/proj/ie/proj/staff/lizadams/netcdf-c-4.6.2-rc2/openmpi_3.0.0_gcc_6.3.0/lib
> > >  -lnetcdf
> > >
> > > --has-c++       -> no
> > > --cxx           ->
> > >
> > > --has-c++4      -> no
> > > --cxx4          ->
> > >
> > > --has-fortran   -> yes
> > > --fc            -> nf-config not yet implemented for cmake builds
> > > --fflags        -> nf-config not yet implemented for cmake builds
> > > --flibs         -> nf-config not yet implemented for cmake builds
> > > --has-f90       -> nf-config not yet implemented for cmake builds
> > > --has-f03       -> nf-config not yet implemented for cmake builds
> > >
> > > --has-dap       -> no
> > > --has-dap2      -> no
> > > --has-dap4      -> no
> > > --has-nc2       -> yes
> > > --has-nc4       -> no
> > > --has-hdf5      -> no
> > > --has-hdf4      -> no
> > > --has-logging   -> no
> > > --has-pnetcdf   -> no
> > > --has-szlib     ->
> > > --has-cdf5      -> yes
> > > --has-parallel4 -> no
> > > --has-parallel  -> no
> > >
> > > --prefix        -> 
> > > /proj/ie/proj/staff/lizadams/netcdf-c-4.6.2-rc2/openmpi_3.0.0_gcc_6.3.0
> > > --includedir    -> 
> > > /proj/ie/proj/staff/lizadams/netcdf-c-4.6.2-rc2/openmpi_3.0.0_gcc_6.3.0/include
> > > --libdir        -> 
> > > /proj/ie/proj/staff/lizadams/netcdf-c-4.6.2-rc2/openmpi_3.0.0_gcc_6.3.0/lib
> > > --version       -> netCDF 4.6.2-rc2
> > >
> > > ./nf-config --all
> > >
> > > This netCDF-Fortran 4.4.4 has been built with the following features:
> > >
> > > --cc        -> gcc
> > > --cflags    ->  
> > > -I/proj/ie/proj/staff/lizadams/netcdf-c-4.6.2-rc2/openmpi_3.0.0_gcc_6.3.0/include
> > >
> > > --fc        -> gfortran
> > > --fflags    -> 
> > > -I/proj/ie/proj/staff/lizadams/netcdf-c-4.6.2-rc2/openmpi_3.0.0_gcc_6.3.0/include
> > > --flibs     -> 
> > > -L/proj/ie/proj/staff/lizadams/netcdf-c-4.6.2-rc2/openmpi_3.0.0_gcc_6.3.0/lib
> > >  -lnetcdff  -lnetcdf -lnetcdf
> > > --has-f90   -> no
> > > --has-f03   -> yes
> > >
> > > --has-nc2   -> yes
> > > --has-nc4   -> yes
> > >
> > > --prefix    -> 
> > > /proj/ie/proj/staff/lizadams/netcdf-c-4.6.2-rc2/openmpi_3.0.0_gcc_6.3.0
> > > --includedir-> 
> > > /proj/ie/proj/staff/lizadams/netcdf-c-4.6.2-rc2/openmpi_3.0.0_gcc_6.3.0/include
> > > --version   -> netCDF-Fortran 4.4.4
> > >
> > >
> > > I am getting the following undefined references at link time for a 
> > > program called mcip, and can't figure out why.
> > > gfortran -o mcip.exe 
> > > -I/proj/ie/proj/staff/lizadams/netcdf-c-4.6.2-rc2/openmpi_3.0.0_gcc_6.3.0/include
> > >  
> > > -I/proj/ie/proj/CMAS/CMAQ/CMAQv5.3_branch_UNC3/openmpi_3.0.0_gcc_6.3.0/lib/x86_64/gcc/ioapi/modules
> > >  mcip.o alloc_ctm.o alloc_met.o alloc_x.o bcldprc_ak.o blddesc.o 
> > > chkwpshdr.o chkwrfhdr.o close_files.o collapx.o comheader.o 
> > > comheader_lufrac.o comheader_mos.o comheader_soi.o cori.o dealloc_ctm.o 
> > > dealloc_met.o dealloc_x.o detangle_soil_px.o e_aerk.o dynflds.o getgist.o 
> > > getluse.o getmet.o getpblht.o getpsih.o getsdt.o getversion.o 
> > > graceful_stop.o gridout.o init_io.o init_met.o init_x.o julian.o layht.o 
> > > ll2xy_lam.o ll2xy_lam_sec.o ll2xy_lam_tan.o ll2xy_merc.o ll2xy_ps.o 
> > > locate.o lucro.o mapfac_lam.o mapfac_merc.o mapfac_ps.o metcro.o metdot.o 
> > > metgrid2ctm.o metvars2ctm.o mm5v3opts.o moscro.o pblsup.o ptemp.o pvs.o 
> > > qsat.o rdmm5v3.o rdwrfem.o readnml.o readter.o refstate.o resistcalc.o 
> > > setgriddefs.o setup.o setup_mm5v3.o setup_wrfem.o sfclayer.o soilcro.o 
> > > statflds.o vertarys.
 o
> ve
> > rtnhy.o vertnhy_wrf.o vstamp.o vtemp.o wind.o wrfemopts.o wrgdesc.o 
> > xy2ll_lam.o xy2ll_merc.o const_mod.o const_pbl_mod.o coord_mod.o 
> > date_time_mod.o date_pack_mod.o files_mod.o groutcom_mod.o luoutcom_mod.o 
> > luvars_mod.o mcipparm_mod.o mcoutcom_mod.o mdoutcom_mod.o metinfo_mod.o 
> > metvars_mod.o mosoutcom_mod.o soioutcom_mod.o vgrd_mod.o wrf_netcdf_mod.o 
> > xvars_mod.o sat2mcip_mod.o 
> > -L/proj/ie/proj/CMAS/CMAQ/CMAQv5.3_branch_UNC3/openmpi_3.0.0_gcc_6.3.0/lib/x86_64/gcc/ioapi/lib
> >  -lioapi 
> > -L/proj/ie/proj/staff/lizadams/netcdf-c-4.6.2-rc2/openmpi_3.0.0_gcc_6.3.0/lib
> >  -lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lz
> > > /nas/longleaf/home/lizadams/.linuxbrew/Homebrew/bin/ld: 
> > > /proj/ie/proj/CMAS/CMAQ/CMAQv5.3_branch_UNC3/openmpi_3.0.0_gcc_6.3.0/lib/x86_64/gcc/ioapi/lib/libnetcdff.a(nf_nc4.o):
> > >  in function `nf_inq_ncid_':
> > > /proj/ie/proj/staff/lizadams/netcdf-c-4.6.2-rc2/netcdf-fortran/fortran/nf_nc4.f90:150:
> > >  undefined reference to `nc_inq_ncid'
> > > /nas/longleaf/home/lizadams/.linuxbrew/Homebrew/bin/ld: 
> > > /proj/ie/proj/CMAS/CMAQ/CMAQv5.3_branch_UNC3/openmpi_3.0.0_gcc_6.3.0/lib/x86_64/gcc/ioapi/lib/libnetcdff.a(nf_nc4.o):
> > >  in function `nf_inq_grps_':
> > > /proj/ie/proj/staff/lizadams/netcdf-c-4.6.2-rc2/netcdf-fortran/fortran/nf_nc4.f90:195:
> > >  undefined reference to `nc_inq_grps'
> > >
> > > Thank you for any assistance.
> > >
> > > Liz
> > >
> > >
> >
> >
> > Ticket Details
> > ===================
> > Ticket ID: OAL-569939
> > Department: Support netCDF
> > Priority: Normal
> > Status: Closed
> > ===================
> > NOTE: All email exchanges with Unidata User Support are recorded in the 
> > Unidata inquiry tracking system and then made publicly available through 
> > the web.  If you do not want to have your interactions made available in 
> > this way, you must let us know in each email you send to us.
> >
> >
> >
> >
> 
> =Dennis Heimbigner
> Unidata
> 
> 
> Ticket Details
> ===================
> Ticket ID: OAL-569939
> Department: Support netCDF
> Priority: Normal
> Status: Open
> ===================
> NOTE: All email exchanges with Unidata User Support are recorded in the 
> Unidata inquiry tracking system and then made publicly available through the 
> web.  If you do not want to have your interactions made available in this 
> way, you must let us know in each email you send to us.
> 
> 
> 
> 

=Dennis Heimbigner
  Unidata


Ticket Details
===================
Ticket ID: OAL-569939
Department: Support netCDF
Priority: Normal
Status: Open
===================
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata 
inquiry tracking system and then made publicly available through the web.  If 
you do not want to have your interactions made available in this way, you must 
let us know in each email you send to us.