Bug 47248 - autogen missing dependency on flex and bison, causes infinite loop in glsl build
Summary: autogen missing dependency on flex and bison, causes infinite loop in glsl build
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Other (show other bugs)
Version: git
Hardware: All All
: medium normal
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2012-03-12 12:04 UTC by Darxus
Modified: 2013-01-29 23:04 UTC (History)
5 users (show)

See Also:
i915 platform:
i915 features:


Attachments
patch (826 bytes, patch)
2012-03-13 20:15 UTC, Matt Turner
Details | Splinter Review
patch to fix lex detection (451 bytes, patch)
2012-09-10 03:41 UTC, Matt Turner
Details | Splinter Review
patch (706 bytes, patch)
2013-01-29 19:09 UTC, Matt Turner
Details | Splinter Review

Description Darxus 2012-03-12 12:04:52 UTC
Last good commit:

commit 4ff8fd93e8e91672bb02543ecaa0c6e462a87551
Author: Matt Turner <mattst88@gmail.com>
Date:   Sat Jan 28 20:13:51 2012 -0500

    glsl: rename Makefile.sources' _SOURCES variables
    
    automake uses variables named *_SOURCES.
    
    Reviewed-by: Eric Anholt <eric@anholt.net>
    Tested-by: Eric Anholt <eric@anholt.net>
    Signed-off-by: Matt Turner <mattst88@gmail.com>

First bad commit:

commit dfb6142548df0dccbe6eed2c57986e208eb0d437
Author: Matt Turner <mattst88@gmail.com>
Date:   Fri Jan 13 14:31:39 2012 -0500

    autoconf: use AC_PROG_YACC/LEX
    
    Needed for automake. Using AC_PROG_PATH(bison/flex) causes automake to
    fail to build .y and .l files.
    
    It is up to the builder to use bison/flex instead of yacc/lex.
    
    Reviewed-by: Eric Anholt <eric@anholt.net>
    Tested-by: Eric Anholt <eric@anholt.net>
    Signed-off-by: Matt Turner <mattst88@gmail.com>


Without flex installed, autogen.sh should end with:

checking for flex... no
configure: error: flex is needed to build Mesa

Similar for bison.

Currently, it doesn't.  

I feel like this is only one of two problems here, the second being that if autogen misses the absence of flex, there is no error when the build tries to use it for glsl.  

At least when missing bison, it throws a useful error: 
/bin/bash: yacc: command not found


This is similar to bug 36651.

Latest commit, also has this problem:  
commit 5ac910c0146ca852566ad0328301b2d40f8f5e54
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Sun Mar 11 23:38:36 2012 -0700
Comment 1 Matt Turner 2012-03-13 20:15:23 UTC
Created attachment 58416 [details] [review]
patch
Comment 2 Joel 2012-03-23 18:07:31 UTC
Good catch! I tested the patch against current master and it worked well in detecting a missing flex. (I also run into the very confusing Makefile infinite loop before)

Also worth noting that with the patch, it's still possible to build the i965 driver fine without having bison installed.
Comment 3 Kenneth Graunke 2012-03-24 18:33:03 UTC
It -shouldn't- be possible...the GLSL compiler makes use of Bison-specific features...
Comment 4 Joel 2012-03-26 11:07:59 UTC
Thanks Kenneth, you're right.
I had hit a bug where `make distclean` wasn't removing the old bison-generated files. This might explain why my last two bisects went bad.
Comment 5 Matt Turner 2012-08-24 23:35:06 UTC
I committed a patch that fixes the case when we don't need bison (eg, we have the generated files provided in the tarball and therefore don't need bison)

http://cgit.freedesktop.org/mesa/mesa/commit/?id=ba4a36d8cdd6425c1263026e953cc3977d1192c6

As such, I'm marking this fixed.
Comment 6 Behdad Esfahbod 2012-09-09 23:31:09 UTC
The check for lex seems to be missing.  I didn't have it installed and got weird errors from ylwrap.
Comment 7 Matt Turner 2012-09-10 00:12:26 UTC
(In reply to comment #6)
> The check for lex seems to be missing.  I didn't have it installed and got
> weird errors from ylwrap.

I didn't think it would be needed, but seems it is. I'll make a patch.
Comment 8 Behdad Esfahbod 2012-09-10 02:15:09 UTC
Thanks.  While at it, glsl also seems to require a C++ compiler but configure doesn't check for it.  I didn't have g++ installed and hit it mid-make.
Comment 9 Matt Turner 2012-09-10 03:36:38 UTC
configure.ac most certainly uses AC_PROG_CXX, which checks for a C++ compiler. There should be no problem there.
Comment 10 Matt Turner 2012-09-10 03:41:28 UTC
Created attachment 66899 [details] [review]
patch to fix lex detection

How about this?
Comment 11 Behdad Esfahbod 2012-09-10 03:56:34 UTC
Thanks.  I'll check both issues tomorrow night.
Comment 12 Simos Xenitellis 2012-10-14 16:27:02 UTC
(In reply to comment #11)
> Thanks.  I'll check both issues tomorrow night.

I think these changes have not been pushed yet to master.

I got an error while compiling Mesa from git. Autogen correctly did not find flex or lex, but did not complain. Then, compilation failed with no informative information (no infinite loop).
Comment 13 Simos Xenitellis 2012-10-14 16:40:03 UTC
I am re-opening this report.
Comment 15 Lauri Kasanen 2013-01-29 18:47:25 UTC
The commit 2a71054396 and its parent (for Bison) break configure for me.

checking if bison is the parser generator... yes
./configure: line 19532: syntax error near unexpected token `fi'
./configure: line 19532: `fi'

Indeed the else-fi sections are empty, which makes bash unhappy.

My autoconf is 2.61, if that is too old, please mark the required version so that autogen bails early.
Comment 16 Matt Turner 2013-01-29 19:09:33 UTC
Created attachment 73866 [details] [review]
patch

(In reply to comment #15)
> The commit 2a71054396 and its parent (for Bison) break configure for me.
> 
> checking if bison is the parser generator... yes
> ./configure: line 19532: syntax error near unexpected token `fi'
> ./configure: line 19532: `fi'
> 
> Indeed the else-fi sections are empty, which makes bash unhappy.
> 
> My autoconf is 2.61, if that is too old, please mark the required version so
> that autogen bails early.

I don't think that's it. It looks like I'm missing a comma between the test and run-if-true in AS_IF.
Comment 17 Matt Turner 2013-01-29 23:04:56 UTC
Pushed to master and 9.1.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.