[ncl-install] Help on definition of NGCALLF in c.h file

David Brown dbrown at ucar.edu
Thu Jan 27 17:12:47 MST 2011


Hi Paul,

I am not sure what is going on here but I can tell you this much: c.h should not simply be a copy of c.h.sed. The Makefile should have a rule that invokes the 'sed' utility to create c.h from c.h.sed
that looks something like this:

c.h: c.h.sed Makefile
        @sed    -e 's+SED_NGCALLF+$(NGCALLF)+'  <c.h.sed >c.h

sed should replace the string SED_NGCALLF with the value of the NGCALLF which is defined earlier in the Makefile. The macro is used to generate the correct form of a name used to call a Fortran procedure from within C code. What is NGCALLF set to in the Makefile? It looks as if it may have been modified from the standard value, which is usually "reg\#\#_" for Linux. It's possible that pgfortran requires something else, I don't know.

If the standard value is used, where c.h.sed has the lines:

#ifndef NGCALLF

#define NGCALLF(reg,caps)   SED_NGCALLF

#endif  /* NGCALLF */

c.h should have:

#ifndef NGCALLF

#define NGCALLF(reg,caps)   reg##_

#endif  /* NGCALLF */

logic32.c should have the following references to NGCALLF:

logic32.c:
logic32.c:NGCALLF(iand,IAND)(i, j)
logic32.c:NGCALLF(ior,IOR)(i, j)
logic64.c:NGCALLF(ishift,ISHIFT)(i, nshift)
logic64.c:NGCALLF(iand,IAND)(i, j)
logic64.c:NGCALLF(ior,IOR)(i, j)


The C preprocessor will replace these lines (as part of the compilation, you won't see it happen) with the first parameter (reg) followed by an underscore. 
NGCALLF(ishift,ISHIFT)(i, nshift) should become ishift_(i,nshift), which is the correct way to call a Fortran routine if gfortran is the Fortran compiler. 

If you can't figure it out based on this information, please send me (off line) the Makefile in common/src/libncarg_c plus whatever you used for the system include file. It will be found in
the config directory and be named in the Makefile as the value of SYSTEM_INCLUDE.
 -dave

 

On Jan 27, 2011, at 10:49 AM, Liang, Jinyou at ARB wrote:

> Dear NCL expert,
>  
> Could you please help me out on the following installation problem with NCL?
>  
> While installing ncl_ncarg-5.2.1 on a Linux computer running Redhat Enterprise Linux OS version 5.4 using pgfortran (v10.5) and gcc (4.1.2 20080704 [Red Hat 4.1.2-48]), I encountered an error in subdirectory “common/src/libncarg_c”. The use of c.h (a copy of c.h.sed) yielded duplicate definition of SED_NGCALLF due to dozens of functions named
>  
> NGCALLF(lowercase, uppercase) (char*, int*)
>  
> In files logic32.c and trnspprt.c, etc.
>  
> The complete compiler options are as follow:
>  
> gcc -O2 -m64 -fPIC  -O  -I../../.././include -I/usr/X11R6/include -I/usr/local/include/freetype2  -DLinux  -DIBM -DNGVERSION='"5.2.1"'  -DNCLVERSION='"5.2.1"'  -DNCARGURL='"ngurl"'  -DSYSV -D_POSIX_SOURCE -D_XOPEN_SOURCE -DByteSwapped -DNeedFuncProto  -DNDEBUG  -c -o rwchinfl.o rwchinfl.c
>  
>  
> Did I miss anything in compiler options (I compiled the same package successfully using earlier version of gcc/RHEL and gfortran), or do I have to insert unique definitions in the c.h file for each complaint from the compiler?
>  
> Your response will be greatly appreciated.
>  
> Regards,
> Paul
> Jinyou (Paul) Liang, Ph.D.
> Staff Air Pollution Specialist
> California Air Resources Board
> Sacramento, CA 95812
> Phone: (916) 327-8543
>  
> 
> _______________________________________________
> ncl-install mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-install

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-install/attachments/20110127/9b24b3ec/attachment.html 


More information about the ncl-install mailing list