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