Bug 56685

Summary: [recent build error] glsl_parser.h: No such file or directory
Product: Mesa Reporter: Fabio Pedretti <pedretti.fabio>
Component: OtherAssignee: mesa-dev
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: medium CC: thierry.reding
Version: git   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Possible fix
Possible Fix

Description Fabio Pedretti 2012-11-02 16:17:32 UTC
bug #56664 is fixed but there is this now:

  CXX    glsl_lexer.o
glsl_lexer.ll:29:25: fatal error: glsl_parser.h: No such file or directory
compilation terminated.

Full build log:
https://launchpadlibrarian.net/121875124/buildlog_ubuntu-quantal-i386.mesa_9.1~git1211021701.ebf0a9~gd~q_FAILEDTOBUILD.txt.gz
Comment 1 Johannes Obermayr 2012-11-03 12:45:38 UTC
Please try this patch:
http://lists.freedesktop.org/archives/mesa-dev/2012-November/029511.html
Comment 2 Fabio Pedretti 2012-11-03 14:03:09 UTC
Still same error with the patch:
  CXX    glsl_lexer.o
glsl_lexer.ll:29:25: fatal error: glsl_parser.h: No such file or directory
compilation terminated.

https://launchpadlibrarian.net/121932664/buildlog_ubuntu-quantal-i386.mesa_9.1~git1211031452.84b437~gd~q_FAILEDTOBUILD.txt.gz
Comment 3 Johannes Obermayr 2012-11-03 16:12:52 UTC
Created attachment 69491 [details] [review]
Possible fix

Please try this patch.
Comment 4 Fabio Pedretti 2012-11-07 13:39:45 UTC
> Created attachment 69491 [details] [review] [review]
> Please try this patch.

I am still getting the same error:
https://launchpadlibrarian.net/122265792/buildlog_ubuntu-quantal-i386.mesa_9.1~git1211071345.65faed~gd~q_FAILEDTOBUILD.txt.gz
Comment 5 Johannes Obermayr 2012-11-07 18:58:07 UTC
Created attachment 69667 [details] [review]
Possible Fix

Next try ...
Comment 6 Matt Turner 2012-11-07 22:04:00 UTC
Thierry, I think your cross compiling patch caused this -- broken out of tree builds.
Comment 7 Thierry Reding 2012-11-08 07:12:41 UTC
Comment on attachment 69667 [details] [review]
Possible Fix

Review of attachment 69667 [details] [review]:
-----------------------------------------------------------------

I came up with a very similar, though simpler patch that I've successfully
tested on top of latest master, both in-tree and out-of-tree as well as
parallel and non-parallel builds.

With the below comments applied, Johannes' patch becomes effectively the
same as mine.

::: src/glsl/builtin_compiler/Makefile.am
@@ +29,4 @@
>  LD = @LD_FOR_BUILD@
>  LDFLAGS = @LDFLAGS_FOR_BUILD@
>  
> +include ../Makefile.sources

You don't need to move the Makefile.sources include
because GLSL_SRCDIR, GLSL_BUILDDIR and AM_CFLAGS
are all lazily evaluated.

Don't forget to remove the corresponding comment in
the commit message.

@@ +36,5 @@
>  	-I $(top_srcdir)/src/mapi \
>  	-I $(top_srcdir)/src/mesa \
>  	-I $(GLSL_SRCDIR) \
>  	-I $(GLSL_SRCDIR)/glcpp \
> +	-I $(GLSL_BUILDDIR) \

Can we please sort this above GLSL_SRCDIR so that
files in GLSL_BUILDDIR will take precedence?
Comment 8 Thierry Reding 2012-11-08 07:20:01 UTC
(In reply to comment #6)
> Thierry, I think your cross compiling patch caused this -- broken out of
> tree builds.

I suppose that had to happen to me, usually being very allergic to broken
out-of-tree builds. Maybe Mesa hasn't supported out-of-tree builds for so
long it didn't occur to me that it may have changed. Needless to say I'm
very happy that it works now.

Thanks a bunch for putting all this work into it Matt (and everyone else
who helped)!
Comment 9 Fabio Pedretti 2012-11-08 16:55:10 UTC
(In reply to comment #5)
> Created attachment 69667 [details] [review] [review]
> Possible Fix
> 
> Next try ...

With this I can successfully compile mesa.
Comment 10 Matt Turner 2012-11-10 00:55:36 UTC
I pushed a patch from bug 56787, since it fixed the problem the right way.

*** This bug has been marked as a duplicate of bug 56787 ***
Comment 11 Thierry Reding 2012-11-10 09:04:34 UTC
(In reply to comment #10)
> I pushed a patch from bug 56787, since it fixed the problem the right way.
> 
> *** This bug has been marked as a duplicate of bug 56787 ***

As I've said in my review of the patch in this bug, the GLSL_BUILDDIR should
be moved before the GLSL_SRCDIR in the include path to make sure the generated
files take precedence.
Comment 12 Matt Turner 2012-11-10 10:04:51 UTC
How could glsl_parser.h exist in both src and build directories?
Comment 13 Thierry Reding 2012-11-20 19:55:48 UTC
(In reply to comment #12)
> How could glsl_parser.h exist in both src and build directories?

There could be any number of reasons. The most likely would be if somebody's
built in-tree, so glsl_parser.h gets generated in the source tree, and then
decides to build out-of-tree. Granted, a proper build system would detect and
prevent that, but I'm not sure we're there yet.

There's also always the possibility of somebody just copying it there.

But my point was that it usually is a sensible decision to prefer the contents
of the build tree over those of the source tree. I've seen lots of packages
that were broken in some subtle way and would specifically generate files in
the build tree, but then go and reuse the one that shipped in the source tree.

Such bugs can be very hard to find and they usually aren't obvious from the
start, so if there's an easy way to avoid them I think we should do so.

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.