Bug#849150: patch proposal

Frédéric Bonnard frediz at linux.vnet.ibm.com
Tue Jul 11 11:24:02 UTC 2017


Tags: patch
User: debian-powerpc at lists.debian.org
Usertags: ppc64el 

--

Hi,
it just seems that there's too many space taken by different libraries
in the static TLS space. I contacted some people from the toolchain,
especially Alan Modra which seems to confirm that :
"If sagemath is dlopen'ing libraries, one of which is libgomp or has a
dependency on libgomp, and the sagemath executable itself does not load
libgomp at startup, then that would explain the error you're seeing."
Python binary has no direct dependency on libgomp :
$ lddtree /usr/bin/python2.7
python2.7 => /usr/bin/python2.7 (interpreter => /lib64/ld64.so.2)
    libpthread.so.0 => /lib/powerpc64le-linux-gnu/libpthread.so.0
        ld64.so.2 => /lib64/ld64.so.2
    libdl.so.2 => /lib/powerpc64le-linux-gnu/libdl.so.2
    libutil.so.1 => /lib/powerpc64le-linux-gnu/libutil.so.1
    libz.so.1 => /lib/powerpc64le-linux-gnu/libz.so.1
    libm.so.6 => /lib/powerpc64le-linux-gnu/libm.so.6
    libc.so.6 => /lib/powerpc64le-linux-gnu/libc.so.6

And also :
sagemath-7.6/sage# LD_DEBUG=files
PYTHONPATH=/build/sagemath-wDWVd1/sagemath-7.6/debian/build/usr/lib/python2.7/dist-packages
/build/sagemath-wDWVd1/sagemath-7.6/sage/src/bin/sage --docbuild
--no-pdf-links all html
...
     51918: file=/build/sagemath-wDWVd1/sagemath-7.6/debian/build/usr/lib/python2.7/dist-packages/sage/matrix/matrix_modn_dense_float.so [0];  dynamically loaded by python [0]
     51918: file=/build/sagemath-wDWVd1/sagemath-7.6/debian/build/usr/lib/python2.7/dist-packages/sage/matrix/matrix_modn_dense_float.so [0];  generating link map
     51918:   dynamic: 0x00003feecae0fb30  base: 0x00003feecad60000   size: 0x00000000000bf9c8
     51918:     entry: 0x00003feecad7c020  phdr: 0x00003feecad60040  phnum:                  7
     51918: 
     51918: 
     51918: file=liblinbox-1.4.2.so.0 [0];  needed by /build/sagemath-wDWVd1/sagemath-7.6/debian/build/usr/lib/python2.7/dist-packages/sage/matrix/matrix_modn_dense_float.so [0]
     51918: file=liblinbox-1.4.2.so.0 [0];  generating link map
     51918:   dynamic: 0x00003feecad4f518  base: 0x00003feecad00000   size: 0x00000000000513e0
     51918:     entry: 0x00003feecad14fc0  phdr: 0x00003feecad00040  phnum:                  7
     51918: 
     51918: 
     51918: file=liblinboxsage-1.4.2.so.0 [0];  needed by /build/sagemath-wDWVd1/sagemath-7.6/debian/build/usr/lib/python2.7/dist-packages/sage/matrix/matrix_modn_dense_float.so [0]
     51918: file=liblinboxsage-1.4.2.so.0 [0];  generating link map
     51918:   dynamic: 0x00003feecacec368  base: 0x00003feecaa70000   size: 0x0000000000280ed0
     51918:     entry: 0x00003feecab16880  phdr: 0x00003feecaa70040  phnum:                  7
     51918: 
     51918: 
     51918: file=libblas.so.3 [0];  needed by /build/sagemath-wDWVd1/sagemath-7.6/debian/build/usr/lib/python2.7/dist-packages/sage/matrix/matrix_modn_dense_float.so [0]
     51918: file=libblas.so.3 [0];  generating link map
     51918:   dynamic: 0x00003feecaa5f5d0  base: 0x00003feeca9e0000   size: 0x00000000000806e8
     51918:     entry: 0x00003feeca9ffd40  phdr: 0x00003feeca9e0040  phnum:                  6
     51918: 
     51918: 
     51918: file=liblapack.so.3 [0];  needed by /build/sagemath-wDWVd1/sagemath-7.6/debian/build/usr/lib/python2.7/dist-packages/sage/matrix/matrix_modn_dense_float.so [0]
     51918: file=liblapack.so.3 [0];  generating link map
     51918:   dynamic: 0x00003feeca9cfbd0  base: 0x00003feeca3f0000   size: 0x00000000005e4098
     51918:     entry: 0x00003feeca410100  phdr: 0x00003feeca3f0040  phnum:                  6
     51918: 
     51918: 
     51918: file=libgomp.so.1 [0];  needed by /usr/lib/powerpc64le-linux-gnu/liblinbox-1.4.2.so.0 [0]
     51918: file=libgomp.so.1 [0];  generating link map
     51918:   dynamic: 0x00003feeca3dfcc0  base: 0x00003feeca390000   size: 0x00000000000505b0
     51918:     entry: 0x00003feeca396bc0  phdr: 0x00003feeca390040  phnum:                  7
     51918: 
     51918: 
     51918: file=libopenblas.so.0 [0];  needed by /usr/lib/libblas.so.3 [0]
     51918: file=libopenblas.so.0 [0];  generating link map
     51918:   dynamic: 0x00003feeca36f2d0  base: 0x00003feec9960000   size: 0x0000000000a279e0
     51918:     entry: 0x00003feec99a88c0  phdr: 0x00003feec9960040  phnum:                  6
