Project

General

Profile

Bug #699

Compile fail in stable verion 1.4.4

Added by Bich Hanh over 4 years ago. Updated 3 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
General
Target version:
-
Start date:
08/08/2014
Due date:
% Done:

0%

Estimated time:
Affected version:

Description

Hello,
I'm facing with compile issue when doing "make" with version 1.4.4

My server is HP Gen7, Intel Processor, here is my Linux distro (Virtual machine)

app@application:/usr/src/kannel-snapshot$ sudo lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 7.5 (wheezy)
Release: 7.5
Codename: wheezy

I've already installed package "bison" version 3.0.2, which has no any problem with previous SVN versions until now.
I has been successful to compile ver 1.4.4 on another server which has bison version 2.5, same OS.

Here is the error:

app@application:/usr/src/gateway-1.4.4$ sudo make -j 24
...
gcc -std=gnu99 -D_REENTRANT=1 -I. -Igw -g -O2 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_LARGE_FILES= -I/usr/include/libxml2 -I/usr/local/lib/include -I/usr/include/mysql -o gw/bearerbox.o -c gw/bearerbox.c
gcc -std=gnu99 -D_REENTRANT=1 -I. -Igw -g -O2 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_LARGE_FILES= -I/usr/include/libxml2 -I/usr/local/lib/include -I/usr/include/mysql -o gw/smsbox.o -c gw/smsbox.c
y.tab.c:348:5: error: conflicting types for ‘ws_yy_parse’
In file included from wmlscript/wsgram.y:15:0:
./wmlscript/wsint.h:296:5: note: previous declaration of ‘ws_yy_parse’ was here
int ws_yy_parse(void *context);
^
wmlscript/wsgram.c:63:25: error: conflicting types for ‘ws_yy_parse’
#define yyparse ws_yy_parse
^
y.tab.c:1508:1: note: in expansion of macro ‘yyparse’
In file included from wmlscript/wsgram.y:15:0:
./wmlscript/wsint.h:296:5: note: previous declaration of ‘ws_yy_parse’ was here
int ws_yy_parse(void *context);
^
wmlscript/wsgram.y: In function ‘ws_yy_parse’:
wmlscript/wsgram.y:122:23: error: ‘pctx’ undeclared (first use in this function) { ws_error_syntax(pctx, @1.first_line); }
^
wmlscript/wsgram.y:122:23: note: each undeclared identifier is reported only once for each function it appears in
In file included from wmlscript/wslexer.c:72:0:
y.tab.h:262:5: error: conflicting types for ‘ws_yy_parse’
In file included from wmlscript/wslexer.c:70:0:
wmlscript/wsint.h:296:5: note: previous declaration of ‘ws_yy_parse’ was here
int ws_yy_parse(void context);
^
In file included from wmlscript/wsstree.c:72:0:
y.tab.h:262:5: error: conflicting types for ‘ws_yy_parse’
In file included from wmlscript/wsstree.c:71:0:
wmlscript/wsint.h:296:5: note: previous declaration of ‘ws_yy_parse’ was here
int ws_yy_parse(void *context);
^
Makefile:231: recipe for target 'wmlscript/wsgram.o' failed
make:
[wmlscript/wsgram.o] Error 1
make:
Waiting for unfinished jobs....
Makefile:231: recipe for target 'wmlscript/wslexer.o' failed
make:
[wmlscript/wslexer.o] Error 1
Makefile:231: recipe for target 'wmlscript/wsstree.o' failed
make: *
[wmlscript/wsstree.o] Error 1
app@application:/usr/src/gateway-1.4.4$

I also revert back bison from 3.0.2 to 2.5 on this server but error still persist:

app@application:/usr/src/gateway-1.4.4$ sudo make -j 24
gcc -std=gnu99 -D_REENTRANT=1 -I. -Igw -g -O2 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_LARGE_FILES= -I/usr/include/libxml2 -I/usr/local/lib/include -I/usr/include/mysql -o wmlscript/wsgram.o -c wmlscript/wsgram.c
gcc -std=gnu99 -D_REENTRANT=1 -I. -Igw -g -O2 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_LARGE_FILES= -I/usr/include/libxml2 -I/usr/local/lib/include -I/usr/include/mysql -o wmlscript/wslexer.o -c wmlscript/wslexer.c
gcc -std=gnu99 -D_REENTRANT=1 -I. -Igw -g -O2 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_LARGE_FILES= -I/usr/include/libxml2 -I/usr/local/lib/include -I/usr/include/mysql -o wmlscript/wsstree.o -c wmlscript/wsstree.c
y.tab.c:348:5: error: conflicting types for ‘ws_yy_parse’
In file included from wmlscript/wsgram.y:15:0:
./wmlscript/wsint.h:296:5: note: previous declaration of ‘ws_yy_parse’ was here
int ws_yy_parse(void *context);
^
In file included from wmlscript/wslexer.c:72:0:
y.tab.h:262:5: error: conflicting types for ‘ws_yy_parse’
In file included from wmlscript/wslexer.c:70:0:
wmlscript/wsint.h:296:5: note: previous declaration of ‘ws_yy_parse’ was here
int ws_yy_parse(void *context);
^
wmlscript/wsgram.c:63:25: error: conflicting types for ‘ws_yy_parse’
#define yyparse ws_yy_parse
^
y.tab.c:1508:1: note: in expansion of macro ‘yyparse’
In file included from wmlscript/wsgram.y:15:0:
./wmlscript/wsint.h:296:5: note: previous declaration of ‘ws_yy_parse’ was here
int ws_yy_parse(void *context);
^
In file included from wmlscript/wsstree.c:72:0:
y.tab.h:262:5: error: conflicting types for ‘ws_yy_parse’
In file included from wmlscript/wsstree.c:71:0:
wmlscript/wsint.h:296:5: note: previous declaration of ‘ws_yy_parse’ was here
int ws_yy_parse(void *context);
^
wmlscript/wsgram.y: In function ‘ws_yy_parse’:
wmlscript/wsgram.y:122:23: error: ‘pctx’ undeclared (first use in this function) { ws_error_syntax(pctx, @1.first_line); }
^
wmlscript/wsgram.y:122:23: note: each undeclared identifier is reported only once for each function it appears in
Makefile:231: recipe for target 'wmlscript/wslexer.o' failed
make: * [wmlscript/wslexer.o] Error 1
make:
Waiting for unfinished jobs....
Makefile:231: recipe for target 'wmlscript/wsgram.o' failed
make:
[wmlscript/wsgram.o] Error 1
Makefile:231: recipe for target 'wmlscript/wsstree.o' failed
make: *
[wmlscript/wsstree.o] Error 1
app@application:/usr/src/gateway-1.4.4$

Thank you.

gateway-1.4.5.patch.gz (4.32 KB) gateway-1.4.5.patch.gz gzipped patch file Rici Lake, 08/18/2018 06:01 PM

Associated revisions

Revision 5241 (diff)
Added by Alexander Malysh 3 months ago

  • wmlscript/wsgram.[chy], wmlscript/wsint.h, wmlscript/wslexer.c: Applied patch that
    fixes build issues with bison. This fixes #699 .
    Thanks to Rici Lake for this patch.

History

#1 Updated by Wayne Gemmell about 4 years ago

Hi

I can confirm that kannel cannot be built with bison 3.0.4 which ships with Ubuntu 14.4.1 LTS. If I install bison 2.5 and the corresponding library the build is successful.

#2 Updated by Stipe Tolj almost 4 years ago

  • Status changed from New to Assigned

confirmed on a ubuntu-14.04-LTS system.

#3 Updated by Mihail Teodorescu almost 3 years ago

Hello

The problem comes from the fact that from Bison version 3 , the support for the option YYLEXPARAM was removed.
http://active6.blogspot.ro/2013/07/bison-30.html
If you will put Bison 2.7 instead you will be able to build the sources without problems.

The problem explained in more detail:
from the file wmlscript/wsgram.y are generated the files wmlscript/wsgram.h and wmlscript/wsgram.c .This is done with bison.
In the file wsgram.c we have declared the function int ws_yy_parse();
#define yyparse ws_yy_parse
int
yyparse (void)
wsgram.c have included the file:
wsint.h
In the header wsint.h ,we have declared the same function,but with a different prototype:
int ws_yy_parse(void *context);

If you want to build you need to do a make clean,delete the files wsgram.c and wsgram.h and build again.

Regards,
Mihail

#4 Updated by Wayne Gemmell almost 3 years ago

Thanks for the info Mihail. That is a lot easier than convincing modern linux installations to install bison 2.7.
It's not a great solution overall though.

#5 Updated by Rici Lake 3 months ago

As Mihail Teoderscu said, the problem occurs because bison 3 no longer supports YYLEX_PARAM and YYPARSE_PARAM. Both were have been deprecated since version 1.875, which was released on January 1, 2003.

The solution is to use %parse-param and %lex-param directives, which has the additional advantage that it is no longer necessary to make the parameters void*. Instead, they can be declared as WsCompiler*, avoiding the need for

WsCompiler* compiler = (WsCompiler*)pctx;

which appears in a number of places in the code.

Once you declare a %parse-param, the parameter and the location object get provided to yyerror. That function is not actually useful in the current wmlscript code, but it still needs to be declared correctly. Since it will now take a YYLTYPE argument, it can only be declared after YYLTYPE itself is declared, which is after the %union declaration.

I've prepared a patch which performs precisely these tasks:

-- remove YYLEX_PARAM and YYPARSE_PARAM #defines
-- add %lex-param and %parse-param directives
-- change all uses of void* pctx to WsCompiler* compiler
-- remove unnecessary casts from void* to WsCompiler*
-- modify the declaration of yyerror and move the declaration below %union so that it will have access to YYLTYPE.

I did not move the declaration of yylex out of wsint.h and into wsgram.y, which in my opinion would be better. That could be done later.

I tested the patch against version 1.4.5 of kannel, using the following bison versions: 2.3, 2.4, 2.4.1, 2.5.1, 2.6, 2.6.1, 2.6.2, 2.6.3, 2.6.4, 2.6.5, 2.7, 2.7.1, 3.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5. For each bison release, I configured and built kannel, and executed utils/run-checks checks/check_compiler.sh. In all cases, the software built without errors and successfully completed the test.

Initially, I had tried to run the complete test suite, but discovered that it often fails on an unrelated bug which causes a panic when an attempt is made to destroy a locked mutex. Because set -e is used in the check scripts, the panic causes an immediate exit and various daemons are left running, which causes later tests to fail because ports are in use.

To apply the attached patch file, cd to the top of the kannel source tree, and gunzip -c the patch into patch -p1. (The following examples assumes that you are starting from the kannel distribution file.)

rici@rici-hp:~/src$ tar xf gateway-1.4.5.tar.bz2
rici@rici-hp:~/src$ cd gateway-1.4.5
rici@rici-hp:~/src/gateway-1.4.5$ gunzip -c ../gateway-1.4.5.patch.gz | patch -p1
patching file wmlscript/wsgram.y
patching file wmlscript/wsint.h
patching file wmlscript/wslexer.c

You can then ./configure, make and make install as usual.

#6 Updated by Vasia Pupkini4 3 months ago

Rici big thanks, your patch solve the problem!

#7 Updated by Alexander Malysh 3 months ago

  • Status changed from Assigned to Resolved

Hi Rici,

thanks for your patch. Patch commited to SVN.

Thanks,
Alex

Also available in: Atom PDF