Skip to contentSkip to conversation

python-{native}-2.6.5: Fix parallel build.

PATCH Superseded Paul Menzel 3 participants 3 messages Oct 2, 2010 – Oct 3, 2010

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 python-{native}-2.6.5: Fix parallel build.

Date: Sat, 2 Oct 2010 12:51:03 +0200

Randomly the build failed for me with the following error message.

libpython2.6.so: undefined reference to `_PyParser_Grammar'

The applied patch in [5] tried to fix this problem, but it turns out that this was due to a possible race and already known in OpenOffice too [3].

R. David Murray (dmalcolm) <[email protected]> fixed this in Fedora [1] and I applied his patch.

I reported this issue upstream [4] and this will only be fixed in Python 2.7, so we have to keep this patch for Python 2.6.

[1] http://pkgs.fedoraproject.org/gitweb/?p=python.git;a=commitdiff;h=b95f6cc2ca6a009f97436c6aa16cfd70547353d9
[2] http://www.openoffice.org/issues/show_bug.cgi?id=114866
[3] http://doc.services.openoffice.org/wiki/RedTinderboxStatusInEIS
[4] http://bugs.python.org/issue10013
[5] http://patchwork.openembedded.org/patch/1899/

---
 .../python/python-2.6.5/20-fix-parallel-make.patch |   40 ++++++++++++++++++++
 recipes/python/python-native_2.6.5.bb              |    2 +-
 recipes/python/python_2.6.5.bb                     |    5 +-
 3 files changed, 44 insertions(+), 3 deletions(-)
 create mode 100644 recipes/python/python-2.6.5/20-fix-parallel-make.patch
recipes/python/python-2.6.5/20-fix-parallel-make.patch new file +40 -0
new file mode 100644
index 0000000..1f7b24e
@@ -0,0 +1,40 @@
+upstream: <http://bugs.python.org/issue10013>
+comment: As in the comment in the issue tracker this is fixed for py3k a little differently <http://svn.python.org/view?view=rev&revision=84068>. This patch is taken from Fedora.
+
+diff -up Python-2.7/Makefile.pre.in.fix-parallel-make Python-2.7/Makefile.pre.in
+--- Python-2.7/Makefile.pre.in.fix-parallel-make	2010-07-22 15:01:39.567996932 -0400
++++ Python-2.7/Makefile.pre.in	2010-07-22 15:47:02.437998509 -0400
+@@ -198,6 +198,7 @@ SIGNAL_OBJS=	@SIGNAL_OBJS@
+ 
+ ##########################################################################
+ # Grammar
++GRAMMAR_STAMP=	$(srcdir)/grammar-stamp
+ GRAMMAR_H=	$(srcdir)/Include/graminit.h
+ GRAMMAR_C=	$(srcdir)/Python/graminit.c
+ GRAMMAR_INPUT=	$(srcdir)/Grammar/Grammar
+@@ -515,10 +516,24 @@ Modules/getpath.o: $(srcdir)/Modules/get
+ Modules/python.o: $(srcdir)/Modules/python.c
+ 	$(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
+ 
++# GNU "make" interprets rules with two dependents as two copies of the rule.
++# 
++# In a parallel build this can lead to pgen being run twice, once for each of
++# GRAMMAR_H and GRAMMAR_C, leading to race conditions in which the compiler
++# reads a partially-overwritten copy of one of these files, leading to syntax
++# errors (or linker errors if the fragment happens to be syntactically valid C)
++#
++# See http://www.gnu.org/software/hello/manual/automake/Multiple-Outputs.html
++# for more information.
++#
++# Introduce ".grammar-stamp" as a contrived single output from PGEN to avoid
++# this:
++$(GRAMMAR_H) $(GRAMMAR_C): $(GRAMMAR_STAMP)
+ 
+-$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
++$(GRAMMAR_STAMP): $(PGEN) $(GRAMMAR_INPUT)
+ 		-@$(INSTALL) -d Include
+ 		-$(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
++		touch $(GRAMMAR_STAMP)
+ 
+ $(PGEN):	$(PGENOBJS)
+ 		$(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
recipes/python/python-native_2.6.5.bb +1 -1
index 76fbbb6..12c2252 100644
@@ -11,11 +11,11 @@ SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.bz2 \
            file://10-distutils-fix-swig-parameter.patch \
            file://11-distutils-never-modify-shebang-line.patch \
            file://12-distutils-prefix-is-inside-staging-area.patch \
+           file://20-fix-parallel-make.patch
            file://debug.patch \
            file://nohostlibs.patch"
 SRC_URI[md5sum] = "6bef0417e71a1a1737ccf5750420fdb3"
 SRC_URI[sha256sum] = "62da62eb685621ede2be1275f11b89fa0e0be578db8daa5320d0a7855c0a9ebc"
-
 S = "${WORKDIR}/Python-${PV}"
 
 inherit native
recipes/python/python_2.6.5.bb +3 -2
index ecd9f78..2c26512 100644
@@ -3,7 +3,7 @@ DEPENDS = "python-native db gdbm openssl readline sqlite3 tcl zlib\
            ${@base_contains('DISTRO_FEATURES', 'tk', 'tk', '', d)}"
 DEPENDS_sharprom = "python-native db readline zlib gdbm openssl"
 # set to .0 on every increase of INC_PR
-PR = "${INC_PR}.0"
+PR = "${INC_PR}.1"
 
 SRC_URI = "\
   http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.bz2 \
@@ -14,8 +14,9 @@ SRC_URI = "\
   file://04-default-is-optimized.patch \
   file://05-enable-ctypes-cross-build.patch \
   file://06-ctypes-libffi-fix-configure.patch \
+  file://20-fix-parallel-make.patch \
   file://99-ignore-optimization-flag.patch \
-  file://sitecustomize.py \
+  file://sitecustomize.py
 "
 SRC_URI[md5sum] = "6bef0417e71a1a1737ccf5750420fdb3"
 SRC_URI[sha256sum] = "62da62eb685621ede2be1275f11b89fa0e0be578db8daa5320d0a7855c0a9ebc"
Signature · 1 line
1.7.1
#1 lore raw
Quoted 12 lines · Paul Menzel

Date: Sat, 2 Oct 2010 12:51:03 +0200

Randomly the build failed for me with the following error message.

   libpython2.6.so: undefined reference to `_PyParser_Grammar'

