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

20021101: netcdf-perl build failure with perl 5.8.0



Nate and Adam,

[I've combined my reply to your support emails because they report the
same problem. To simplify things, the following response looks I'm just
responding to Nate's email. This is merely an artifact of receiving his
first.]

> To: address@hidden
> From: Nate Huffnagle <address@hidden>
> Subject: netcdf-perl make fails
> Organization: UCAR/Unidata

The above message contained the following:

> uname: SunOS coast 5.7 Generic_106541-21 sun4u sparc SUNW,Ultra-Enterprise
> VERSION: 1.2.1
> C compiler: gcc (GCC) 3.1
> perl: This is perl, v5.8.0 built for sun4-solaris-thread-multi
> netcdf: netcdf-3.5.0
> 
> The make fails. We used gcc to compile the newer version of perl. Using
> the cc compiler gives the same errors. Same errors using netcdf-3.4 header 
> files. It will compile using an older version of perl (version 5.005_02 
> built for sun4-solaris-thread).
> 
> thanks,
> 
> -Nate-
...
> make.log:
> **************************************************************************
> making `dynamic' in directory /home/nate/src/netcdf-perl-1.2.1/src/perl
> 
> /apps/perl5/bin/perl /apps/perl5/lib/5.8.0/ExtUtils/xsubpp  -typemap 
> /apps/perl5/lib/5.8.0/ExtUtils/typemap  NetCDF.xs > NetCDF.xsc && mv 
> NetCDF.xsc NetCDF.c
> Please specify prototyping behavior for NetCDF.xs (see perlxs manual)
> gcc -c  -I/apps/include  -D_REENTRANT -fno-strict-aliasing 
> -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DSOCKS -DSOCKS -DSOCKS -DSOCKS 
> -DSOCKS -DPERL_POLLUTE -O    -DVERSION=\"^A^B^A\"  -DXS_VERSION=\"^A^B^A\" 
> -fPIC "-I/apps/perl5/lib/5.8.0/sun4-solaris-thread-multi/CORE"   NetCDF.c
> NetCDF.xs: In function `XS_NetCDF_inquire':
> NetCDF.xs:1825: parse error before '(' token
> NetCDF.xs: In function `XS_NetCDF_varinq':
> NetCDF.xs:1963: parse error before '(' token
> *** Error code 1
> make: Fatal error: Command failed for target `NetCDF.o'
> Current working directory /home/nate/src/netcdf-perl-1.2.1/src/perl
> *** Error code 1
> make: Fatal error: Command failed for target `perl/dynamic'
> Current working directory /home/nate/src/netcdf-perl-1.2.1/src
> *** Error code 1
> make: Fatal error: Command failed for target `decision'
> Current working directory /home/nate/src/netcdf-perl-1.2.1/src
> *** Error code 1
> make: Fatal error: Command failed for target `all'
> *******************************************************************************

The problem lies with perl 5.8.0 and the use of the POLLUTE perl
variable in generating the NetCDF perl module from the file
perl/NetCDF.xs.  If you do the following, then you should be able to
build the package:

    1.  Go to the top-level source directory.

    2.  Execute the command "make clean"

    3.  Remove the file perl/Makefile.

    4.  Edit the file Makefile: remove the POLLUTE=1 argument from the
        rule for making the file perl/Makefile.  Alternatively, set the 
        value of the POLLUTE variable to 0 instead of 1.

    5.  Execute the command "make".

Unfortunately, removing the use of the POLLUTE variable doesn't
solve all problems of the NetCDF module and perl 5.8.0.  Subsequent 
execution of the "make test" command reveals the following:

    ~/netcdf-perl: make test
    make[1]: Entering directory `/home/steve/netcdf-perl'

    making `test' in directory /home/steve/netcdf-perl/perl

    make[2]: Entering directory `/home/steve/netcdf-perl/perl'
    PERL_DL_NONLAZY=1 /usr/bin/perl "-Iblib/lib" "-Iblib/arch" test.pl
    Creating netCDF file...........................ok
    Setting fill mode..............................ok
    Defining fixed dimensions......................ok
    Defining fixed variables.......................ok
    Writing global attribute.......................ok
    Writing variable attributes....................ok
    Defining record dimension......................ok
    Defining record variables......................ok
    Ending definition..............................ok
    Writing fixed variable values..................ok
    Synchronizing netCDF I/O.......................ok
    Writing record values..........................ok
    Closing netCDF file............................ok
    Opening netCDF file for reading................ok
    Inquiring about netCDF file....................ok
    Checking global attribute name.................ok
    Checking global attribute value................ok
    Getting second dimension ID....................ok
    Checking second dimension information..........ok
    Checking fixed variable ID.....................ok
    Checking fixed variable information............ok
    Checking last value of first record variable...make[2]: *** [test_dynamic] 
Segmentation fault
    make[2]: Leaving directory `/home/steve/netcdf-perl/perl'
    make[1]: *** [perl/test] Error 1
    make[1]: Leaving directory `/home/steve/netcdf-perl'
    make: *** [test] Error 2

This is a very odd problem because the simple addition of a diagnostic
print statement to the test in question in file perl/test.pl:

    # Vet last value of first record variable.
    #
    @coords = (0, $#recvar0);  # moved
    print STDERR "ncid=$ncid; recvar0id=$recvar0id; coords=(@coords)\n"; # new
    print STDERR "Checking last value of first record variable...";
    NetCDF::varget1($ncid, $recvar0id, \@coords, $value) == 0 ||
        die "Couldn't get last value of first record variable\n";
    $value == $recvar0[$#recvar0] ||
        die "Incorrect last value of first record variable: ",
            "$value != $recvar0[$#recvar0]\n";
    print STDERR "ok\n";

results in success:

    PERL_DL_NONLAZY=1 /usr/bin/perl "-Iblib/lib" "-Iblib/arch" test.pl
    Creating netCDF file...........................ok
    Setting fill mode..............................ok
    Defining fixed dimensions......................ok
    Defining fixed variables.......................ok
    Writing global attribute.......................ok
    Writing variable attributes....................ok
    Defining record dimension......................ok
    Defining record variables......................ok
    Ending definition..............................ok
    Writing fixed variable values..................ok
    Synchronizing netCDF I/O.......................ok
    Writing record values..........................ok
    Closing netCDF file............................ok
    Opening netCDF file for reading................ok
    Inquiring about netCDF file....................ok
    Checking global attribute name.................ok
    Checking global attribute value................ok
    Getting second dimension ID....................ok
    Checking second dimension information..........ok
    Checking fixed variable ID.....................ok
    Checking fixed variable information............ok
    ncid=3; recvar0id=1; coords=(0 1)
    Checking last value of first record variable...ok
    Reading fixed variable values..................ok
    Reading fixed variable attributes..............ok
    Checking typelen().............................ok
    Checking number of record variables............ok
    Checking variable IDs..........................ok
    Checking variable sizes........................ok
    Reading values of record variables.............ok
    Closing netCDF file............................ok

Naturally, the values in the diagnostic message are correct.  :-)

Tracking down this problem will probably involve debugging the NetCDF.xs
module -- which is invoked by the perl program -- and will probably take
some time.

Unfortunately, I'm working on a different, time-critical project -- so I
don't know when I'll be able to debug the perl-netcdf package.  I've put
it on my list however.

Regards,
Steve Emmerson   <http://www.unidata.ucar.edu>