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

[netCDF #SKD-481794]: Trying to build netcdf with Absoft 10.1 compiler



>
> I have more information about this issue. I need the Fortran90
> interface and maybe for good measure the F77 interface.  I believe it
> is entirely a name mangling issue. I've worked at this very hard for
> a couple of weeks.  I hope you can help.

Howdy Don!

Sorry it has taken so long to get to your issue. We got a little swamped in
December and January and are just digging back out from under...

If you want the F90 API, you must also build the F77 API, as the F90 API uses
it.

You should certainly upgrade your netCDF distribution to 3.6.3, which has a
number of build system improvements.

>
> Although I have tried a near infinite set of combinations of
> environment settings I come back to where I started.   I started with
> the information on your web site in:
>
http://www.unidata.ucar.edu/software/netcdf/docs/other-builds.html#macos-10.5-absoft
>
> I used the environment settings used by Thomas Schrader:
>
> export PATH=/usr/local/bin:/usr/bin:/bin
> export FC=/Applications/Absoft10.1/bin/f90
> export F90=/Applications/Absoft10.1/bin/f90
> export CC=gcc
> export CFLAGS=-DAbsoftProFortran
> export CXXFLAGS=-DAbsoftProFortran
> export CPPFLAGS=-DAbsoftProFortran
>

It is not necessary to set -DAbsoftProFortran in both CFLAGS and CPPFLAGS. Just
CPPFLAGS is needed.

Also, if you are not using C++ may I suggest using the --disable-cxx configure
option, and not bothering with setting the CXX and CXXFLAGS.

In general it works better to put the compiler directory
(/Applications/Absoft10.1/bin/) in your path, and set FC=f90.

Finally, there is not need to set the F90 environment variable. The FC variable
will be used for both F77 and F90 compilation, as it should be.

> except that I had to add /bin and usr/bin to the path to get basic
> tools needed by configure and make.  When I do configure -> make ->
> make check with these settings all the Fortran tests fail.  Running
> nm on the libnetcdf.a file shows that:
>
> Under the 'libnetcdf.a(netcdf.o):' nm  output
> <many lines>
> 00000056 T ___NF90_STRERROR.in.NETCDF
> 000bd142 s ___NF90_STRERROR.in.NETCDF$stub
> 0000046c T ___NF90_SYNC.in.NETCDF
> 000bd1b5 s ___NF90_SYNC.in.NETCDF$stub
> U __absoft_casgn
> 000bd660 s __absoft_casgn$stub
> U __absoft_len_trim
> 000bd665 s __absoft_len_trim$stub
> U _nf__create_
> 000bd16a s _nf__create_$stub
> <many more lines>
>
> The F90 symbol names are in the Absoft format.  The external names it
> is looking for are things like '_nf_create_'.  When I look in the nm
> output for 'libnetcdf.a(fort-control.o):' I find:
>
> 000002ac T _NF_CREATE
>
> I.e. the names are uppercase with no trailing underscore.  I believe
> this inconsistency is the problem.  I have tried every combination of
> compiler flags I can think of the make these agree with no luck.  In
> fact I haven't found that the FFLAGS variable has any effect
> whatsoever.

The FCFLAGS is used with F90 code, the FFLAGS with F77 code. I have just
checked this in the codebase and it seems to be working fine.

>
> Actually I'm pretty sure that the Absoft F77 compiler is not being
> used at all although the Absoft F90 compiler is.  Looking at the
> config log I see:
>
> configure:5074: checking whether we are using the GNU Fortran compiler
> configure:5093: /Applications/Absoft10.1/bin/f90 -c   conftest.F >&5
> configure:5100: $? = 0
> configure:5117: result: yes
>
> This is confusing It mentions /Absoft10.1/bin/f90 but then says 'yes'
> we are using the gnu fortran compiler.
> When I look at the make output.  I gather that the F77 interface is
> compiled from C using gcc and then processed by f2cfortran,  Then the
> f77 object file is linked by gcc.  The following lines from make
> output lead me to believe that:
>
> Making all in fortran
>
> <several lines>
>
> libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I../libsrc
> -DAbsoftProFortran -DAbsoftProFortran -MT fort-control.lo -MD -MP -MF
> .deps/fort-control.Tpo -c fort-control.c -o fort-control.o
> depbase=`echo fort-dim.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
> /bin/sh ../libtool --tag=CC   --mode=compile gcc
> -DHAVE_CONFIG_H -I. -I..     -I../libsrc  -DAbsoftProFortran
> -DAbsoftProFortran -MT fort-dim.lo -MD -MP -MF $depbase.Tpo -c -o
> fort-dim.lo fort-dim.c &&\
> mv -f $depbase.Tpo $depbase.P
>
> <many lines>
>
> libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I../libsrc
> -DAbsoftProFortran -DAbsoftProFortran -MT fort-varsio.lo -MD -MP -MF
> .deps/fort-varsio.Tpo -c fort-varsio.c -o fort-varsio.o
> /bin/sh ../libtool --tag=CC   --mode=link gcc  -DAbsoftProFortran
> -o libnetcdff.la  fort-attio.lo fort-control.lo fort-dim.lo
> fort-genatt.lo fort-geninq.lo fort-genvar.lo fort-lib.lo fort-misc.lo
> fort-v2compat.lo fort-vario.lo fort-var1io.lo fort-varaio.lo
> fort-varmio.lo fort-varsio.lo  ../f90/libnetcdff90.la
> libtool: link: (cd .libs/libnetcdff.lax/libnetcdff90.a && ar x
>
"/Users/dbh/Fortran_progs_INTEL/netcdf-3.6.3/fortran/../f90/.libs/libnetcdff90.a")
> libtool: link: ar cru .libs/libnetcdff.a  fort-attio.o fort-control.o
> fort-dim.o fort-genatt.o fort-geninq.o fort-genvar.o fort-lib.o
> fort-misc.o fort-v2compat.o fort-vario.o fort-var1io.o fort-varaio.o
> fort-varmio.o fort-varsio.o
> .libs/libnetcdff.lax/libnetcdff90.a/netcdf.o
> .libs/libnetcdff.lax/libnetcdff90.a/typeSizes.o
> libtool: link: ranlib .libs/libnetcdff.a
> libtool: link: rm -fr .libs/libnetcdff.lax
> libtool: link: ( cd ".libs" && rm -f "libnetcdff.la" && ln -s
> "../libnetcdff.la" "libnetcdff.la" )
> Making all in libsrc
>
> So I don't see that the Absoft f77 compiler is used at all, so it's
> no surprise that the name conventions don't match.  Furthermore
> looking at the 'make check' output I see that the test programs are
> being compiled with gfortran, e.g.
>
> gfortran: unrecognized option '-p../f90'
> /usr/local/bin/gfortran -DHAVE_CONFIG_H -I. -I.. -I../fortran
> -DAbsoftProFortran -I../fortran      -I../libsrc -I../fortran
> -p../f90 -g -O2 -c -o util.o util.F
> gfortran: unrecognized option '-p../f90'
> depbase=`echo fortlib.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
> gcc -DHAVE_CONFIG_H -I. -I.. -I../fortran
> -DAbsoftProFortran  -DAbsoftProFortran -MT fortlib.o -MD -MP -MF
> $depbase.Tpo -c -o fortlib.o fortlib.c &&\
> mv -f $depbase.Tpo $depbase.Po
> /bin/sh ../libtool --tag=F77   --mode=link /usr/local/bin/gfortran
> -I../fortran      -I../libsrc -I../fortran  -p../f90 -g -O2        -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      ../libsrc/libnetcdf.la
> libtool: link: /usr/local/bin/gfortran -I../fortran -I../libsrc
> -I../fortran -p../f90 -g -O2 -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
> ../libsrc/.libs/libnetcdf.a
> gfortran: unrecognized option '-p../f90'
> Undefined symbols:
> "_nf_put_var_real_", referenced from:
> _test_nf_put_var_real_ in test_put.o
> _test_nf_put_var_real_ in test_put.o
> _test_nf_put_var_real_ in test_put.o
> _test_nf_put_var_real_ in test_put.o
> _test_nf_put_var_real_ in test_put.o
>
>
>
>
> --
> Donald B. Batchelor
> Plasma Theory Group

Well in this case you are certainly using gfortran (which will not work with
the CPPFLAGS you have set), but this is not the case in the configure output
you sent with your original support message, which makes me suspect you reran
configure without setting the FC to the absoft compiler.

Get the netCDF daily snapshot release
(ftp://ftp.unidata.ucar.edu/pub/netcdf/snapshot/netcdf-4-daily.tar.gz) and try
again, this time setting the following:

export PATH=/Applications/Absoft10.1/bin/:$PATH
export FC=f90
export CPPFLAGS=-DAbsoftProFortran

Then run configure and make check.

If this still doesn't work, do a "make distclean" and try again, with a
CPPFLAGS of -DAbsoftUNIXFortran.

If that doesn't work either, please send me the complete output of configure
and make, and the config.log file.

Thanks,

Ed

Ticket Details
===================
Ticket ID: SKD-481794
Department: Support netCDF
Priority: High
Status: Closed