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

[netCDF #GNM-404229]: Building netcdf 4.1-beta2 on Linux with Sun Studio 12 Update 1 compiler suite



> Hello,
> 
> I've eventually managed to build the recent netcdf-v4.1-beta2 on Linux
> (more precisely, on a Suse 11.1 distribution) using the Sun Studio 12
> Update 1 C, C++ and Fortran compilers.
> 
> There were a few glitches that I could solve (and one I couldn't so far
> - see point 5 below...).
> 
> This is what I stumbled into:
> 
> 1) During configuration, an autoconf test for long long (and unsigned long
> long) integers fails with Sun's C preprocessor.
> 
> It seems that this is an issue common to many compilers; in the
> most recent version of autoconf (2.65), the preprocessor parts of
> the long long tests have  been disabled for this reason. I got
> configure to work by running 'autoreconf' with v2.65 of autoconf
> installed, in effect replacing the files in the netcdf distribution
> which were created using v2.63 of autoconf.

Thanks for solving this mystery. I have also upgraded to autoconf 2.65.

> 
> 2) The cxx4 part of the netcdf distribution uses __FUNCTION__ macros
> in several places. __FUNCTION__ is a gcc specific extension of the C
> and C++ standards.  The Sun compiler instead supports __func__ from
> the C99 standard.
> 
> I helped myself with having a definition -D__FUNCTION__=__func__ in
> my CPPFLAGS.

We are replacing all that code in the next release.

> 
> 3) One test in nctest was originally failing (in nctest/slabs.c) with an
> error message saying
> 
> ncvarget got wrong value for point
> 
> on which I have found a few other posts in your support archive, mostly
> related to the PGI compiler.
> 
> After some debugging, I found out that this is probably related to
> the optimisations performed by the Sun compiler(s) due to the use
> of the -fast switch. I added a printf() statement in line 222 of
> slabs.c (see the attached patch for that file) at the end of the
> "get an interim point" loop displaying the values of idim and
> point[idim]; the test was running fine afterwards. I doubt that
> this is a proper fix for the test as it produces additional
> unwanted output; but probably you know other and better ways to
> prohibit the unwanted optimisation features.

Thanks.

> 
> 4) There still are a couple of errors or warnings saying
> 
> NetCDF: Numeric conversion not representable
> 
> in the nc_test and nf_test collections of tests. In the past (with
> older versions of netCDF) I got these mostly due to NaNs or Infs in
> doubles not being converted properly into their float
> counterparts by the compiler; I had to add (say) an explicit real
> () when writing double NaNs into float variables in a netcdf file.
> 
> In your experience, are these error messages likely to be related
> to the same problem, or is v4.1 of netCDF supposed to handle the
> required conversions completely autonomously (in which case I would
> try to find out where the problem occurs precisely...)
> 

Sorry, I don't know the answer to that question. However, 4.0 will not do 
anything different from 3.x in this regard.

> 5) Finally, this is the sequence of commands I used to get the library
> compiled:
> 
> echo "Patching test program..."
> patch -p1 < ../patch_nctest_slabs_netcdf-4.1-beta2-linux-11.1-sun.patch
> 
> echo "Running autoreconf (and cleaning up)..."
> autoreconf
> rm -fr autom4te.cache
> 
> echo "Running configure..."
> CC=suncc CPPFLAGS="-DsunFortran -D__FUNCTION__=__func__" CFLAGS="-fast" \
> CXX=sunCC CXXFLAGS="-fast" \
> F77=sunf77 FFLAGS="-dalign -fast"          \
> FC=sunf95 FCFLAGS="-dalign -fast"          \
> ./configure --enable-netcdf-4              \
> --enable-dap                   \
> --enable-ncgen4                \
> --enable-shared                \
> --enable-separate-fortran      \
> --enable-cxx4                  \
> --enable-docs-install          \
> --enable-udunits               \
> --disable-logging              \
> --with-hdf5=$PREFIX            \
> --with-zlib=/usr               \
> --with-szlib=$PREFIX           \
> --prefix=$PREFIX
> 
> make
> make install
> 
> where PREFIX is an environment variable pointing to the installation
> root directory (like /usr/local or so)
> 
> Many thanks, and a Merry Christmas and Happy New Year to all of you at
> Unidata,
> 

Thanks, I've put those details on our other builds page.

Ed

Ticket Details
===================
Ticket ID: GNM-404229
Department: Support netCDF
Priority: Critical
Status: Closed