Bug 93989 - build: flex-2.5.39 seems to be failing for glsl_lexer.ll
Summary: build: flex-2.5.39 seems to be failing for glsl_lexer.ll
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: glsl-compiler (show other bugs)
Version: git
Hardware: Other Linux (All)
: medium major
Assignee: Matt Turner
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-03 15:37 UTC by Jan Ziak (http://atom-symbol.net)
Modified: 2016-02-04 17:31 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Jan Ziak (http://atom-symbol.net) 2016-02-03 15:37:47 UTC
Build system: gentoo
Failing flex version: 2.5.39
Good flex version: 2.6.0

Possible explanation 1: The configuration script should be checking for version >= 2.6.0
Possible explanation 2: Invalid directory

Log:

make[2]: Entering directory '/var/tmp/portage/media-libs/mesa-9999/work/mesa-9999-abi_x86_64.amd64/src/compiler'
bison  -o glsl/glsl_parser.cpp -p "_mesa_glsl_" --defines=./glsl/glsl_parser.h /var/tmp/portage/media-libs/mesa-9999/work/mesa-9999/src/compiler/glsl/glsl_parser.yy
flex  -o glsl/glsl_lexer.cpp /var/tmp/portage/media-libs/mesa-9999/work/mesa-9999/src/compiler/glsl/glsl_lexer.ll
/bin/mkdir -p glsl/glcpp
/bin/mkdir -p glsl/glcpp
flex: could not create glsl/glsl_lexer.cpp
Makefile:2903: recipe for target 'glsl/glsl_lexer.cpp' failed
Comment 1 Matt Turner 2016-02-03 19:25:32 UTC
Hello, fellow Gentoo user. Gentoo developer here!

I'm using the latest stable flex, =sys-devel/flex-2.5.39-r1, and it worked for me.

My build log looked like:

   bison  -o glsl/glsl_parser.cpp ...
   flex  -o glsl/glsl_lexer.cpp ...
   /bin/mkdir -p glsl/glcpp
   /bin/mkdir -p glsl/glcpp
   /bin/mkdir -p nir
   bison  -o glsl/glcpp/glcpp-parse.c ...
   /bin/mkdir -p nir
   flex  -o glsl/glcpp/glcpp-lex.c ...

The problem is a race condition between the mkdir commands and flex. Recently there was a code reorganization. The problem is that the rules for glsl/glsl_parser.cpp and glsl/glsl_lexer.cpp now need to call mkdir, whereas they did not before.

Indeed, if I build with make -j1 I can reproduce the problem. I suppose it's possible that there's a change in flex-2.5.39-r1 -> flex-2.6.0 that makes it create directories if they don't exist, but I think it's more plausible that the problem is simply a race condition and that it's not related to the version of flex. In fact, when I build with make -j1, it's bison (2.7.1) that fails.

I will send a patch, and Cc you. Thanks for the report (and thank you for filing it upstream)!
Comment 2 Thomas Rohloff 2016-02-04 08:47:30 UTC
(In reply to Matt Turner from comment #1)
> but I think it's more plausible that
> the problem is simply a race condition and that it's not related to the
> version of flex.

I can confirm this. For me updating flex to 2.6.0 doesn't fix this.

> I will send a patch, and Cc you. Thanks for the report (and thank you for
> filing it upstream)!

Could you please Cc me, too?
Comment 3 Matt Turner 2016-02-04 17:31:42 UTC
Patch is now upstream as

commit 973ba3f4d4b73f67568ab2b0b6a4447c40bb9dcf
Author: Matt Turner <mattst88@gmail.com>
Date:   Wed Feb 3 12:03:13 2016 -0800

    glsl: Ensure glsl/ exists before making the lexer/parser.


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.