Re: [netcdfgroup] NetCDF 4.4.1 Compile Error on Centos 6.8.

Not sure what is going on; it seems to compile ok for me
using gcc version 4.9.3 (under cygwin).
It is possible that other version will not allow
specifying the same typedef multiple times.

In any case, I am attaching the modified dceparselex.h that you
should use (I think is the same as the changes I suggested).
=Dennis Heimbigner
 Unidata

On 7/9/2016 6:14 PM, Capehart, William J wrote:
Thanks Dennis.

That got me over one hump.

Alas there is a new hump though (also in the libdap2 directory):

Making all in libdap2
make[2]: Entering directory `/usr/local/netcdf-4.4.1/libdap2'
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..  
-I../include -I../oc2  -I../libsrc4 -I/usr/local/netcdf/include  -Msignextend 
-fPIC  -MT libdap2_la-constraints.lo -MD -MP -MF 
.deps/libdap2_la-constraints.Tpo -c -o libdap2_la-constraints.lo `test -f 
'constraints.c' || echo './'`constraints.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I../include -I../oc2 
-I../libsrc4 -I/usr/local/netcdf/include -Msignextend -fPIC -MT 
libdap2_la-constraints.lo -MD -MP -MF .deps/libdap2_la-constraints.Tpo -c 
constraints.c  -fPIC -DPIC -o .libs/libdap2_la-constraints.o
In file included from dceparselex.h:14,
                 from constraints.c:7:
dcetab.h:63: error: expected â)â before â*â token
In file included from constraints.c:7:
dceparselex.h:49: warning: useless storage class specifier in empty declaration
dceparselex.h:57: error: expected â)â before â*â token
dceparselex.h:58: error: expected â)â before â*â token
dceparselex.h:61: error: expected â)â before â*â token
dceparselex.h:63: error: expected â)â before â*â token
dceparselex.h:64: error: expected â)â before â*â token
dceparselex.h:65: error: expected â)â before â*â token
dceparselex.h:66: error: expected â)â before â*â token
dceparselex.h:67: error: expected â)â before â*â token
dceparselex.h:68: error: expected â)â before â*â token
dceparselex.h:69: error: expected â)â before â*â token
dceparselex.h:70: error: expected â)â before â*â token
dceparselex.h:71: error: expected â)â before â*â token
dceparselex.h:72: error: expected â)â before â*â token
dceparselex.h:73: error: expected â)â before â*â token
dceparselex.h:74: error: expected â)â before â*â token
dceparselex.h:75: error: expected â)â before â*â token
dceparselex.h:76: error: expected â)â before â*â token
dceparselex.h:77: error: expected â)â before â*â token
dceparselex.h:78: error: expected â)â before â*â token
dceparselex.h:79: error: expected â)â before â*â token
dceparselex.h:81: error: expected â)â before â*â token
dceparselex.h:82: error: expected â)â before â*â token
dceparselex.h:83: error: expected â)â before â*â token
dceparselex.h:84: error: expected â)â before â*â token
dceparselex.h:85: error: expected â)â before â*â token
dceparselex.h:86: error: expected â)â before â*â token
dceparselex.h:87: error: expected â)â before â*â token
dceparselex.h:90: error: expected declaration specifiers or â...â before 
âDCEparsestateâ
make[2]: *** [libdap2_la-constraints.lo] Error 1
make[2]: Leaving directory `/usr/local/netcdf-4.4.1/libdap2'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/netcdf-4.4.1'
make: *** [all] Error 2



On 7/9/16, 18:04 MDT, "dmh@xxxxxxxx" <dmh@xxxxxxxx> wrote:

Odd, something changed at some point.
In any case try changing line 50(?)
from
typedef struct DCEparsestate {
to
struct DCEparsestate {

and line 55(?)
from
} DCEparsestate;
to
};

On 7/9/2016 5:34 PM, Capehart, William J wrote:
Hello All:



I am getting the following compile error in the ./libdap2 directory when
building NetCDF 4.4.1 with the opendap options enabled (the error
disappears when I disable DAP on configure).



Making all in libdap2

make[2]: Entering directory `/usr/local/netcdf-4.4.1/libdap2'

/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.
-I..  -I../include -I../oc2  -I../libsrc4 -I/usr/local/netcdf/include
-Msignextend -fPIC  -MT libdap2_la-constraints.lo -MD -MP -MF
.deps/libdap2_la-constraints.Tpo -c -o libdap2_la-constraints.lo `test
-f 'constraints.c' || echo './'`constraints.c

libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I../include -I../oc2
-I../libsrc4 -I/usr/local/netcdf/include -Msignextend -fPIC -MT
libdap2_la-constraints.lo -MD -MP -MF .deps/libdap2_la-constraints.Tpo
-c constraints.c  -fPIC -DPIC -o .libs/libdap2_la-constraints.o

In file included from constraints.c:7:

dceparselex.h:49: error: redefinition of typedef âDCEparsestateâ

dceparselex.h:11: note: previous declaration of âDCEparsestateâ was here

make[2]: *** [libdap2_la-constraints.lo] Error 1

make[2]: Leaving directory `/usr/local/netcdf-4.4.1/libdap2'

make[1]: *** [all-recursive] Error 1

