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

Re: c compiler doesn't work



>To: address@hidden
>From: "a b" <address@hidden>
>Subject: Re: how to set the path.Thanks!
>Organization: ?
>Keywords: 200309070348.h873mQLd010612

MJ,

> yes,the version of netcdf i have downloaded is a pre-built binary 
> version.Now i known the problem is my c compiler doesn't work.

I don't understand why you are trying to compile netcdf from source if
you have downloaded the pre-built binary version.  The pre-built
binary version just has the netCDF libraries and executables, but no
source code, so there is nothing to compile.  You would still need a
compiler to link programs that use netCDF with the pre-built binary
library, but you should not need to compile the library from source.

> for example,i programmed to compute two float addition.
> 
> main()
> {
> float x,y;
> printf("input x and y\n");
> printf("enter x\n");
> scanf("%f",&x);
> printf("enter y\n");
> scanf("%f",&y);
> printf("x+y:%f\n",x+y);    
>  }
> OCEAN 1# c89 fadd.c -o fout
> ld32: WARNING 110: Floating-point parameters exist in the call for 
> "printf", a VARARG function, 
> 
> in object "fadd.o" without a prototype -- would result in invalid result.  
> Definition can be 
> 
> found in object "/usr/lib32/mips4/libc.so"
> 
> OCEAN 3# ./fout
> input x and y
> enter x
> 3.6
> enter y
> 4.6
> x+y:0.000000
> 
> the output is 0, is wrong.but due to the two int,it's right.what's the 
> matter? the file "/usr/lib32/mips4/libc.so" is too long to read. 

To be correct, the above program should start with
#include <stdio.h>

so that the printf() function is recognized; then the program will
compile and work as expected.

> now i enter the DIR netcdf/src to configure.
> 
> OCEAN 9# cd wf
> OCEAN 10# ls
> netcdf-3.5.1-beta13                 netcdf-3.5.1-beta13.tar
> OCEAN 11# cd netcdf-3.5.1-beta13
> OCEAN 12# ls
> src
> OCEAN 13# cd src
> OCEAN 14# ls
> COMPATIBILITY   README          config.cache    conftest.c      libsrc      
>     ncdump          
> COPYRIGHT       RELEASE_NOTES   config.log      conftestf.f     macros.make 
>     ncgen
> INSTALL.html    VERSION         config.status   cxx             
> macros.make.in  nctest
> MANIFEST        aclocal.m4      configure       f90             man         
>     nf_test
> Makefile        confdefs.h      configure.in    fortran         nc_test     
>     rules.make

Before running the "configure" script again, you should run "make
distclean" and remove the file "config.cache", as explained in steps 3
and 4 of "Reporting Problems" in the installation instructions:

  http://www.unidata.ucar.edu/packages/netcdf/INSTALL.html#ReportingProblems

Otherwise, the configure script will use previous values it saved in
the config.cache file and won't use your new environment variable
settings.

> OCEAN 16# ./configure
> loading cache ./config.cache

The above line says it is using the old cached values ...

> checking for top-level source-directory
> /data/usr/people/wf/netcdf-3.5.1-beta13/src
> checking for m4 preprocessor
> checking for m4... (cached) m4
> checking m4 flags... -B10000
> checking C compiler "usr/bin/c89 -n32"... failed to compile test program
> checking how to make dependencies... cc -M
> checking for /usr/include/CC... /usr/include/CC -n32
> checking C++ compiler "/usr/include/CC -n32"... configure: warning: 
> /usr/include/CC -n32 failed 
> 
> on standard C++ test program
> checking for -n32... no
> configure: warning: Could not find working C++ compiler
> configure: warning: Setting CXX to the empty string
> configure: warning: The C++ interface will not be built
> checking how to run the C preprocessor... (cached) /lib/cpp
> checking user-defined Fortran-77 compiler "/usr/bin/f77 -n32"... works
> checking for Fortran .F compiler... 
> checking if Fortran-77 compiler handles *.F files... yes
> checking user-defined Fortran-90 compiler "/usr/bin/f90 -n32"... works
> checking for nm utility
> checking for nm... (cached) nm
> checking nm flags... 
> checking for C-equivalent to Fortran routine "SUB"... sub_
> checking for Fortran "byte"... yes
> checking for Fortran "integer*2"... yes
> checking if Fortran "byte" is C "signed char"... configure: error: Could 
> not compile conftest.c
> 
>    now my environment variables is follows:
>  setenv PATH 
> /usr/bin:/usr/lib:/usr/lib32/:/usr/local:/usr/include:/sbin:/usr/freeware/bin:/usr/freeware/lib:/usr/freeware:$PATH
> 
> setenv CC "usr/bin/c89 -n32"
> setenv CPPFLAGS "-DNDEBUG"
> setenv CFLAGS "-mips4"
> setenv FC "/usr/bin/f77 -n32"
> setenv FFLAGS "-mips4"
> setenv F90 "/usr/bin/f90 -n32"
> setenv F90FLAGS "-mips4"
> setenv CXX "/usr/include/CC -n32"
> setenv CXXFLAGS "-mips4"

Instead, try one of the suggested tested settings in the INSTALL file
for IRIX, such as:

    setenv CC /bin/c89
    setenv CPPFLAGS -DNDEBUG
    setenv CFLAGS '-O -n32'
    setenv FC /bin/f90
    setenv FFLAGS '-O -n32'
    setenv CXX /bin/CC
    setenv CXXFLAGS '-O -n32'

> in a few minute i will send you the output of "showprods".

OK, but the above suggestions may make that unnecessary ...

--Russ

_____________________________________________________________________

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