[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
970529: problem installing netcdf-3.3
- Subject: 970529: problem installing netcdf-3.3
- Date: Thu, 29 May 97 08:52:45 -0600
Dear Steve,
> To: address@hidden
> From: Steve Sweet <address@hidden>
> Subject: problem installing netcdf-3.3
> Organization: University of Alaska
> Keywords: 199705282106.PAA19627
In the above message, you wrote:
> I have been unable to complete the make procedure for netcdf-3.3. It
> crashes trying to compile util.c because RAND_MAX is undefined.
Ah! The joys of a non-standard environment. :-)
> I
> haven't been able to find any definitions of RAND_MAX; am I missing a
> header file?
According to the C standard, RAND_MAX is defined in <stdlib.h>. Don't
bother to look -- SunOS 4 with the bundled compiler doesn't have it.
Our next release will not depend on the existance of RAND_MAX. In the
meantime, try applying the enclosed patches to files nc_test/util.c and
nf_test/fortlib.c.
Please let me know if they help.
> The only things I had to change during the process from
> your distribution was "M4 = /usr/5bin/m4" in macros.make and
> macros.make.def. I don't understand the errors in cfg.stdout -- I
> checked and both those files exist and appear valid. Below is the
> information you requested accompany questions. Thanks for you help.
>
> - - -----------------------------
> Steven Sweet Internet: address@hidden
> Research Technician Phone: (907) 474-7830
> Institute of Marine Science FAX: (907) 474-7204
> University of Alaska
> Fairbanks, Alaska 99775-7220
>
> > uname -a
> SunOS jarvis 4.1.4 2 sun4m
>
> > cat VERSION
> 3.3
>
> > cat cfg.stdout
> loading cache ./config.cache
> checking for m4... (cached) m4
> checking user-defined C compiler "gcc"
> checking C compiler... works
> checking for how to make dependencies... cc -M
> checking for gcc... (cached) gcc
> checking C++ compiler "gcc"... works
> checking user-defined FORTRAN compiler "f77"... works
> checking for math library
> checking for -lc... (cached) no
> checking for -lm... (cached) yes
> checking FORTRAN-type equivalent to netCDF "byte"... byte
> checking FORTRAN-type equivalent to C "signed char"... byte
> checking FORTRAN fill-value for netCDF version 2 byte... -127
> checking FORTRAN-type equivalent to netCDF "short"... integer*2
> checking FORTRAN-type equivalent to C "short"... integer*2
> checking FORTRAN-type equivalent to netCDF "long"... integer*4
> checking FORTRAN-type equivalent to C "int"... integer
> checking FORTRAN-type equivalent to netCDF "float"... real*4
> checking FORTRAN-type equivalent to C "float"... real*4
> checking FORTRAN-type equivalent to netCDF "double"... real*8
> checking FORTRAN-type equivalent to C "double"... real*8
> checking for ar... (cached) ar
> checking for ranlib... (cached) ranlib
> checking how to run the C preprocessor... (cached) gcc -E
> checking for stdlib.h... (cached) yes
> checking for sys/types.h... (cached) yes
> checking for strerror... (cached) no
> checking for ftruncate... (cached) yes
> checking for st_blksize in struct stat... (cached) yes
> checking whether cross-compiling... (cached) no
> checking for IEEE floating point format... yes
> checking for ANSI C header files... (cached) no
> checking for size_t... (cached) yes
> checking for off_t... (cached) yes
> checking for ssize_t... (cached) no
> checking for ptrdiff_t... (cached) yes
> checking for uchar... (cached) no
> checking whether char is unsigned... (cached) no
> checking whether byte ordering is bigendian... (cached) yes
> checking size of short... (cached) 2
> checking size of int... (cached) 4
> checking size of long... (cached) 4
> checking size of float... (cached) 4
> checking size of double... (cached) 8
> checking size of off_t... (cached) 4
> checking size of size_t... (cached) 4
> checking for command to create manual-page index... catman -w -M $(MANDIR)
> checking binary distribution directory... /home/ftp/pub/binary/dummy_system
> creating ./config.status
> creating macros.make
> creating libsrc/ncconfig.h
> creating fortran/netcdf-cpp.inc
>
> > cat cfg.stderr
> mv: libsrc/ncconfig.h: rename: No such file or directory
> mv: fortran/netcdf-cpp.inc: rename: No such file or directory
>
> > cat config.log
> This file contains any messages produced by compilers while
> running configure, to aid debugging if configure makes a mistake.
>
> configure:989: gcc -c -g -DNDEBUG conftest.c 1>&5
> configure:1117: gcc -c -DNDEBUG conftest.C 1>&5
> configure:1224: f77 -c -g -w conftest.f
> conftest.f:
> MAIN:
> configure:1313: f77 -c -g -w conftest.F
> /tmp/cpp.10896.0.f:
> foo:
> configure:1345: gcc -o conftest -g -DNDEBUG conftest.c -lc 1>&5
> /usr/tmp/cca109081.o: In function `t':
> /alot/sweet/NetCDF/netcdf-3.3/src/configure:1341: undefined reference to
> `tanh'
> configure:1379: gcc -o conftest -g -DNDEBUG conftest.c -lm 1>&5
> configure:1421: f77 -c -g -w conftest.f
> conftest.f:
> MAIN:
> configure:1448: f77 -c -g -w conftest.f
> conftest.f:
> sub:
> configure:1465: gcc -o conftest -DNDEBUG -g conftest.c conftestf.o
> configure:1475: ./conftest
> configure:1512: f77 -c -g -w conftest.f
> conftest.f:
> MAIN:
> configure:1539: f77 -c -g -w conftest.f
> conftest.f:
> sub:
> configure:1556: gcc -o conftest -DNDEBUG -g conftest.c conftestf.o
> configure:1566: ./conftest
> configure:1591: f77 -c -g -w conftest.f
> conftest.f:
> MAIN:
> configure:1618: f77 -c -g -w conftest.f
> conftest.f:
> sub:
> configure:1635: gcc -o conftest -DNDEBUG -g conftest.c conftestf.o
> configure:1645: ./conftest
> configure:1670: f77 -c -g -w conftest.f
> conftest.f:
> MAIN:
> configure:1697: f77 -c -g -w conftest.f
> conftest.f:
> sub:
> configure:1714: gcc -o conftest -DNDEBUG -g conftest.c conftestf.o
> configure:1724: ./conftest
> configure:1749: f77 -c -g -w conftest.f
> conftest.f:
> MAIN:
> configure:1776: f77 -c -g -w conftest.f
> conftest.f:
> sub:
> configure:1793: gcc -o conftest -DNDEBUG -g conftest.c conftestf.o
> configure:1803: ./conftest
> configure:1898: gcc -E -DNDEBUG conftest.c >/dev/null 2>conftest.out
> configure:1944: gcc -E -DNDEBUG conftest.c >/dev/null 2>conftest.out
> configure:1978: gcc -E -DNDEBUG conftest.c >/dev/null 2>conftest.out
> configure:2028: gcc -o conftest -g -DNDEBUG conftest.c 1>&5
> /usr/tmp/cca111221.o: In function `t':
> /alot/sweet/NetCDF/netcdf-3.3/src/configure:2022: undefined reference to
> `strerror'
> configure:2076: gcc -o conftest -g -DNDEBUG conftest.c 1>&5
> configure:2110: gcc -c -g -DNDEBUG conftest.c 1>&5
> configure:2142: gcc -o conftest -g -DNDEBUG conftest.c 1>&5
> configure:2194: gcc -o conftest -g -DNDEBUG conftest.c 1>&5
> configure:2223: gcc -E -DNDEBUG conftest.c >/dev/null 2>conftest.out
> configure:2544: gcc -c -g -DNDEBUG conftest.c 1>&5
> configure: In function `t':
> configure:2539: `bogus' undeclared (first use this function)
> configure:2539: (Each undeclared identifier is reported only once
> configure:2539: for each function it appears in.)
> configure:2539: parse error before `endian'
> configure:2590: gcc -o conftest -g -DNDEBUG conftest.c 1>&5
> configure:2628: gcc -o conftest -g -DNDEBUG conftest.c 1>&5
> configure:2662: gcc -o conftest -g -DNDEBUG conftest.c 1>&5
> configure:2696: gcc -o conftest -g -DNDEBUG conftest.c 1>&5
> configure:2730: gcc -o conftest -g -DNDEBUG conftest.c 1>&5
> configure:2764: gcc -o conftest -g -DNDEBUG conftest.c 1>&5
> configure:2802: gcc -o conftest -g -DNDEBUG conftest.c 1>&5
> configure:2840: gcc -o conftest -g -DNDEBUG conftest.c 1>&5
>
> > cat make.stdout
>
> Making `all' in directory /alot/sweet/NetCDF/netcdf-3.3/src/libsrc
>
> gcc -c -g -I. -DNDEBUG attr.c
> gcc -c -g -I. -DNDEBUG dim.c
> gcc -c -g -I. -DNDEBUG error.c
> gcc -c -g -I. -DNDEBUG -DVERSION=`cat ../VERSION` libvers.c
> gcc -c -g -I. -DNDEBUG nc.c
> gcc -c -g -I. -DNDEBUG ncio.c
> gcc -c -g -I. -DNDEBUG ncx.c
> gcc -c -g -I. -DNDEBUG putget.c
> gcc -c -g -I. -DNDEBUG string.c
> gcc -c -g -I. -DNDEBUG v1hpg.c
> gcc -c -g -I. -DNDEBUG v2i.c
> gcc -c -g -I. -DNDEBUG var.c
> ar cru libnetcdf.a attr.o dim.o error.o libvers.o nc.o ncio.o ncx.o
> putget.o string.o v1hpg.o v2i.o var.o
> ranlib libnetcdf.a
> /usr/5bin/m4 -B7168 -DAPI=C ../man/netcdf.m4 >netcdf.3 || rm netcdf.3
>
> Returning to directory /alot/sweet/NetCDF/netcdf-3.3/src
>
>
> Making `all' in directory /alot/sweet/NetCDF/netcdf-3.3/src/nc_test
>
> gcc -c -g -I../libsrc -DNDEBUG nc_test.c
> gcc -c -g -I../libsrc -DNDEBUG error.c
> gcc -c -g -I../libsrc -DNDEBUG test_get.c
> gcc -c -g -I../libsrc -DNDEBUG test_put.c
> gcc -c -g -I../libsrc -DNDEBUG test_read.c
> gcc -c -g -I../libsrc -DNDEBUG test_write.c
> gcc -c -g -I../libsrc -DNDEBUG util.c
>
> > cat make.stderr
> util.c: In function `roll':
> util.c:157: `RAND_MAX' undeclared (first use this function)
> util.c:157: (Each undeclared identifier is reported only once
> util.c:157: for each function it appears in.)
> *** Error code 1
> make: Fatal error: Command failed for target `util.o'
> Current working directory /alot/sweet/NetCDF/netcdf-3.3/src/nc_test
> *** Error code 1
> make: Fatal error: Command failed for target `subdir_target'
> Current working directory /alot/sweet/NetCDF/netcdf-3.3/src
> *** Error code 1
> make: Fatal error: Command failed for target `nc_test/all'
>
>
> - ------- End of Forwarded Message
>
>
> ------- End of Forwarded Message
--------Begin patch for file nc_test/util.c:
Index: util.c
===================================================================
RCS file: /upc/share/CVS/netcdf-3/nc_test/util.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -c -r1.20 -r1.21
*** 1.20 1997/05/05 22:02:34
--- 1.21 1997/05/21 21:29:30
***************
*** 1,7 ****
/*********************************************************************
* Copyright 1996, UCAR/Unidata
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
! * $Id: util.c,v 1.20 1997/05/05 22:02:34 davis Exp $
*********************************************************************/
#include <math.h>
--- 1,7 ----
/*********************************************************************
* Copyright 1996, UCAR/Unidata
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
! * $Id: util.c,v 1.21 1997/05/21 21:29:30 steve Exp $
*********************************************************************/
#include <math.h>
***************
*** 151,162 ****
*/
int roll( int n )
{
- int d;
int r;
! d = (RAND_MAX + 1.0) / n;
! while ( (r = rand() / d) >= n )
! ;
return r;
}
--- 151,169 ----
*/
int roll( int n )
{
int r;
! do
! /*
! * Compute a pseudo-random value between 0.0 and 1.0, multiply
! * it by n-1, and then round.
! *
! * We don't use RAND_MAX here because not all compilation
! * environments define it (e.g. gcc(1) under SunOS 4.1.4).
! */
! r = ((rand() % 32768) / 32767.0) * (n - 1) + 0.5;
! while (r >= n);
!
return r;
}
--------End patch for file nc_test/util.c:
--------Begin patch for file nc_test/fortlib.c
Index: fortlib.c
===================================================================
RCS file: /upc/share/CVS/netcdf-3/nf_test/fortlib.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** 1.1 1997/03/19 16:58:29
--- 1.2 1997/05/21 21:29:47
***************
*** 1,5 ****
/*
! * $Id: fortlib.c,v 1.1 1997/03/19 16:58:29 steve Exp $
*
* This file contains support functions for FORTRAN code. For example,
* under HP-UX A.09.05, the U77 library doesn't contain the exit()
--- 1,5 ----
/*
! * $Id: fortlib.c,v 1.2 1997/05/21 21:29:47 steve Exp $
*
* This file contains support functions for FORTRAN code. For example,
* under HP-UX A.09.05, the U77 library doesn't contain the exit()
***************
*** 21,27 ****
if (iflag != 0)
srand(iflag);
! return rand()/RAND_MAX;
}
FCALLSCFUN1(DOUBLE, myrand, UDRAND, udrand, INT)
--- 21,33 ----
if (iflag != 0)
srand(iflag);
! /*
! * Return a pseudo-random value between 0.0 and 1.0.
! *
! * We don't use RAND_MAX here because not all compilation
! * environments define it (e.g. gcc(1) under SunOS 4.1.3).
! */
! return (rand() % 32768) / 32767.0;
}
FCALLSCFUN1(DOUBLE, myrand, UDRAND, udrand, INT)
--------End patch for file nf_test/fortlib.c:
--------
Steve Emmerson <address@hidden>