[ncl-install] Re: [ncl-talk] wrapit77 & scanner.c Building errors
Mary Haley
haley at ucar.edu
Wed Feb 20 13:03:17 MST 2008
[Note: I'm cross-posting this to ncl-install since this is more
of an installation question.]
I believe you are running into a known bug with the file "wrapit.c"
getting clobbered when "wrapit77" is compiled. We will soon have a
detailed document on these build gotchas.
Meanwhile, to fix this problem:
1. Save the attached "wrapit.c" to the directory $NCARG/ni/src/mkwrap/.
2. Touch the "wrapit.c" file:
cd $NCARG/ni/src/mkwrap
touch wrapit.c
3. Type "make all install" in the same directory to see if
"wrapit77" builds successfully.
4a. If step #3 was successful, then you can restart the build:
cd $NCARG
make all install >&! make-output.2
Note that "make-output.2" can be whatever name you like.
4b. If step #3 was not successful, then email me.
--Mary
On Wed, 20 Feb 2008, Nestor Waldyd Alvarez Villa wrote:
> Hello:::
>
> When building ncl + ncarg 5.0, the following was prompted:
>
>
> make[4]: Entering directory `/usr/local/src/ncl_ncarg-5.0.0/ni/src/ncl'
> pgcc -tp k8-64 -O -Msignextend -Mreentrant -fPIC -D_FILE_OFFSET_BITS=64
> -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -O
> -I../../.././include -I/usr/include -I/usr/include/X11
> -I/usr/include/netcdf-3 -I/usr/include/hdf -DLinux -DMAJOR=2 -DSYSV
> -D_POSIX_SOURCE -D_XOPEN_SOURCE -DByteSwapped -DNeedFuncProto -c -o
> scanner.o scanner.c
> PGC-W-0136-Function isatty has non-prototype declaration in scope
> (/usr/include/unistd.h: 745)
> PGC-S-0039-Use of undeclared variable yy_current_buffer (lex.yy.c: 2099)
> PGC-S-0055-Illegal operand of indirection operator (*) (lex.yy.c: 2099)
> PGC-S-0059-Struct or union required on left of . or -> (lex.yy.c: 2099)
> PGC/x86-64 Linux 7.0-6: compilation completed with severe errors
> make[4]: *** [scanner.o] Error 2
> make[4]: Leaving directory `/usr/local/src/ncl_ncarg-5.0.0/ni/src/ncl'
> Making install in ./ni/src/mkwrap
> make[4]: Entering directory `/usr/local/src/ncl_ncarg-5.0.0/ni/src/mkwrap'
> pgcc -tp k8-64 -O -Msignextend -Mreentrant -fPIC -D_FILE_OFFSET_BITS=64
> -D_LARGEFILE_SOURCE -O -o wrapit77 y.tab.o lex.yy.o Symbol.o wrapit.o
> -L/usr/local/ncarg/lib -L/usr/lib64 -L/usr/lib64/hdf -L/usr/lib64/X11 -lfl
> wrapit.o: In function `WMakeListNode':
> wrapit.y:(.text+0x0): multiple definition of `WMakeListNode'
> y.tab.o:wrapit.y:(.text+0x0): first defined here
> wrapit.o: In function `FType':
> wrapit.y:(.text+0x20): multiple definition of `FType'
> y.tab.o:wrapit.y:(.text+0x20): first defined here
> wrapit.o: In function `NType':
> wrapit.y:(.text+0xa0): multiple definition of `NType'
> y.tab.o:wrapit.y:(.text+0xa0): first defined here
> wrapit.o: In function `CType':
> wrapit.y:(.text+0x150): multiple definition of `CType'
> y.tab.o:wrapit.y:(.text+0x150): first defined here
> wrapit.o: In function `yyerror':
> wrapit.y:(.text+0x1f0): multiple definition of `yyerror'
> y.tab.o:wrapit.y:(.text+0x1f0): first defined here
> wrapit.o: In function `yyparse':
> wrapit.y:(.text+0x350): multiple definition of `yyparse'
> y.tab.o:wrapit.y:(.text+0x350): first defined here
> wrapit.o: In function `.S01487':
> wrapit.y:(.data+0xc80): multiple definition of `yydefred'
> y.tab.o:wrapit.y:(.data+0xc80): first defined here
> wrapit.o: In function `.S01487':
> wrapit.y:(.data+0xec0): multiple definition of `yysindex'
> y.tab.o:wrapit.y:(.data+0xec0): first defined here
> wrapit.o: In function `.S01487':
> wrapit.y:(.data+0x15a0): multiple definition of `yycheck'
> y.tab.o:wrapit.y:(.data+0x15a0): first defined here
> wrapit.o: In function `.S01487':
> wrapit.y:(.data+0x12e0): multiple definition of `yytable'
> y.tab.o:wrapit.y:(.data+0x12e0): first defined here
>
> :::::: More Errors ::::
>
> wrapit.y:(.text+0x38bc): undefined reference to `WNewArgVal'
> wrapit.y:(.text+0x38f7): undefined reference to `WNewVDef'
> wrapit.y:(.text+0x39aa): undefined reference to `WNewVDef'
> wrapit.y:(.text+0x3a7b): undefined reference to `WNewArgVal'
> wrapit.y:(.text+0x3ad5): undefined reference to `WNewVDef'
> wrapit.y:(.text+0x3b8a): undefined reference to `WNewVDef'
> wrapit.y:(.text+0x3bce): undefined reference to `WNewVDef'
> wrapit.y:(.text+0x3cca): undefined reference to `WNewArgVal'
> wrapit.y:(.text+0x3d2b): undefined reference to `WNewVDef'
> wrapit.y:(.text+0x3dde): undefined reference to `WNewVDef'
> wrapit.y:(.text+0x3e4c): undefined reference to `WNewVDef'
> wrapit.y:(.text+0x3edc): undefined reference to `WNewVDef'
> wrapit.y:(.text+0x4121): undefined reference to `current'
> wrapit.y:(.text+0x41bd): undefined reference to `current'
> wrapit.y:(.text+0x43b1): undefined reference to `current'
> wrapit.y:(.text+0x44be): undefined reference to `WNewAdditionalSrc'
> wrapit.y:(.text+0x44ed): undefined reference to `WNewAdditionalSrc'
> wrapit.y:(.text+0x4550): undefined reference to `current'
> wrapit.y:(.text+0x457f): undefined reference to `NewParamLoc'
> wrapit.y:(.text+0x45c8): undefined reference to `WNewVDef'
> wrapit.y:(.text+0x470a): undefined reference to `DoTotal'
> wrapit.y:(.text+0x480f): undefined reference to `NewParamLoc'
> wrapit.y:(.text+0x4824): undefined reference to `DoDimsizes'
> wrapit.y:(.text+0x484b): undefined reference to `current'
> wrapit.y:(.text+0x496f): undefined reference to `NewParamLoc'
> wrapit.y:(.text+0x4984): undefined reference to `DoTotal'
> wrapit.y:(.text+0x49fd): undefined reference to `current'
> wrapit.y:(.text+0x4a58): undefined reference to `NewParamLoc'
> wrapit.y:(.text+0x4a6d): undefined reference to `DoDimsizes'
> wrapit.y:(.text+0x4afe): undefined reference to `current'
> wrapit.y:(.text+0x4b59): undefined reference to `NewParamLoc'
> wrapit.y:(.text+0x4b6f): undefined reference to `DoDimsizes'
> wrapit.y:(.text+0x4be2): undefined reference to `current'
> wrapit.y:(.text+0x4cf6): undefined reference to `DoTotal'
> wrapit.y:(.text+0x4d40): undefined reference to `DoDimsizes'
> wrapit.y:(.text+0x4d99): undefined reference to `DoDimsizes'
> wrapit.y:(.text+0x4e26): undefined reference to `DoTotal'
> wrapit.y:(.text+0x4e73): undefined reference to `DoDimsizes'
> wrapit.y:(.text+0x4ecf): undefined reference to `DoDimsizes'
> wrapit.y:(.text+0x4f95): undefined reference to `DoTotal'
> wrapit.y:(.text+0x4fe0): undefined reference to `DoDimsizes'
> wrapit.y:(.text+0x5039): undefined reference to `DoDimsizes'
> wrapit.y:(.text+0x5299): undefined reference to `current'
> wrapit.y:(.text+0x535b): undefined reference to `current'
> wrapit.y:(.text+0x55a9): undefined reference to `current'
> make[4]: *** [wrapit77] Error 2
> make[4]: Leaving directory `/usr/local/src/ncl_ncarg-5.0.0/ni/src/mkwrap'
>
> How can i solve this issue?
>
> Beforehand Thanks,
>
>
> --
>
> Nestor Waldyd Alvarez Villa | Ingeniero Investigador | Grupo de
> Investigaciones Ambientales (GIA)
> Universidad Pontificia Bolivariana | Circular 1 No. 70-01, Bloque 8. Piso 2.
> | Medellín, COLOMBIA
> Tel: (57) (4) 4159015 Ext. 9841 | (57) (4) 415 90 84 | Fax: (57) (4) 4159082
> mailto:nestor.alvarez at upb.edu.co | www.upb.edu.co |
> http://convena.upb.edu.co/~gialea/
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-------------- next part --------------
/*
* Note: this file was originally called "wrapit.c". This caused some
* problems if "wrapit.y" had a newer timestamp, because this would
* cause "wrapit.c" to be unintentionally regenerated by flex. By
* renaming it to "wrapit_main.c", it should no longer have a dependency
* on "wrapit.y".
*/
#include <stdio.h>
#include <ncarg/hlu/hlu.h>
#include <ncarg/hlu/NresDB.h>
#include <ncarg/ncl/defs.h>
#include <ncarg/ncl/NclDataDefs.h>
#include "WSymbol.h"
#include "Keywords.h"
#include "fstrings.h"
#ifdef YYDEBUG
int yydebug = 1;
#endif
char *wrapname;
WWrapRecList *wrap_list = NULL;
WWrapRec *current = NULL;
FILE *thefile;
WSrcList *WNewAdditionalSrc(char *b,int order)
{
WSrcList *new = malloc(sizeof(WSrcList));
new->src = malloc(strlen(b)+1);
new->order = order;
strcpy(new->src,b);
new->next = NULL;
return(new);
}
NclScopeRec* WNewFScope()
{
int i;
NclScopeRec *thetable;
thetable = (NclScopeRec*)malloc((unsigned)sizeof(NclScopeRec));
thetable->this_scope = (NclSymTableElem*)malloc((unsigned)sizeof(NclSymTableElem)* NCL_SYM_TAB_SIZE);
thetable->cur_offset = 0;
thetable->level = 0;
for(i = 0; i< NCL_SYM_TAB_SIZE; i++) {
thetable->this_scope[i].nelem = 0;
thetable->this_scope[i].thelist = NULL;
}
i = 0;
while(fkeytab[i].token != (int)NULL) {
if(fkeytab[i].uppercase != NULL) {
_NclAddInScope(thetable,fkeytab[i].uppercase,fkeytab[i].token);
}
if(fkeytab[i].lowercase != NULL) {
_NclAddInScope(thetable,fkeytab[i].lowercase,fkeytab[i].token);
}
i++;
}
return(thetable);
}
NclScopeRec* WNewWScope()
{
int i;
NclScopeRec *thetable;
thetable = (NclScopeRec*)malloc((unsigned)sizeof(NclScopeRec));
thetable->this_scope = (NclSymTableElem*)malloc((unsigned)sizeof(NclSymTableElem)* NCL_SYM_TAB_SIZE);
thetable->cur_offset = 0;
thetable->level = 0;
for(i = 0; i< NCL_SYM_TAB_SIZE; i++) {
thetable->this_scope[i].nelem = 0;
thetable->this_scope[i].thelist = NULL;
}
i = 0;
while(wkeytab[i].token != (int)NULL) {
if(wkeytab[i].uppercase != NULL) {
_NclAddInScope(thetable,wkeytab[i].uppercase,wkeytab[i].token);
}
if(wkeytab[i].lowercase != NULL) {
_NclAddInScope(thetable,wkeytab[i].lowercase,wkeytab[i].token);
}
i++;
}
return(thetable);
}
void WNewWrap()
{
WWrapRecList* tmp;
int i;
tmp = wrap_list;
wrap_list = (WWrapRecList*)malloc(sizeof(WWrapRecList));
wrap_list->next = tmp;
wrap_list->therec = (WWrapRec*)malloc(sizeof(WWrapRec));
current = wrap_list->therec;
current->frec = WNewFScope();
current->wrec = WNewWScope();
current->crec = WNewWScope();
current->c_defstring = NULL;
current->c_argval= NULL;
current->c_tmpval= NULL;
current->c_vdefs = NULL;
current->c_callrec = NULL;
current->rtrn = NULL;
}
WGetArgValue *WNewArgVal()
{
WArgValList* tmp;
tmp = current->c_argval;
current->c_argval = (WArgValList*)malloc(sizeof(WArgValList));
current->c_argval->arec = (WGetArgValue*)malloc(sizeof(WGetArgValue));
current->c_argval->arec->assign_to = NULL;
current->c_argval->arec->pnum = -1;
current->c_argval->arec->totalp = -1;
current->c_argval->arec->ndims= NULL;
current->c_argval->arec->dimsizes= NULL;
current->c_argval->arec->missing= NULL;
current->c_argval->arec->hasmissing= NULL;
current->c_argval->arec->type= NULL;
current->c_argval->arec->rw = -1;
current->c_argval->arec->additional_src = NULL;
current->c_argval->next = tmp;
return(current->c_argval->arec);
}
WCentry *WNewVDef(char* name,int datatype,int isptr,char* array_spec,int order)
{
WVDefList *tmp;
NclSymbol *s;
if(current->c_vdefs != NULL ) {
tmp = current->c_vdefs;
while(tmp->next != NULL) tmp = tmp->next;
tmp->next = (WVDefList*)malloc(sizeof(WVDefList));
tmp->next->next = NULL;
tmp->next->def = (WCentry*)malloc(sizeof(WCentry));
tmp->next->def->string = (char*)malloc(strlen(name)+1);
tmp->next->def->datatype = datatype;
tmp->next->def->array_spec = NULL;
tmp->next->def->order = order;
tmp->next->def->additional_src = NULL;
strcpy(tmp->next->def->string,name);
if(array_spec != NULL) {
tmp->next->def->array_spec= malloc(strlen(array_spec)+1);
strcpy(tmp->next->def->array_spec,array_spec);
} else {
tmp->next->def->array_spec = NULL;
}
tmp->next->def->isptr = isptr;
s = _NclAddInScope(current->crec,name,CVAR);
s->u.centry = tmp->next->def;
return(tmp->next->def);
} else {
current->c_vdefs = (WVDefList*)malloc(sizeof(WVDefList));
current->c_vdefs->next = NULL;
current->c_vdefs->def = (WCentry*)malloc(sizeof(WCentry));
current->c_vdefs->def->string = (char*)malloc(strlen(name)+1);
current->c_vdefs->def->datatype = datatype;
current->c_vdefs->def->array_spec = NULL;
current->c_vdefs->def->order = order;
current->c_vdefs->def->additional_src = NULL;
strcpy(current->c_vdefs->def->string,name);
if(array_spec != NULL) {
current->c_vdefs->def->array_spec= malloc(strlen(array_spec)+1);
strcpy(current->c_vdefs->def->array_spec,array_spec);
}
current->c_vdefs->def->isptr = isptr;
s = _NclAddInScope(current->crec,name,CVAR);
s->u.centry = current->c_vdefs->def;
return(current->c_vdefs->def);
}
}
#define WNCL_MAX_ARGS 100
WCallRec* WNewCallRec(char* fort_name,int n_args) {
int i;
current->c_callrec = (WCallRec*)malloc(sizeof(WCallRec));
/*
current->c_callrec->fname = malloc(strlen(fort_name)+1);
strcpy(current->c_callrec->fname,fort_name);
*/
current->c_callrec->n_args = n_args;
current->c_callrec->nstrs = 0;
current->c_callrec->arg_strings = (WCentry**)malloc(WNCL_MAX_ARGS*sizeof(WCentry*));
for(i = 0; i < WNCL_MAX_ARGS; i++) {
current->c_callrec->arg_strings[i] = NULL;
}
return(current->c_callrec);
}
void DoDimsizes(NclSymbol* sym) {
char buffer[BUFFSIZE];
sprintf(buffer,"%s_dimsizes",sym->name);
if( _NclLookUpInScope(current->crec,buffer) == NULL) {
(void)WNewVDef(buffer,NCL_int,0,"[NCL_MAX_DIMENSIONS]",0);
sym->u.wparam->getarg->dimsizes = (char*)malloc(strlen(buffer)+1);
strcpy(sym->u.wparam->getarg->dimsizes,buffer);
}
sprintf(buffer,"%s_ndims",sym->name);
if( _NclLookUpInScope(current->crec,buffer) == NULL) {
(void)WNewVDef(buffer,NCL_int,0,NULL,0);
sprintf(buffer,"&%s_ndims",sym->name);
sym->u.wparam->getarg->ndims= (char*)malloc(strlen(buffer)+1);
strcpy(sym->u.wparam->getarg->ndims,buffer);
}
}
void DoTotal(NclSymbol *sym) {
char buffer[BUFFSIZE];
WCentry *tmp;
sprintf(buffer,"%s_total",sym->name);
if( _NclLookUpInScope(current->crec,buffer) == NULL) {
tmp = WNewVDef(buffer,NCL_int,0,NULL,0);
sprintf(buffer,"\t%s_total = 1;\n\tfor(i = 0; i < %s_ndims; i++) {\n\t\t%s_total *= %s_dimsizes[i];\n\t}\n", sym->name,sym->name,sym->name,sym->name);
tmp->additional_src = WNewAdditionalSrc(buffer,0);
}
DoDimsizes(sym);
}
WParamLoc* NewParamLoc(NclSymbol *sym) {
WParamLoc *loc = (WParamLoc*)malloc(sizeof(WParamLoc));
int i;
if(sym != NULL) {
loc->type = FARGNEW;
loc->xfarg = sym;
loc->wsym = NULL;
loc->cdef = NULL;
loc->n_dims = sym->u.xref->u.farg->n_dims;
loc->datatype = sym->u.xref->u.farg->datatype;
for(i = 0; i < loc->n_dims; i++) {
loc->dim_sizes[i] = sym->u.xref->u.farg->dim_sizes[i];
sprintf(loc->dim_refs[i],"(%d)",sym->u.xref->u.farg->dim_sizes[i]);
}
return(loc);
} else {
loc->type = RETURN;
loc->xfarg = NULL;
loc->wsym = NULL;
loc->cdef = NULL;
loc->n_dims = -1;
loc->datatype = NCL_none;
return(loc);
}
}
main(int argc,char* argv[])
{
WWrapRecList* tmp;
WArgValList *arg_list;
int i,j;
NclSymbol* s;
char *buffer[1024];
char upper[1024];
char lower[1024];
char *type = "NclANY";
fprintf(stdout,initial_fmt);
if(!yyparse()) {
/*
tmp = wrap_list;
while(tmp!= NULL) {
fprintf(stdout,"extern NhlErrorTypes %s_W(\n#if NhlNeedProto\nvoid\n#endif\n);\n\n",tmp->therec->c_defstring);
tmp = tmp->next;
}
*/
fprintf(stdout,init_fmt);
tmp = wrap_list;
while(tmp!= NULL) {
fprintf(stdout,"\tnargs = 0;\n");
fprintf(stdout,"\targs = NewArgs(%d);\n",tmp->therec->c_callrec->n_args);
arg_list = tmp->therec->c_argval;
i = 0;
while(arg_list != NULL) {
s = _NclLookUpInScope(tmp->therec->wrec,arg_list->arec->assign_to);
if(s != NULL) {
switch (s->u.wparam->datatype) {
case NCL_int:
type = "integer";
break;
case NCL_long:
type = "long";
break;
case NCL_short:
type = "short";
break;
case NCL_float:
type = "float";
break;
case NCL_double:
type = "double";
break;
case NCL_byte:
type = "byte";
break;
case NCL_char:
type = "character";
break;
case NCL_string:
type = "string";
break;
case NCL_logical:
type = "logical";
break;
}
if(s->u.wparam->n_dims > 0 ) {
for(j = 0; j < s->u.wparam->n_dims; j++) {
fprintf(stdout,"\tdimsizes[%d] = %d;\n",j,s->u.wparam->dim_sizes[j]);
}
fprintf(stdout,"\tSetArgTemplate(args,%d,\"%s\",%d,dimsizes);nargs++;\n",arg_list->arec->pnum,type,s->u.wparam->n_dims);
} else {
fprintf(stdout,"\tSetArgTemplate(args,%d,\"%s\",NclANY,NclANY);nargs++;\n",arg_list->arec->pnum,type);
}
}
i++;
arg_list = arg_list->next;
}
for(j = 0; j < strlen(tmp->therec->c_defstring); j++) {
if((!isdigit(tmp->therec->c_defstring[j]))&&(isalpha(tmp->therec->c_defstring[j]))) {
if(isupper(tmp->therec->c_defstring[j])) {
upper[j] = tmp->therec->c_defstring[j];
lower[j] = (char)((int)tmp->therec->c_defstring[j] + 32) ;
} else {
lower[j] = tmp->therec->c_defstring[j];
upper[j] = (char)((int)tmp->therec->c_defstring[j] - 32) ;
}
} else {
upper[j] = lower[j] = tmp->therec->c_defstring[j];
}
}
upper[j] = lower[j] = '\0';
if(tmp->therec->f_or_p) {
fprintf(stdout,"\tNclRegisterFunc(%s_W,args,\"%s\",nargs);\n\n",tmp->therec->c_defstring,upper);
} else {
fprintf(stdout,"\tNclRegisterProc(%s_W,args,\"%s\",nargs);\n\n",tmp->therec->c_defstring,upper);
}
if(tmp->therec->f_or_p) {
fprintf(stdout,"\tNclRegisterFunc(%s_W,args,\"%s\",nargs);\n\n",tmp->therec->c_defstring,lower);
} else {
fprintf(stdout,"\tNclRegisterProc(%s_W,args,\"%s\",nargs);\n\n",tmp->therec->c_defstring,lower);
}
tmp = tmp->next;
}
fprintf(stdout,endf_fmt);
exit(0);
} else {
fprintf(stdout,"Everything is NOT ok!\n");
exit(1);
}
}
More information about the ncl-install
mailing list