...
<error is just below>
...
So the failure occurs while importing the python module matrix_modn_dense_float.so.
So I propose to preload libgomp which looks good to Alan.

As Ximin explained, this workaround should not be applied on
documentation build only, as the import should trigger the error on the
CLI as well, thus I inserted LD_PRELOAD export in sage-env, for ppc64el
only. So here is a debdiff for you to review.
I hope that will help,

Thanks,

F.
-------------- next part --------------
diff -Nru sagemath-7.6/debian/adhoc/sage-env sagemath-7.6/debian/adhoc/sage-env
--- sagemath-7.6/debian/adhoc/sage-env	2017-01-25 15:28:45.000000000 +0000
+++ sagemath-7.6/debian/adhoc/sage-env	2017-05-08 13:31:50.000000000 +0000
@@ -68,6 +68,9 @@
 export EPYTHON=python2.7
 export MPMATH_NOGMPY=1
 export PATH="$PATH:$SAGE_SCRIPTS_DIR"
+if [ "$(dpkg-architecture -qDEB_HOST_ARCH)" = "ppc64el" ]; then
+	export LD_PRELOAD="libgomp.so.1"
+fi
 GP_DATA_DIR="/usr/share/pari" && export GP_DATA_DIR
 GPHELP="/usr/bin/gphelp" && export GPHELP
 GPDOCDIR="/usr/share/pari/doc" && export GPDOCDIR
diff -Nru sagemath-7.6/debian/patches/fix-doc-ppc64el-849150.patch sagemath-7.6/debian/patches/fix-doc-ppc64el-849150.patch
--- sagemath-7.6/debian/patches/fix-doc-ppc64el-849150.patch	1970-01-01 00:00:00.000000000 +0000
+++ sagemath-7.6/debian/patches/fix-doc-ppc64el-849150.patch	2017-05-08 13:31:50.000000000 +0000
@@ -0,0 +1,12 @@
+--- a/sage/src/bin/sage-env
++++ b/sage/src/bin/sage-env
+@@ -414,6 +414,9 @@
+ export LDFLAGS
+ LD_LIBRARY_PATH="$SAGE_LOCAL/lib:$LD_LIBRARY_PATH"
+ export LD_LIBRARY_PATH
++if [ "$(dpkg-architecture -qDEB_HOST_ARCH)" = "ppc64el" ]; then
++    export LD_PRELOAD="libgomp.so.1"
++fi
+ 
+ # Use a matplotlib config directory specific to Sage and specific to
+ # the version number of matplotlib, by setting the environment
diff -Nru sagemath-7.6/debian/patches/series sagemath-7.6/debian/patches/series
--- sagemath-7.6/debian/patches/series	2017-05-06 01:04:01.000000000 +0000
+++ sagemath-7.6/debian/patches/series	2017-05-08 13:31:50.000000000 +0000
@@ -72,3 +72,5 @@
 dt-more-fix-test-cases.patch
 dt-work-around-doc-common-conf.patch
 dt-undo-trac-21267-sagenb-interacts-for-jupyter.patch
+
+fix-doc-ppc64el-849150.patch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/debian-science-maintainers/attachments/20170711/d6e97dd8/attachment-0001.sig>


More information about the debian-science-maintainers mailing list