Обсуждение: tsearch2 in 7.4beta1 compile problem

Поиск
Список
Период
Сортировка

tsearch2 in 7.4beta1 compile problem

От
Jeff Davis
Дата:
After installing PostgreSQL 7.4 beta 1 from source, I decided to install the
/contrib module tsearch2.

I cd to the tsearch2 directory and typed "make", however I get an error that
yy_current_buffer is an undeclared identifier in wordparser/parser.c (which
is apparently autogenerated with flex from parser.l).

I looked online, and it seemed like I was building the module in the right
way. I also downloaded the latest development version, and that seemed to
fail in the same way.

Has anyone else had this problem? I'm using flex 2.5.31 and gcc 3.3.1.

Thanks,
    Jeff


Re: tsearch2 in 7.4beta1 compile problem

От
Oleg Bartunov
Дата:
This is a FAQ. Don't use flex 2.5.31
Downgrade to stable 2.5.4.

    Oleg
On Wed, 13 Aug 2003, Jeff Davis wrote:

> After installing PostgreSQL 7.4 beta 1 from source, I decided to install the
> /contrib module tsearch2.
>
> I cd to the tsearch2 directory and typed "make", however I get an error that
> yy_current_buffer is an undeclared identifier in wordparser/parser.c (which
> is apparently autogenerated with flex from parser.l).
>
> I looked online, and it seemed like I was building the module in the right
> way. I also downloaded the latest development version, and that seemed to
> fail in the same way.
>
> Has anyone else had this problem? I'm using flex 2.5.31 and gcc 3.3.1.
>
> Thanks,
>     Jeff
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly
>

    Regards,
        Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

Re: tsearch2 in 7.4beta1 compile problem

От
Tom Lane
Дата:
Oleg Bartunov <oleg@sai.msu.su> writes:
> On Wed, 13 Aug 2003, Jeff Davis wrote:
>> I cd to the tsearch2 directory and typed "make", however I get an error that
>> yy_current_buffer is an undeclared identifier in wordparser/parser.c (which
>> is apparently autogenerated with flex from parser.l).

> This is a FAQ. Don't use flex 2.5.31
> Downgrade to stable 2.5.4.

Still, it would be better if it worked than not.  (All the core code
does seem to work with flex 2.5.31 now; only contrib is behind.)

AFAICT tsearch2's incompatibility is in the redefined YY_INPUT macro,
which seems of no value for Postgres anyway.  Can't we take that out?

            regards, tom lane

Re: tsearch2 in 7.4beta1 compile problem

От
Oleg Bartunov
Дата:
On Thu, 14 Aug 2003, Tom Lane wrote:

> Oleg Bartunov <oleg@sai.msu.su> writes:
> > On Wed, 13 Aug 2003, Jeff Davis wrote:
> >> I cd to the tsearch2 directory and typed "make", however I get an error that
> >> yy_current_buffer is an undeclared identifier in wordparser/parser.c (which
> >> is apparently autogenerated with flex from parser.l).
>
> > This is a FAQ. Don't use flex 2.5.31
> > Downgrade to stable 2.5.4.
>
> Still, it would be better if it worked than not.  (All the core code
> does seem to work with flex 2.5.31 now; only contrib is behind.)

ok. I recall discussion several months ago about 2.5.31 version.
So, we oficially support it ?

>
> AFAICT tsearch2's incompatibility is in the redefined YY_INPUT macro,
> which seems of no value for Postgres anyway.  Can't we take that out?
>

We'll see.

>             regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

    Regards,
        Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

Re: tsearch2 in 7.4beta1 compile problem

От
Tom Lane
Дата:
Oleg Bartunov <oleg@sai.msu.su> writes:
> On Thu, 14 Aug 2003, Tom Lane wrote:
>> Still, it would be better if it worked than not.  (All the core code
>> does seem to work with flex 2.5.31 now; only contrib is behind.)

> ok. I recall discussion several months ago about 2.5.31 version.
> So, we oficially support it ?

I wouldn't say that, exactly --- if anyone has any problems with 2.5.31
I'll be the first to say "use 2.5.4".  (2.5.31 doesn't even compile on
my primary machine.)  But I assume the flex guys will fix their little
problems soon, and that before PG 7.4 reaches end of life the newer flex
behavior will be standard.  So I think it behooves us to update our code
to be compatible.  The core code all works with either 2.5.4 or 2.5.31
now, and I'd like to see contrib doing the same.  (cube and seg are
broken, but I'll work on fixing those if you'll take care of tsearch
and tsearch2.)

            regards, tom lane

Re: tsearch2 in 7.4beta1 compile problem

От
Oleg Bartunov
Дата:
On Fri, 15 Aug 2003, Tom Lane wrote:

