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

970707: building under SunOS 5.5 using gcc and g77



Randy,

>Date: Mon, 07 Jul 1997 15:52:05 -0400 
>From: Randy Arndt <address@hidden>
>Organization: Aurora Simulation, Inc. 
>To: Steve Emmerson <address@hidden>
>Subject: Re: 970707: building under SunOS 5.5 using gcc and g77 
>Keywords: 199707071300.HAA24056

In the above message, you wrote:

> I don't have the Sun Workshop C and Fortran compilers, so I'm forced to
> use the GNU compilers.
>  
> > Does this happen when you "run" (i.e. execute) the "nf_test" utility
> > or when you attempt to link it together?
> 
> The "undefined reference" errors occur when I try to link it together.
> 
> > I'm afraid that it not obvious to me from the above what the problem is.
> > 
> > Would you please send me the following:
> > 
> >     3.  The standard output and error output of the configure script.
> 
> Here's the standard output and error output for the configure script:
> 
> creating cache ./config.cache
> checking for m4... no
> checking for gm4... no
> checking for xlc... no
> checking for c89... no
> checking for acc... no
> checking for cc... no
> checking for gcc... gcc
> checking C compiler... works
> checking how to make dependencies... cc -xM
> checking for CC... no
> checking for cxx... no
> checking for c++... c++
> checking C++ compiler "c++"... works
> checking how to run the C preprocessor... gcc -E
> checking for f77... f77
> checking for FORTRAN .F compiler... 
> checking if FORTRAN compiler handles *.F files... yes
> checking for C-equivalent to FORTRAN routine "SUB"... sub_

Hmm...  The above indicates that a Fortran-callable C routine merely 
needs an underscore appended to the name.

> checking for FORTRAN "byte"... yes
> checking for FORTRAN "integer*2"... yes
> checking if FORTRAN "byte" is C "signed char"... yes
> checking if FORTRAN "byte" is C "short"... no
> checking if FORTRAN "byte" is C "int"... no
> checking if FORTRAN "integer*2" is C "short"... yes
> checking if FORTRAN "integer*2" is C "int"... no
> checking if FORTRAN "integer" is C "int"... yes
> checking if FORTRAN "real" is C "float"... yes
> checking if FORTRAN "doubleprecision" is C "double"... yes
> checking for FORTRAN-equivalent to netCDF "byte"... byte
> checking for FORTRAN-equivalent to netCDF "short"... integer*2
> checking for math library
> checking for -lc... no
> checking for -lm... yes
> checking for ar... ar
> checking for ranlib... ranlib
> checking for stdlib.h... yes
> checking for sys/types.h... yes
> checking for strerror... yes
> checking for ftruncate... yes
> checking for st_blksize in struct stat... yes
> checking whether cross-compiling... no
> checking for IEEE floating point format... yes
> checking for ANSI C header files... yes
> checking for size_t... yes
> checking for off_t... yes
> checking for ssize_t... yes
> checking for ptrdiff_t... yes
> checking for uchar... no
> checking whether char is unsigned... no
> checking whether byte ordering is bigendian... yes
> checking size of short... 2
> checking size of int... 4
> checking size of long... 4
> checking size of float... 4
> checking size of double... 8
> checking size of off_t... 4
> checking size of size_t... 4
> checking for catman... catman
> checking for manual-page index command... catman -w -M $(MANDIR)
> checking binary distribution directory...
> /home/ftp/pub/binary/dummy_system
> updating cache ./config.cache
> creating ./config.status
> creating macros.make
> udcreating fortran/nfconfig.inc
> creating libsrc/ncconfig.h

The above looks OK.