make[1]: Leaving directory `/usr/local/netcdf-4.4.1'

make: *** [all] Error 2





Has anyone else encountered this?



I am building with libcurl 7.49.1 locally installed (it also happens
without a local install and just using the centos rpmsâs libraries).



The pesky lines noted above are as followsâ



dceparselex.h:~11



/* Forward */

struct DCEparsestate;

typedef struct DCEparsestate DCEparsestate;







and



dceparselex.h:~49



/*! Specifies DCEparsestate. */

typedef struct DCEparsestate {

    DCEconstraint* constraint;

    char errorbuf[1024];

    int errorcode;

    DCElexstate* lexstate;

} DCEparsestate;



Cheers and Thanks Much



================================================================

Bill Capehart <William.Capehart@xxxxxxxxx>   Associate Professor

Atmospheric & Environmental Sciences            Program Director

Civil and Environmental Engineering             Hydrometeorology

213 Mineral Industries Building

South Dakota School of Mines and Technology     Skype: wcapehart

501 East Saint Joseph Street                 Ph: +1-605-394-1994

Rapid City, SD 57701-3995                Mobile: +1-605-484-5692

=================== http://capehart.sdsmt.edu ==================







_______________________________________________
NOTE: All exchanges posted to Unidata maintained email lists are
recorded in the Unidata inquiry tracking system and made publicly
available through the web.  Users who post to any of the lists we
maintain are reminded to remove any personal information that they
do not want to be made public.


netcdfgroup mailing list
netcdfgroup@xxxxxxxxxxxxxxxx
For list information or to unsubscribe,  visit: 
http://www.unidata.ucar.edu/mailing_lists/



/* Copyright 2009, UCAR/Unidata and OPeNDAP, Inc.
   See the COPYRIGHT file for more information. */

#ifndef DCEPARSELEX_H
#define DCEPARSELEX_H

#include "config.h"

/* Forward */
struct DCEparsestate;
typedef struct DCEparsestate DCEparsestate;

#include "dcetab.h"

#ifdef WIN32


#endif

/* For consistency with Java parser */
#ifndef null
#define null NULL
#endif

typedef void* Object;

#define YYSTYPE Object

#define MAX_TOKEN_LENGTH 1024

/*! Specifies DCElexstate. */
typedef struct DCElexstate {
    char* input;
    char* next; /* next char in uri.query */
    NCbytes* yytext;
    /*! Specifies the Lasttoken. */
    int lasttoken;
    char lasttokentext[MAX_TOKEN_LENGTH+1]; /* leave room for trailing null */
    NClist* reclaim; /* reclaim SCAN_WORD instances */
} DCElexstate;

/*! Specifies DCEparsestate. */
struct DCEparsestate {
    DCEconstraint* constraint;
    char errorbuf[1024];
    int errorcode;
    DCElexstate* lexstate;
};

/* Define a generic object carrier; this serves
   essentially the same role as the typical bison %union
   declaration
*/
   

extern int ceerror(DCEparsestate*,char*);
extern void ce_parse_error(DCEparsestate*,const char *fmt, ...);

/* bison parse entry point */
extern int dceparse(DCEparsestate*);

extern int dceerror(DCEparsestate* state, char* msg);
extern void projections(DCEparsestate* state, Object list0);
extern void selections(DCEparsestate* state, Object list0);
extern Object projectionlist(DCEparsestate* state, Object list0, Object decl);
extern Object projection(DCEparsestate* state, Object segmentlist);
extern Object segmentlist(DCEparsestate* state, Object list0, Object decl);
extern Object segment(DCEparsestate* state, Object name, Object slices0);
extern Object array_indices(DCEparsestate* state, Object list0, Object decl);
extern Object range(DCEparsestate* state, Object, Object, Object);
extern Object selectionlist(DCEparsestate* state, Object list0, Object decl);
extern Object sel_clause(DCEparsestate* state, int selcase, Object path0, 
Object relop0, Object values);
extern Object selectionpath(DCEparsestate* state, Object list0, Object text);
extern Object arrayelement(DCEparsestate* state, Object name, Object index);
extern Object function(DCEparsestate* state, Object fcnname, Object args);
extern Object arg_list(DCEparsestate* state, Object list0, Object decl);
extern Object value_list(DCEparsestate* state, Object list0, Object decl);
extern Object value(DCEparsestate* state, Object value);
extern Object makeselectiontag(CEsort);
extern Object indexer(DCEparsestate* state, Object name, Object indices);
extern Object indexpath(DCEparsestate* state, Object list0, Object index);
extern Object var(DCEparsestate* state, Object indexpath);
extern Object constant(DCEparsestate* state, Object val, int tag);
extern Object clauselist(DCEparsestate* state, Object list0, Object decl);
extern Object range1(DCEparsestate* state, Object rangenumber);
extern Object rangelist(DCEparsestate* state, Object list0, Object decl);

/* lexer interface */
extern int dcelex(YYSTYPE*, DCEparsestate*);
extern void dcelexinit(char* input, DCElexstate** lexstatep);
extern void dcelexcleanup(DCElexstate** lexstatep);

extern int dcedebug;

#ifdef PARSEDEBUG
extern Object debugobject(Object);
#define checkobject(x) debugobject(x)
#else
#define checkobject(x) (x)
#endif

extern int dapceparse(char* input, DCEconstraint*, char**);

#endif /*DCEPARSELEX_H*/