> Oleg Bartunov <oleg@sai.msu.su> writes:
> > On Thu, 14 Aug 2003, Tom Lane wrote:
> >> Still, it would be better if it worked than not.  (All the core code
> >> does seem to work with flex 2.5.31 now; only contrib is behind.)
>
> > ok. I recall discussion several months ago about 2.5.31 version.
> > So, we oficially support it ?
>
> I wouldn't say that, exactly --- if anyone has any problems with 2.5.31
> I'll be the first to say "use 2.5.4".  (2.5.31 doesn't even compile on
> my primary machine.)  But I assume the flex guys will fix their little
> problems soon, and that before PG 7.4 reaches end of life the newer flex
> behavior will be standard.  So I think it behooves us to update our code
> to be compatible.  The core code all works with either 2.5.4 or 2.5.31
> now, and I'd like to see contrib doing the same.  (cube and seg are
> broken, but I'll work on fixing those if you'll take care of tsearch
> and tsearch2.)
>

ok, I see your arguments. Teodor is working on that issue.


>             regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
>                http://archives.postgresql.org
>

    Regards,
        Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

Re: tsearch2 in 7.4beta1 compile problem

От
Teodor Sigaev
Дата:
> AFAICT tsearch2's incompatibility is in the redefined YY_INPUT macro,
> which seems of no value for Postgres anyway.  Can't we take that out?

I resolve problem with gm4 with a help of symlink and reorder my PATH. So, it
compiles but creates core dump while regression (postgres is compiled with
enable-debug and enable-cassert):

#0  0x284b5507 in tsearch2_yy_switch_to_buffer (new_buffer=0x84040a0)
     at parser.c:1725
1725                    YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
(gdb)  print (yy_buffer_stack)[(yy_buffer_stack_top)]
$1 = 0x7f7f7f7f
(gdb)  print yy_buffer_stack_top
$2 = 0
(gdb) bt
#0  0x284b5507 in tsearch2_yy_switch_to_buffer (new_buffer=0x84040a0)
     at parser.c:1725
#1  0x284b5bb2 in tsearch2_yy_scan_buffer (
     base=0x8404314 "345 qwe@efd.r ' http://www.com/ http://aew.werc.ewr/?ad=qwe&
dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http:/
/4aew.werc.ewr http://5aew.werc.ewr:8100/?  ad=qwe&dw 6aew.w"..., size=566)
     at parser.c:1976
#2  0x284b5c8e in tsearch2_yy_scan_bytes (
     bytes=0x835aa48 "345 qwe@efd.r ' http://www.com/ http://aew.werc.ewr/?ad=qwe
&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http:
//4aew.werc.ewr http://5aew.werc.ewr:8100/?  ad=qwe&dw 6aew.w"..., len=564)
     at parser.c:2020
#3  0x284b5fed in start_parse_str (
     str=0x835aa48 "345 qwe@efd.r ' http://www.com/ http://aew.werc.ewr/?ad=qwe&d
w 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://
4aew.werc.ewr http://5aew.werc.ewr:8100/?  ad=qwe&dw 6aew.w"..., limit=564)
     at parser.l:303

It seems to me, bug in flex...






--
Teodor Sigaev                                  E-mail: teodor@sigaev.ru


Re: tsearch2 in 7.4beta1 compile problem

От
Teodor Sigaev
Дата:
> AFAICT tsearch2's incompatibility is in the redefined YY_INPUT macro,
> which seems of no value for Postgres anyway.  Can't we take that out?
>

Ok, I've removed it from tsearch and tsearch2. But I can't check it with new flex:
% /usr/local/bin/flex -8 -Ptsearch2_yy -o'parser.c' parser.l
m4: illegal option -- P
usage: m4 [-d flags] [-t name] [-gs] [-D name[=value]]...
           [-U name]... [-I dirname]... file...

%uname -a
FreeBSD xor 5.1-RELEASE FreeBSD 5.1-RELEASE #3: Fri Jun 13 20:34:53 MSD 2003

So flex calls m4 which isn't gnu m4, it is system utility. GNU m4 is named as
gm4... I can't find any option about which m4 to use.


--
Teodor Sigaev                                  E-mail: teodor@sigaev.ru


Re: tsearch2 in 7.4beta1 compile problem

От
Tom Lane
Дата:
Teodor Sigaev <teodor@sigaev.ru> writes:
>> AFAICT tsearch2's incompatibility is in the redefined YY_INPUT macro,
>> which seems of no value for Postgres anyway.  Can't we take that out?

> I resolve problem with gm4 with a help of symlink and reorder my PATH. So, it
> compiles but creates core dump while regression (postgres is compiled with
> enable-debug and enable-cassert):

I found the cause -- you had #defined malloc as palloc, etc.  That
caused the yy_buffer_stack to get deallocated between calls to the
lexer, which flex isn't expecting.  Since you have code to clean up
the lexer state, I don't see any need to use palloc here.

            regards, tom lane