[PATCH] fix wine make -j2 error, maybe?

Dan Kegel dank at kegel.com
Sat Dec 14 20:07:21 CST 2002


I'm getting ready to use distcc to build wine.  distcc likes you
to use 'make -jN', where N is something like the number of build
machines in the pool.  Sadly, wine's make -j2 doesn't seem reliable,
at least with gnu make 3.79.1 from debian 3.0 on my single-cpu
system.  (Works fine on my SMP system, go figure.)
Here's the first error I run into:

...
bison -y  -d -t ./parser.y
conflicts:  2 shift/reduce
flex -Cf  -d -8 ./parser.l
gcc -c -I. -I. -I../../include -I../../include  -g -O2 -Wall -mpreferred-stack-boundary=2  \
  -D__WINE__ -DINCLUDEDIR="\"/usr/local/include/wine\"" -D_REENTRANT -o lex.yy.o lex.yy.c
gcc -c -I. -I. -I../../include -I../../include  -g -O2 -Wall -mpreferred-stack-boundary=2  \
  -D__WINE__ -DINCLUDEDIR="\"/usr/local/include/wine\"" -D_REENTRANT -o y.tab.o y.tab.c
./parser.l:168: `tACCELERATORS' undeclared here (not in a function)
...
./parser.l:568: `tNL' undeclared (first use in this function)
make[2]: *** [lex.yy.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory `/home/dank/live/wine/tools/wrc'

This is fairly repeatable; just cd to wine/tools/wrc, and
do 'make clean; make -j2' a couple times.

The trouble appears to have been that lex.yy.c includes y.tab.h,
but y.tab.h didn't [fully?] exist yet.

Doing
  'make -d -j2' | grep 'token for'
shows

Obtained token for child 0x0807a6a8 (genres.o).
Released token for child 0x08078630 (dumpres.o).
Obtained token for child 0x0807ac50 (newstruc.o).
Released token for child 0x0807ac50 (newstruc.o).
Obtained token for child 0x0807c310 (readres.o).
Released token for child 0x0807a6a8 (genres.o).
Obtained token for child 0x0807c640 (utils.o).
Released token for child 0x0807c310 (readres.o).
Obtained token for child 0x0807d330 (wrc.o).
Released token for child 0x0807c640 (utils.o).
Obtained token for child 0x0807c2b0 (writeres.o).
Released token for child 0x0807d330 (wrc.o).
Obtained token for child 0x0807e230 (y.tab.c).
Released token for child 0x0807c2b0 (writeres.o).
Obtained token for child 0x0807e598 (lex.yy.c).
Released token for child 0x0807e598 (lex.yy.c).
Obtained token for child 0x0807c2e0 (lex.yy.o).
Released token for child 0x0807e230 (y.tab.c).
Obtained token for child 0x0807d9d8 (y.tab.o).
Released token for child 0x0807c2e0 (lex.yy.o).

Hah.  Notice how make "obtains the token" for lex.yy.o
before it "releases the token" for y.tab.c.  Maybe that
means it jumped the gun on compiling lex.yy.o.

It looks like Make figured lex.yy.o needed y.tab.c but
not y.tab.h, kinda, even though the dependency is there in the Makefile.
Sure enough, replacing
    lex.yy.o: y.tab.h
with
    lex.yy.o: y.tab.h y.tab.c
gets rid of the problem.

I dunno if this is a bug in make, or what, but the workaround is
easy.  Patch attached.  Same thing probably needs to be done in tools/widl.

If people think this is a reasonable patch, I'll submit
it for real.  Comments, anyone?

Thanks,
Dan

Index: tools/wrc/Makefile.in
===================================================================
RCS file: /home/wine/wine/tools/wrc/Makefile.in,v
retrieving revision 1.21
diff -u -u -r1.21 Makefile.in
--- tools/wrc/Makefile.in	10 Aug 2002 00:03:08 -0000	1.21
+++ tools/wrc/Makefile.in	14 Dec 2002 23:57:32 -0000
@@ -39,7 +39,8 @@
  @LEX_OUTPUT_ROOT at .c: parser.l
  	$(LEX) $(LEXOPT) -d -8 $(SRCDIR)/parser.l

- at LEX_OUTPUT_ROOT@.o: y.tab.h
+# extra dependency on y.tab.c to work around problem in 'make -j2'
+ at LEX_OUTPUT_ROOT@.o: y.tab.h y.tab.c

  clean::
  	$(RM) parser.output parser.tab.h lex.backup y.output
-------------- next part --------------
Index: tools/wrc/Makefile.in
===================================================================
RCS file: /home/wine/wine/tools/wrc/Makefile.in,v
retrieving revision 1.21
diff -u -u -r1.21 Makefile.in
--- tools/wrc/Makefile.in	10 Aug 2002 00:03:08 -0000	1.21
+++ tools/wrc/Makefile.in	14 Dec 2002 23:57:32 -0000
@@ -39,7 +39,8 @@
 @LEX_OUTPUT_ROOT at .c: parser.l
 	$(LEX) $(LEXOPT) -d -8 $(SRCDIR)/parser.l
 
- at LEX_OUTPUT_ROOT@.o: y.tab.h
+# extra dependency on y.tab.c to work around problem in 'make -j2'
+ at LEX_OUTPUT_ROOT@.o: y.tab.h y.tab.c
 
 clean::
 	$(RM) parser.output parser.tab.h lex.backup y.output


More information about the wine-devel mailing list