NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Re: [netcdfgroup] Building NetCDF 4.1.3 with two different compilers

I *think* I got around this by editing fortran/ncfortran.h and removing all the 
lines that look like this:

#define nf_inq_libvers          nf_inq_libvers_
#define nf_strerror             nf_strerror_
#define nf_issyserr             nf_issyserr_

This is a kludgy work-around, so I'd appreciate knowing if there's a better way.

I'm going to try building the other software against this version now.

--Mary



On Dec 6, 2011, at 11:42 AM, Mary Haley wrote:

> 
> I'm running into an oddity when building NetCDF 4.1.3 on the same Linux 
> system, but with different versions of gcc and gfortran (4.1.2 versus 4.4.4). 
> 
> When I use 4.1.2, I don't get a second underscore after Fortran routine 
> names, when the Fortran routine name already has an underscore.  When I use 
> 4.4.4, I get this second underscore, which causes an undefined reference when 
> linking NetCDF with another package.
> 
> I need to know how I can make sure that second underscore doesn't get 
> appended?
> 
> --------------------------------------------------------------------------------------------------
> 
> For gcc/gfortran 4.1.2, I'm using the following settings:
> 
> setenv CPPFLAGS 
> '-I/glade/proj2/ncldev/install/mirage/netcdf-4.1.3-esmf/include 
> -I/glade/proj2/ncldev/install/mirage/external/include'
> setenv LDFLAGS '-L/glade/proj2/ncldev/install/mirage/netcdf-4.1.3-esmf/lib 
> -L/glade/proj2/ncldev/install/mirage/external/lib'
> 
> setenv FC gfortran
> setenv F77 gfortran
> setenv F90 gfortran
> setenv CC gcc
> setenv CXX g++
> 
> setenv CFLAGS -fPIC
> setenv FFLAGS '-fPIC -fno-second-underscore'
> setenv F90FLAGS '-fPIC -fno-second-underscore'
> setenv FCFLAGS '-fPIC -fno-second-underscore'
> setenv CXXFLAGS -fPIC
> 
> make clean
> make distclean
> 
> ./configure --disable-netcdf-4 --disable-dap --enable-f90 --disable-shared 
> --prefix=/glade/proj2/ncldev/install/mirage/netcdf-4.1.3-esmf
> 
> make all install
> make install
> 
> and I get what I'd expect:
> 
> % nm /glade/proj2/ncldev/install/mirage/netcdf-4.1.3-esmf/lib/libnetcdff.a | 
> grep nf_inq_libvers
> 0000000000000333 T nf_inq_libvers_
>                 U nf_inq_libvers_
> 
> Note there's only one underscore after "nf_inq_libvers" in both cases.
> 
> --------------------------------------------------------------------------------------------------
> For gcc/gfortran 4.4.4, I only change the following settings:
> 
> setenv FC gfortran44
> setenv F77 gfortran44
> setenv F90 gfortran44
> setenv CC gcc44
> setenv CXX g++44
> 
> I then get:
> 
> % nm /glade/proj2/ncldev/install/mirage/netcdf-4.1.3-esmf/lib/libnetcdff.a | 
> grep nf_inq_libvers
> 0000000000000301 T nf_inq_libvers__
>                 U nf_inq_libvers_
> 
> Note the second underscore in one case, but not the other.
> 
> --------------------------------------------------------------------------------------------------
> 
> Is there some code I can modify to make sure that second underscore doesn't 
> get added?
> 
> Thanks,
> 
> --Mary
> 
> _______________________________________________
> netcdfgroup mailing list
> netcdfgroup@xxxxxxxxxxxxxxxx
> For list information or to unsubscribe,  visit: 
> http://www.unidata.ucar.edu/mailing_lists/ 



  • 2011 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: