Bug 22205

Summary: webkit won't compile with bison 2.4!
Product: WebKit Reporter: daniel petre <daniel.petre>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Blocker CC: bero, gsherwood, jchaffraix, mario.bensi, peter, plaes
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Error building webkit with bison 2.4 installed
none
fix-bison-incompatibility.patch
none
Updated patch
none
Updated patch - same as before plus changelog darin: review+

Description daniel petre 2008-11-12 05:39:44 PST
hello,
it seems webkit-gtk will not compile on gentoo with bison 2.4 (downgrading to bison 2.3 works) as in http://pastebin.com/m471f5e34
Comment 1 Rafał Mużyło 2008-11-12 09:34:32 PST
pastebin is a very bad thing for bugzilla, as it will be invalid shortly.

attach build.log, please.
Comment 2 George Sherwood 2008-11-17 07:47:55 PST
Created attachment 25212 [details]
Error building webkit with bison 2.4 installed
Comment 3 George Sherwood 2008-11-17 07:48:48 PST
It isn't only gentoo.  We have the same problem on Sourcemage with Bison 2.4 and webkit.  Here is the final error (also attaching complete log):

/usr/bin/bison -d -p cssyy WebCore/css/CSSGrammar.y -o ./DerivedSources/CSSGrammar.cpp
WebCore/css/CSSGrammar.y:348.11-20: symbol maybe_sgml redefined
make: *** [DerivedSources/CSSGrammar.cpp] Error 1

Comment 4 daniel petre 2008-11-17 07:52:09 PST
(In reply to comment #2)
> Created an attachment (id=25212) [review]
> Error building webkit with bison 2.4 installed
> 

gentoo just released bison 2.4-r1, will test tomorrow and report if changes.
Comment 5 George Sherwood 2008-11-18 13:15:42 PST
I patched with the gentoo patch for R1 and it still fails.  Maybe it will work for you.
Comment 6 George Sherwood 2008-11-19 05:13:49 PST
Here is the response I got on the bison mailing list:

> > I have reported a bug with the webkit developers, but thought maybe
> > you would have a fix, so I can continue building webkit nightly
> > builds and have bison 2.4 installed.  Webkit build fine with bison
> > 2.3.
> > 
> > It fails very early in the build with this error:  

> > WebCore/css/CSSGrammar.y:348.11-20: symbol maybe_sgml redefined make:  

> 334 maybe_sgml:
> 335     /* empty */
> 336   | maybe_sgml SGML_CD
> 337   | maybe_sgml WHITESPACE
> 338   ;  

> 346 closing_brace:
> 347     '}'
> 348   | %prec maybe_sgml TOKEN_EOF
> 349   ;  

The argument of %prec must be a token.  maybe_sgml is a nonterminal.  
Bison 2.3 ignored this error.  Bison 2.3b and later complain about it.

I can't tell for sure what the webkit developers intended here, but 
removing maybe_sgml from line 348 should make Bison stop complaining.

-------------------------------
Removing maybe-sgml from line 348 results in:

/usr/bin/bison -d -p cssyy WebCore/css/CSSGrammar.y
-o ./DerivedSources/CSSGrammar.cpp 
WebCore/css/CSSGrammar.y: conflicts:105 shift/reduce, 6 reduce/reduce 
WebCore/css/CSSGrammar.y: expected 48 shift/reduce conflicts
WebCore/css/CSSGrammar.y: expected 0 reduce/reduce conflicts 
make: *** [DerivedSources/CSSGrammar.cpp] Error 1

Comment 7 Jeff Cook 2008-11-26 14:14:18 PST
I get the same issue on Arch Linux with Bison 2.4 currently in testing.
Comment 8 Jeff Cook 2008-11-26 14:15:21 PST
Also, the Gentoo bug report, fyi: http://bugs.gentoo.org/show_bug.cgi?format=multiple&id=246518
Comment 9 Brent Fulgham 2008-11-28 18:15:12 PST
This bug also present on Mac OS X, if you using the Bison 2.4 port.
Comment 10 Peter Gordon 2008-11-29 15:31:22 PST
This bug also appears on Fedora Development ("rawhide") using Bison 2.4 (specifically, bison-2.4-2.fc11).
Comment 11 Julien Chaffraix 2008-12-02 09:46:50 PST
Confirming the bug and updating its info as it should plague all ports and not only gtk as reported.
Comment 12 Mark Rowe (bdash) 2008-12-03 04:05:36 PST
*** Bug 22622 has been marked as a duplicate of this bug. ***
Comment 13 Priit Laes (IRC: plaes) 2008-12-05 00:11:33 PST
Created attachment 25765 [details]
fix-bison-incompatibility.patch

Created this patch based on discussions in bison-bugs mailinglist.

This fixes the build error, but it is so far only compile tested, because I have some linking troubles in JavascriptCore...
Comment 14 George Sherwood 2008-12-05 05:47:55 PST
This patch fails during the build for me although at a different place.  It looks similar to the one I created from the discussions on the bison mailing list.  I could never get it to work correct.  Here is the failure for me:


./doltlibtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I.  -DWTF_USE_ICU_UNICODE=1 -DBUILDING_CAIRO__=1 -DBUILDING_GTK__=1 -DWTF_CHANGES  -DXP_UNIX -DNDEBUG    -I./WebCore -I./WebCore/bindings/js -I./WebCore/bridge -I./WebCore/bridge/c -I./WebCore/css -I./WebCore/dom -I./WebCore/editing -I./WebCore/history -I./WebCore/html -I./WebCore/inspector -I./WebCore/loader -I./WebCore/loader/appcache -I./WebCore/loader/archive -I./WebCore/loader/icon -I./WebCore/page -I./WebCore/page/animation -I./WebCore/platform -I./WebCore/platform/graphics -I./WebCore/platform/graphics/filters -I./WebCore/platform/image-decoders -I./WebCore/platform/image-decoders/bmp -I./WebCore/platform/image-decoders/gif -I./WebCore/platform/image-decoders/ico -I./WebCore/platform/image-decoders/jpeg -I./WebCore/platform/image-decoders/png -I./WebCore/platform/image-decoders/xbm -I./WebCore/platform/network -I./WebCore/platform/text -I./WebCore/plugins -I./WebCore/rendering -I./WebCore/rendering/style -I./WebCore/xml -I./WebCore/bindings/js -DWTF_USE_CURL=1 -I./WebCore/platform/network/curl  -DENABLE_OFFLINE_WEB_APPLICATIONS=1 -DENABLE_DASHBOARD_SUPPORT=1 -DENABLE_DATABASE=1 -I./WebCore/platform/sql -I./WebCore/storage -DENABLE_DOM_STORAGE=1 -I./WebCore/storage -DENABLE_ICONDATABASE=1   -DENABLE_XPATH=1 -DENABLE_XSLT=1 -DENABLE_WORKERS=1  -DENABLE_GEOLOCATION=1 -DENABLE_SVG=1 -I\./WebCore/svg -I\./WebCore/svg/animation -I\./WebCore/svg/graphics -I\./WebCore/svg/graphics/filters -DENABLE_SVG_USE=1 -DENABLE_SVG_FOREIGN_OBJECT=1 -DENABLE_SVG_FONTS=1  -DENABLE_SVG_AS_IMAGE=1 -DENABLE_SVG_ANIMATION=1 -DDATA_DIR=\"/usr/share\" -I./JavaScriptCore -I./JavaScriptCore/ForwardingHeaders -I./JavaScriptCore/parser -I./JavaScriptCore/wtf -I./DerivedSources -I./JavaScriptCore/API -I./JavaScriptCore/ForwardingHeaders -I./JavaScriptCore/interpreter -I./JavaScriptCore/bytecode -I./JavaScriptCore/bytecompiler -I./JavaScriptCore/debugger -I./JavaScriptCore/jit -I./JavaScriptCore/pcre -I./JavaScriptCore/profiler -I./JavaScriptCore/runtime -I./JavaScriptCore/wrec -I./JavaScriptCore/jit -I./JavaScriptCore/assembler -I./JavaScriptCore/wtf/unicode -I./JavaScriptCore/pcre -I./JavaScriptCore/parser -I./JavaScriptCore/runtime  -I./WebCore/loader/gtk -I./WebCore/page/gtk -I./WebCore/platform/graphics/cairo -I./WebCore/platform/graphics/gtk -I./WebCore/platform/gtk -DUSE_FREETYPE=1  -I./WebCore/svg/graphics/cairo   -fvisibility-inlines-hidden -fno-rtti -fno-strict-aliasing -Wall -W -Wcast-align -Wchar-subscripts -Wreturn-type -Wformat -Wformat-security -Wno-format-y2k -Wundef -Wmissing-format-attribute -Wpointer-arith -Wwrite-strings -Wno-unused-parameter -Wno-parentheses -fno-exceptions -fvisibility=hidden -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include   -D_REENTRANT  -I/usr/include  -I/usr/include/libxml2   -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12   -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include   -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12      -I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include     -I/usr/include/libxml2     -march=pentium4 -pipe -O2 -MT DerivedSources/libWebCore_la-CSSGrammar.lo -MD -MP -MF DerivedSources/.deps/libWebCore_la-CSSGrammar.Tpo -c -o DerivedSources/libWebCore_la-CSSGrammar.lo `test -f 'DerivedSources/CSSGrammar.cpp' || echo './'`DerivedSources/CSSGrammar.cpp
make[1]: Leaving directory `/usr/src/WebKit-r39007'
WebCore/css/CSSGrammar.y: In function 'int cssyyparse(void*)':
WebCore/css/CSSGrammar.y:1360: error: expected `;' before '}' token
WebCore/css/CSSGrammar.y:1361: error: expected `;' before '}' token
WebCore/css/CSSGrammar.y:1363: error: expected `;' before '}' token
make[1]: *** [DerivedSources/libWebCore_la-CSSGrammar.lo] Error 1
make: *** [all] Error 2
Comment 15 Bernhard Rosenkraenzer 2008-12-05 07:12:35 PST
The patch works fine here (Ark Linux, building webkit-qt), both with bison 2.4 and 2.3.
Comment 16 George Sherwood 2008-12-05 08:20:25 PST
Double checked the patch and still getting the error with bison 2.4.  Bison 2.3 with no patches works fine. Building webkit-gtk here with Source Mage and gcc 4.3.2.
Comment 17 Bernhard Rosenkraenzer 2008-12-07 13:10:00 PST
Created attachment 25831 [details]
Updated patch

Turns out we're patching some strictness out of bison in Ark -- try the updated patch I'm attaching, that works for me even with stock bison 2.4
Comment 18 George Sherwood 2008-12-07 16:00:02 PST
The new patch works for me with Source Mage.
Comment 19 Holger Freyther 2008-12-16 07:38:03 PST
(In reply to comment #17)
> Created an attachment (id=25831) [review]
> Updated patch
> 
> Turns out we're patching some strictness out of bison in Ark -- try the updated
> patch I'm attaching, that works for me even with stock bison 2.4

Hey Bero, could you add a ChangeLog and set the review flag?

Comment 20 Julien Chaffraix 2008-12-18 08:53:22 PST
Forgotten to edit the bug title when I confirmed (sorry for not correcting it earlier).
Comment 21 Peter Gordon 2008-12-18 13:54:11 PST
The updated patch also fixes this issue on Fedora Rawhide. (Applied without change to today's nightly: SVN 39370.)
Comment 22 Bernhard Rosenkraenzer 2008-12-18 14:42:29 PST
Created attachment 26129 [details]
Updated patch - same as before plus changelog

Adding patch with ChangeLog entry, setting review to ?
Comment 23 Darin Adler 2008-12-18 14:49:26 PST
Comment on attachment 26129 [details]
Updated patch - same as before plus changelog

Obviously adding the semicolons is fine to do and harmless. I don't understand why you're adding LOWEST_PREC instead of just removing maybe_sgml.
Comment 24 Bernhard Rosenkraenzer 2008-12-18 14:54:35 PST
LOWEST_PREC was the idea of the bison guys:

http://www.mail-archive.com/bug-bison%40gnu.org/msg01270.html

It's there because they probably know their tool better than I do.
Comment 25 Bernhard Rosenkraenzer 2008-12-18 14:58:45 PST
LOWEST_PREC is actually necessary, doing the obvious thing and just removing maybe_sgml results in

perl /usr/src/ark/BUILD/WebKit/WebCore/css/makegrammar.pl ../../../WebCore/css/CSSGrammar.y tmp/CSSGrammar
../../../WebCore/css/CSSGrammar.y: conflicts: 106 shift/reduce, 6 reduce/reduce
../../../WebCore/css/CSSGrammar.y: expected 49 shift/reduce conflicts
../../../WebCore/css/CSSGrammar.y: expected 0 reduce/reduce conflicts
Died at /usr/src/ark/BUILD/WebKit/WebCore/css/makegrammar.pl line 35.
make[1]: *** [tmp/CSSGrammar.cpp] Error 2
Comment 26 Darin Adler 2009-01-02 11:09:25 PST
Comment on attachment 26129 [details]
Updated patch - same as before plus changelog

r=me
Comment 27 Alexey Proskuryakov 2009-01-11 01:36:40 PST
Committed revision 39786.