Skip site navigation (1) Skip section navigation (2)

base_yylex undefined in src/interface/ecpg/preproc/parser.c

From: Дилян Палаузов <dpa-postgres(at)aegee(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: base_yylex undefined in src/interface/ecpg/preproc/parser.c
Date: 2016-12-11 16:49:39
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs

with the newest flex (v2.6.2-19-g6bea32e, which is newer than 2.6.3) I 
need this patch to compile postgres:

diff --git a/src/interfaces/ecpg/preproc/pgc.l 
index 0453409d37..1c82b58e18 100644
--- a/src/interfaces/ecpg/preproc/pgc.l
+++ b/src/interfaces/ecpg/preproc/pgc.l
@@ -30,7 +30,7 @@ static int            xcdepth = 0;    /* depth of 
nesting in slash-star comments */
  static char       *dolqstart = NULL;   /* current $foo$ quote start 
string */
  static YY_BUFFER_STATE scanbufhandle;
  static char *scanbuf;
+#define yylex base_yylex
   * literalbuf is used to accumulate literal values when multiple rules
   * are needed to parse a single literal.  Call startlit to reset buffer

otherwise the linker fails with:

gcc -Wall -Wmissing-prototypes -Wpointer-arith 
-Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute 
-Wformat-security -fno-strict-aliasing -fwrapv 
-fexcess-precision=standard -g -O0 -pthread  -D_REENTRANT -D_THREAD_SAFE 
-L../../../../src/common -L/usr/local/lib -L/usr/local/lib 
-L/usr/local/lib  -Wl,--as-needed 
-Wl,-rpath,'/usr/local/lib',--enable-new-dtags  preproc.o type.o ecpg.o 
output.o parser.o keywords.o c_keywords.o ecpg_keywords.o kwlookup.o 
../ecpglib/typename.o descriptor.o variable.o -lpgcommon -lpgport -lxslt 
-lxml2 -lssl -lcrypto -lgssapi_krb5 -lz -lreadline -lrt -lcrypt -ldl -lm 
  -lpthread    -o ecpg
parser.o: In function `filtered_base_yylex':
/git/postgresql/src/interfaces/ecpg/preproc/parser.c:68: undefined 
reference to `base_yylex'
/git/postgresql/src/interfaces/ecpg/preproc/parser.c:105: undefined 
reference to `base_yylex'
collect2: error: ld returned 1 exit status
make: *** [Makefile:42: ecpg] Error 1

because of ecpg/preproc/parser.c:68 (in REL9_5_STABLE)

With previous versions of flex the compilation has worked.  But I do not 
find in the code where is supposed yylex to be renamed to base_yylex 
when parser.c is proccessed.  pgc.l also does not use %option 
prefix=base_yy, which would be the right way to rename yylex (apart from 
#define YY_DECL).

What is the purpose to rename yylex to base_yylex?



pgsql-bugs by date

Next:From: Tom LaneDate: 2016-12-11 18:32:50
Subject: Re: base_yylex undefined in src/interface/ecpg/preproc/parser.c
Previous:From: Tom LaneDate: 2016-12-11 00:14:31
Subject: Re: BUG #14459: Error from query with too many binds has no message

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group