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

Re: 970721: netCDF3.3.1



>To: address@hidden
>From: "David Aubert (stagiaire ESSI" <address@hidden>
>Subject: netCDF3.3.1
>Organization: .
>Keywords: 199707211350.HAA05002

David,

> The problem is always here(and it's a big one :594 Mb  :) )
> 
> iapetus:~netcdf-3.3.1/src/ncdump> ls -l
> total 581277
  ...

> -rw-r--r--  1 daubert  594146256 Jul 22 10:05 test0.nc

  ...

The problem you are seeing with the ncdump test producing a huge netCDF
file is a symptom of a problem with the way gcc was installed on your
SunOS 4.1.4 platform.  The ncdump test invokes ncgen, which calls the
strtod() function to convert strings to doubles, and this won't work
unless there is a prototype for strtod() in scope telling gcc that it
returns double instead of int.  gcc is supposed to find the prototype in
the <stdlib.h> include file, but it must find this in its own "fixed"
include files, because the SunOS 4.1.4 /usr/include/stdlib.h has no
declaration for strtod().

It turns out if you look at the <stdlib.h> include file that gcc is
supposed to use, it only sees the declaration for strtod if the macro
__USE_FIXED_PROTOTYPES__ is defined, and apparently your gcc was
installed so that it doesn't predefine this macro by default.

You can verify this by compiling and running the following small program
with gcc:
-------------------------- bug.c ---------------------------
#include <stdio.h>
#include <stdlib.h>

void
main()                          /* demonstrate gcc/strtod bug */
{
    char *ptr;
    double dd;
    char *str = "2";

    dd = strtod(str, &ptr);
    if (ptr != str)    
        printf("strtod converted \"%s\" to the double %g\n", str, dd);
    else
        printf("strtod can't convert \"%s\" to double\n", str, dd);
}
------------------------------------------------------------

You will probably see something like the following output:

  strtod converted "2" to the double 8848

Now instead of using just "gcc", use "gcc -D__USE_FIXED_PROTOTYPES__"
for your compiler, and you should then get the correct output:

  strtod converted "2" to the double 2

So, to rebuild netCDF, first remove the "config.cache" file, then set the
following environment variable

  CC="gcc -D__USE_FIXED_PROTOTYPES__"

before you invoke the "configure" script, then do "make all test".

Please let us know if this doesn't work, and thanks again for reporting
the problem.

--Russ

_____________________________________________________________________

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

P.S.  I'm CC:ing our other developers, because we have the same problem
      with our gcc installation on SunOS 4.1.4.