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

[netCDF #LIF-523916]: Trouble compiling netcdf-4.1.1 (and 4.1.3) using gcc44



Hi Remy,

Sorry it has taken so long to respond to your question.
> I am getting the error message regarding the possibility to link on the
> nf_* functions (please see attached logs, for detailed infos)
> 
> libtool: link: gfortran44 -I../fortran -I../libsrc -I../fortran -I../f90
> -fno-second-underscore -o nf_test test_get.o test_put.o nf_error.o
> nf_test.o test_read.o test_write.o util.o fortlib.o
> -L/usr/kerberos/lib64 ../libsrc/.libs/libnetcdf.a -lcurl -ldl
> -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lidn -lssl -lcrypto -lz
> test_get.o: In function `test_nf_get_var1_text_':
> test_get.F:(.text+0x2c): undefined reference to `nf_open_'
> test_get.F:(.text+0xfe): undefined reference to `nf_get_var1_text_'
> test_get.F:(.text+0x148): undefined reference to `nf_get_var1_text_'
> test_get.F:(.text+0x1f6): undefined reference to `nf_get_var1_text_'
> test_get.F:(.text+0x389): undefined reference to `nf_get_var1_text_'
> test_get.F:(.text+0x545): undefined reference to `nf_close_'
> test_get.o: In function `test_nf_get_var1_int1_':
> test_get.F:(.text+0x5b2): undefined reference to `nf_open_'
> test_get.F:(.text+0x67e): undefined reference to `nf_get_var1_int1_'
> test_get.F:(.text+0x6c2): undefined reference to `nf_get_var1_int1_'
> test_get.F:(.text+0x76a): undefined reference to `nf_get_var1_int1_'
> test_get.F:(.text+0x8f7): undefined reference to `nf_get_var1_int1_'
> test_get.F:(.text+0xab3): undefined reference to `nf_close_'
> 
> 
> [root@rocks.public netcdf-4.1.1]$./configure --disable-netcdf-4 &>
> logconfigure
> [root@rocks.public netcdf-4.1.1]$make check &> logmakecheck
> 
> I did follow the first advice on this page, to no avail.
> http://www.unidata.ucar.edu/software/netcdf/docs/known_symptoms.html
> 
> Here is my latest environment for compiling
> 
> export CC=gcc44
> export FC=gfortran44
> export CPPFLAGS="-Df2cFortran"
> export CFLAGS=$CPPFLAGS
> export FFLAGS="-fno-second-underscore"
> export FCFLAGS="-fno-second-underscore"

Can you make a link so that "gcc44" is called just "gcc" and similarly
"gfortran44" is called just "gfortran".  If necessary, you could put the
alias symbolic links in your bin directory and make sure it's in your
PATH environment variable.  The reason to change the name is that the
configure script uses some pattern matching on compiler names to try
to figure out how to set up the way the Fortran compiler calls C functions,
becasue that was not standard in Fortran90 or Fortran95.  (Soon we will
make this easier by changing the Fortran to call C using the Fortran-2003
standard for C interoperability and such problems will go away).

For gfortran, you should either not use CPPFLAGS, or set it as

  export CPPFLAGS="-DgFortran"

as is noted in the Linux section of this installation document:

  http://www.unidata.ucar.edu/netcdf/docs/netcdf-install/Platform-Notes.html

Finally, do not set these environment variables this way:

> export CFLAGS=$CPPFLAGS
> export FFLAGS="-fno-second-underscore"
> export FCFLAGS="-fno-second-underscore"

You do not need to set CFLAGS if CPPFLAGS is set.  You should not use the
-fno-second-underscore for the Fortran compiler for gfortran 4.4, although
it may have been needed for an earlier version of gfortran.

Please let us know if the above doesn't work.  You should probably run
"make distclean" first or unpack a new distribution to try this.

--Russ

Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: LIF-523916
Department: Support netCDF
Priority: Normal
Status: Closed