>  
> >     4.  The absolute pathnames of all compilers (C, FORTRAN, C++) used
> >         in the build process (use the type(1) or which(1) utility to
> >         determine this).
> 
> All compilers (gcc, g++, and g77) are located in /usr/local/bin.  f77 is
> symbolically linked to g77 in /usr/local/bin.
> 
>  
> >     5.  The contents of the file "config.log", which is in the top-level
> >         source directory.
> 
> Here are the contents of "config.log:"
> 
> This file contains any messages produced by compilers while
> running configure, to aid debugging if configure makes a mistake.
> 
> configure:1017: gcc -c -O -DNDEBUG conftest.c 1>&5
> configure:1150: c++ -c  -DNDEBUG conftest.C 1>&5
> configure:1217: gcc -E -DNDEBUG conftest.c >/dev/null 2>conftest.out
> configure:1370: f77 -c -O conftest.f
> configure:1415: f77 -o conftest -O conftest.F  
> configure:1456: f77 -c -O conftest.f
> configure:1491: f77 -c -O conftest.f
> configure:1514: f77 -c -O conftest.f
> configure:1548: gcc -c -DNDEBUG -O conftest.c
> configure:1550: f77 -o conftest -O  conftestf.f conftest.o 
> configure:1552: ./conftest
> configure:1590: gcc -c -DNDEBUG -O conftest.c
> configure:1592: f77 -o conftest -O  conftestf.f conftest.o 
> configure:1594: ./conftest
> configure:1632: gcc -c -DNDEBUG -O conftest.c
> configure:1634: f77 -o conftest -O  conftestf.f conftest.o 
> configure:1636: ./conftest
> configure:1678: gcc -c -DNDEBUG -O conftest.c
> configure:1680: f77 -o conftest -O  conftestf.f conftest.o 
> configure:1682: ./conftest
> configure:1720: gcc -c -DNDEBUG -O conftest.c
> configure:1722: f77 -o conftest -O  conftestf.f conftest.o 
> configure:1724: ./conftest
> configure:1764: gcc -c -DNDEBUG -O conftest.c
> configure:1766: f77 -o conftest -O  conftestf.f conftest.o 
> configure:1768: ./conftest
> configure:1806: gcc -c -DNDEBUG -O conftest.c
> configure:1808: f77 -o conftest -O  conftestf.f conftest.o 
> configure:1810: ./conftest
> configure:1848: gcc -c -DNDEBUG -O conftest.c
> configure:1850: f77 -o conftest -O  conftestf.f conftest.o 
> configure:1852: ./conftest
> configure:1882: f77 -c -O conftest.f
> configure:1903: f77 -c -O conftest.f
> configure:1943: gcc -o conftest -O -DNDEBUG  conftest.c -lc   1>&5
> /var/tmp/cca000ft1.o: In function `t':
> /var/tmp/cca000ft1.o(.text+0xc): undefined reference to `tanh'
> configure:1977: gcc -o conftest -O -DNDEBUG  conftest.c -lm   1>&5
> configure:2072: gcc -E -DNDEBUG conftest.c >/dev/null 2>conftest.out
> configure:2106: gcc -E -DNDEBUG conftest.c >/dev/null 2>conftest.out
> configure:2156: gcc -o conftest -O -DNDEBUG  conftest.c  1>&5
> configure:2204: gcc -o conftest -O -DNDEBUG  conftest.c  1>&5
> configure:2238: gcc -c -O -DNDEBUG conftest.c 1>&5
> configure:2270: gcc -o conftest -O -DNDEBUG  conftest.c  1>&5
> configure:2322: gcc -o conftest -O -DNDEBUG  conftest.c  1>&5
> configure:2351: gcc -E -DNDEBUG conftest.c >/dev/null 2>conftest.out
> configure:2416: gcc -o conftest -O -DNDEBUG  conftest.c  1>&5
> configure:2672: gcc -c -O -DNDEBUG conftest.c 1>&5
> configure: In function `t':
> configure:2667: `bogus' undeclared (first use this function)
> configure:2667: (Each undeclared identifier is reported only once
> configure:2667: for each function it appears in.)
> configure:2667: parse error before `endian'
> configure:2718: gcc -o conftest -O -DNDEBUG  conftest.c  1>&5
> configure:2756: gcc -o conftest -O -DNDEBUG  conftest.c  1>&5
> configure:2790: gcc -o conftest -O -DNDEBUG  conftest.c  1>&5
> configure:2824: gcc -o conftest -O -DNDEBUG  conftest.c  1>&5
> configure:2858: gcc -o conftest -O -DNDEBUG  conftest.c  1>&5
> configure:2892: gcc -o conftest -O -DNDEBUG  conftest.c  1>&5
> configure:2930: gcc -o conftest -O -DNDEBUG  conftest.c  1>&5
> configure:2968: gcc -o conftest -O -DNDEBUG  conftest.c  1>&5

The above looks OK, too.

I think that your Fortran compiler (f77, alias g77) might be appending
an additional underscore to routine name that contain an underscore,
i.e. "sub_routine" becomes "sub_routine__" rather than simply
"sub_routine_".  This behavior is commonly seen in the Fortran-to-C 
translation utility f2c(1) -- I don't recall seeing it in g77(1).

I suggest building the netCDF package assumming the f2c(1) Fortran-to-C
calling conventions:

    1.  Go to to the top-level source directory.

    2.  Execute the command "make distclean".

    3.  Set the environment variable CPPFLAGS to contain the string
        "-Df2cFortran".

    4.  Re-execute the configure script.
        Redirect standard output and standard error to a file.
        If this step fails, then send me the file and stop here.

    5.  Execute the command "make".
        Redirect standard output and standard error to a file.
        If this step fails, then send me the file and stop here.

    6.  Execute the command "make test".
        Redirect standard output and standard error to a file.
        If this step fails, then send me the file.

Please let me know if this helps.

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