The applied patch in [5] tried to fix this problem, but it turns out that this was due to a possible race and already known in OpenOffice too [3].

R. David Murray (dmalcolm) <[email protected]> fixed this in Fedora [1] and I applied his patch.

I reported this issue upstream [4] and this will only be fixed in Python 2.7, so we have to keep this patch for Python 2.6.

Quoted 7 lines

[1] http://pkgs.fedoraproject.org/gitweb/?p=python.git;a=commitdiff;h=b95f6cc2ca6a009f97436c6aa16cfd70547353d9
[2] http://www.openoffice.org/issues/show_bug.cgi?id=114866
[3] http://doc.services.openoffice.org/wiki/RedTinderboxStatusInEIS
[4] http://bugs.python.org/issue10013
[5] http://patchwork.openembedded.org/patch/1899/

looks ok see small comments below

Quoted 58 lines

---
 .../python/python-2.6.5/20-fix-parallel-make.patch |   40 ++++++++++++++++++++ recipes/python/python-native_2.6.5.bb              |    2 +- recipes/python/python_2.6.5.bb                     |    5 +-

 3 files changed, 44 insertions(+), 3 deletions(-)

 create mode 100644 recipes/python/python-2.6.5/20-fix-parallel-make.patch

recipes/python/python-2.6.5/20-fix-parallel-make.patch new file +40 -0
new file mode 100644
index 0000000..1f7b24e
@@ -0,0 +1,40 @@
+upstream: <http://bugs.python.org/issue10013>
+comment: As in the comment in the issue tracker this is fixed for py3k a little differently <http://svn.python.org/view?view=rev&revision=84068>. This patch is taken from Fedora.
+
+diff -up Python-2.7/Makefile.pre.in.fix-parallel-make Python-2.7/Makefile.pre.in
+--- Python-2.7/Makefile.pre.in.fix-parallel-make       2010-07-22 15:01:39.567996932 -0400
++++ Python-2.7/Makefile.pre.in 2010-07-22 15:47:02.437998509 -0400
+@@ -198,6 +198,7 @@ SIGNAL_OBJS=       @SIGNAL_OBJS@
+
+ ##########################################################################
+ # Grammar
++GRAMMAR_STAMP=        $(srcdir)/grammar-stamp
+ GRAMMAR_H=    $(srcdir)/Include/graminit.h
+ GRAMMAR_C=    $(srcdir)/Python/graminit.c
+ GRAMMAR_INPUT=        $(srcdir)/Grammar/Grammar
+@@ -515,10 +516,24 @@ Modules/getpath.o: $(srcdir)/Modules/get
+ Modules/python.o: $(srcdir)/Modules/python.c
+       $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
+
++# GNU "make" interprets rules with two dependents as two copies of the rule.
++#
++# In a parallel build this can lead to pgen being run twice, once for each of
++# GRAMMAR_H and GRAMMAR_C, leading to race conditions in which the compiler
++# reads a partially-overwritten copy of one of these files, leading to syntax
++# errors (or linker errors if the fragment happens to be syntactically valid C)
++#
++# See http://www.gnu.org/software/hello/manual/automake/Multiple-Outputs.html
++# for more information.
++#
++# Introduce ".grammar-stamp" as a contrived single output from PGEN to avoid
++# this:
++$(GRAMMAR_H) $(GRAMMAR_C): $(GRAMMAR_STAMP)
+
+-$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
++$(GRAMMAR_STAMP): $(PGEN) $(GRAMMAR_INPUT)
+               -@$(INSTALL) -d Include
+               -$(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
++              touch $(GRAMMAR_STAMP)
+
+ $(PGEN):      $(PGENOBJS)
+               $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
recipes/python/python-native_2.6.5.bb +0 -0
index 76fbbb6..12c2252 100644

recipes/python/python-native_2.6.5.bb SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.bz2 \ · line 14

Quoted 4 lines
recipes/python/python-native_2.6.5.bb +1 -0
@@ -11,11 +11,11 @@ SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.bz2 \
            file://10-distutils-fix-swig-parameter.patch \
            file://11-distutils-never-modify-shebang-line.patch \
            file://12-distutils-prefix-is-inside-staging-area.patch \
+           file://20-fix-parallel-make.patch

Did you forget a '\' here ?

Quoted 22 lines
recipes/python/python-native_2.6.5.bb +0 -0
            file://debug.patch \

           file://nohostlibs.patch"
 SRC_URI[md5sum] = "6bef0417e71a1a1737ccf5750420fdb3"
 SRC_URI[sha256sum] = "62da62eb685621ede2be1275f11b89fa0e0be578db8daa5320d0a7855c0a9ebc" -
 S = "${WORKDIR}/Python-${PV}"

 inherit native

recipes/python/python_2.6.5.bb +0 -0
index ecd9f78..2c26512 100644
@@ -3,7 +3,7 @@ DEPENDS = "python-native db gdbm openssl readline sqlite3 tcl zlib\

           ${@base_contains('DISTRO_FEATURES', 'tk', 'tk', '', d)}" DEPENDS_sharprom = "python-native db readline zlib gdbm openssl"

 # set to .0 on every increase of INC_PR
recipes/python/python_2.6.5.bb +1 -1
-PR = "${INC_PR}.0"
+PR = "${INC_PR}.1"

 SRC_URI = "\
  http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.bz2 \

recipes/python/python_2.6.5.bb SRC_URI = "\ · line 19

Quoted 7 lines
recipes/python/python_2.6.5.bb +2 -1
@@ -14,8 +14,9 @@ SRC_URI = "\
   file://04-default-is-optimized.patch \
   file://05-enable-ctypes-cross-build.patch \
   file://06-ctypes-libffi-fix-configure.patch \
+  file://20-fix-parallel-make.patch \
   file://99-ignore-optimization-flag.patch \
-  file://sitecustomize.py \
+  file://sitecustomize.py

you forget '\' here too

Quoted 13 lines

 "
 SRC_URI[md5sum] = "6bef0417e71a1a1737ccf5750420fdb3"
 SRC_URI[sha256sum] = "62da62eb685621ede2be1275f11b89fa0e0be578db8daa5320d0a7855c0a9ebc" --
1.7.1

_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel

#2 lore raw
In reply to Paul Menzel
Quoted 12 lines · Paul Menzel

Date: Sat, 2 Oct 2010 12:51:03 +0200

Randomly the build failed for me with the following error message.

libpython2.6.so: undefined reference to `_PyParser_Grammar'

The applied patch in [5] tried to fix this problem, but it turns out that this was due to a possible race and already known in OpenOffice too [3].

R. David Murray (dmalcolm) <[email protected]> fixed this in Fedora [1] and I applied his patch.

I reported this issue upstream [4] and this will only be fixed in Python 2.7, so we have to keep this patch for Python 2.6.

Quoted 7 lines

[1] http://pkgs.fedoraproject.org/gitweb/?p=python.git;a=commitdiff;h=b95f6cc2ca6a009f97436c6aa16cfd70547353d9
[2] http://www.openoffice.org/issues/show_bug.cgi?id=114866
[3] http://doc.services.openoffice.org/wiki/RedTinderboxStatusInEIS
[4] http://bugs.python.org/issue10013
[5] http://patchwork.openembedded.org/patch/1899/

Aside from what Khem said, thanks for tracking this one down!

Signature · 2 lines
Tom Rini
Mentor Graphics Corporation