Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 685638 - dev-libs/libxslt-1.1.32 fails cross-compile due to using PYTHON_CFLAGS from python-config --cflags of build machine
Summary: dev-libs/libxslt-1.1.32 fails cross-compile due to using PYTHON_CFLAGS from p...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Cross compilation support
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2019-05-11 16:28 UTC by Joe Harvell
Modified: 2020-08-06 19:44 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
result of x86_64-pig-linux-gnu-emerge --info (einfo.host.txt,6.11 KB, text/plain)
2019-05-11 16:34 UTC, Joe Harvell
Details
result of emerge --info (einfo.build.txt,6.75 KB, text/plain)
2019-05-11 16:36 UTC, Joe Harvell
Details
build.log for the failed build (build.log,103.95 KB, text/plain)
2019-05-11 16:37 UTC, Joe Harvell
Details
tar/bzip2 of the entire temp directory for the failed build (portage-tmpdir.tar.bz2,36.35 KB, application/x-bzip)
2019-05-11 16:38 UTC, Joe Harvell
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joe Harvell 2019-05-11 16:28:07 UTC
I get the following error when using crossdev to build dev-libs/libxslt:

libtool: compile:  x86_64-pig-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I/mnt/striped_2/home/joey/cr
oss/pig/gentoo/portage-tmp/portage/dev-libs/libxslt-1.1.32/work/libxslt-1.1.32/python -I/mnt/
striped_2/home/joey/cross/pig/gentoo/portage-tmp/portage/dev-libs/libxslt-1.1.32/work/libxslt
-1.1.32-abi_x86_64.amd64 -I/mnt/striped_2/home/joey/cross/pig/gentoo/portage-tmp/portage/dev-
libs/libxslt-1.1.32/work/libxslt-1.1.32/libxslt -I/mnt/striped_2/home/joey/cross/pig/gentoo/p
ortage-tmp/portage/dev-libs/libxslt-1.1.32/work/libxslt-1.1.32 -I/mnt/striped_2/home/joey/cro
ss/pig/gentoo/portage-tmp/portage/dev-libs/libxslt-1.1.32/work/libxslt-1.1.32/libexslt -I/usr
/include/python2.7 -I/usr/include/python2.7 -fno-strict-aliasing -O3 -pipe -march=native -ggd
b -flto=10 -floop-interchange -ftree-loop-distribution -floop-strip-mine -floop-block -ftree-
vectorize -fwrapv -DNDEBUG -I/usr/x86_64-pig-linux-gnu/usr/include/libxml2 -O3 -pipe -march=b
onnell -ggdb -flto=10 -Wall -Wformat=2 -Wmissing-format-attribute -c /mnt/striped_2/home/joey
/cross/pig/gentoo/portage-tmp/portage/dev-libs/libxslt-1.1.32/work/libxslt-1.1.32/python/libx
slt.c  -fPIC -DPIC -o .libs/libxsltmod_la-libxslt.o
libxslt-py.c:1: sorry, unimplemented: Graphite loop optimizations cannot be used (isl is not available) (-fgraphite, -fgraphite-identity, -floop-nest-optimize, -floop-parallelize-all)
 /* Generated */

/mnt/striped_2/home/joey/cross/pig/gentoo/portage-tmp/portage/dev-libs/libxslt-1.1.32/work/libxslt-1.1.32/python/libxslt.c:1: sorry, unimplemented: Graphite loop optimizations cannot be used (isl is not available) (-fgraphite, -fgraphite-identity, -floop-nest-optimize, -floop-parallelize-all)
 /*


The direct reason for this error is that the toolchain compiler was built without graphite support.

This is caused by the following code in configure.ac which is from the Gentoo patch 1.1.32-simplify-python.patch:

AS_IF([test "$with_python" = "yes"],
      [AM_PATH_PYTHON
       AC_PATH_TOOL([PYTHON_CONFIG], [python$PYTHON_VERSION-config], [no])
       AS_IF([test "$PYTHON_CONFIG" = "no"],
             [AC_PATH_TOOL([PYTHON_CONFIG], [python-config], [no])])
       AS_IF([test "$PYTHON_CONFIG" != "no"],
             [PYTHON_CFLAGS=`$PYTHON_CONFIG --cflags`
              PYTHON_LDFLAGS=`$PYTHON_CONFIG --ldflags`
              PYTHON_LIBS=`$PYTHON_CONFIG --libs`],
             [AC_MSG_ERROR([Missing python development files.])])
       AC_MSG_CHECKING([libxml2 module in $PYTHON])
          LIBXML2_PYTHON=`$PYTHON -c "import sys;
try:
    import libxml2
    sys.stdout.write('1')
except:
    sys.stdout.write('0')"`
       AS_IF([test "$LIBXML2_PYTHON" = "1"],
             [AC_MSG_RESULT([yes])],
             [AC_MSG_RESULT([no])
              AC_MSG_WARN([libxml2 python module not found, expect runtime rrors])])
      ])

The graphite options come from the PYTHON_CFLAGS variable set using python-config --cflags from the build machine, which is incorrect.

In my case I am lucky that this results in a compile error, because this problem can result in a successful build with runtime errors.  In my case, python installed on the build machine includes -march=native, and CFLAGS for the cross-compile environment includes -march=bonnell.  If I had not built python on the build machine with graphite options, and if I had not included -march=bonnell in the cross-compile environment.  Then the end result could possibly have been a successful build with Ivy-Bridge instructions in libxslt that would result in an Illegal Instruction trap on the host.

It looks like this patch was written in the year 2001.  Is is possible that a python eclass now exists that sets up the proper PYTHON_CFLAGS, PYTHON_LDFLAGS, PYTHON_LIBS and LIBXML2_PYTHON environment variables?

By the way, in order to debug this, I hand edited one of the Makefiles and confirmed that the bad cflags are the result of the value of PYTHON_CFLAGS.  The logs I attach here do not include those edits.

I have worked around this issue by rebuilding my cross-compiler with graphite support.  I assume in my case that the -march=bonnell that follows -march=native nullifies the effect of -march=native.  But this is suboptimal because I do not want libxslt built with graphite optimizations.
Comment 1 Joe Harvell 2019-05-11 16:34:57 UTC
Created attachment 576040 [details]
result of x86_64-pig-linux-gnu-emerge --info

x86_64-pig-linux-gnu is the toolchain target I built with crossdev
Comment 2 Joe Harvell 2019-05-11 16:36:23 UTC
Created attachment 576044 [details]
result of emerge --info

This is emerge --info for the build machine.  It is not the environment that the failed build was executed in.  For that, see attachment file einfo.host.txt
Comment 3 Joe Harvell 2019-05-11 16:37:10 UTC
Created attachment 576046 [details]
build.log for the failed build
Comment 4 Joe Harvell 2019-05-11 16:38:27 UTC
Created attachment 576048 [details]
tar/bzip2 of the entire temp directory for the failed build
Comment 5 James Le Cuirot gentoo-dev 2019-05-11 19:51:47 UTC
You're going to have a bad time cross-compiling Python stuff in general until https://github.com/gentoo/gentoo/pull/9822 is merged but some heavy changes are needed before that will happen.

In this case, further changes may be needed but I wasn't able to check because libxml2[python] is needed and that also fails.
Comment 6 Larry the Git Cow gentoo-dev 2020-08-06 19:44:00 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bddd492d58c6e7af4937d79b8460a5da3a9f46de

commit bddd492d58c6e7af4937d79b8460a5da3a9f46de
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2020-08-05 05:00:14 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2020-08-06 19:43:51 +0000

    dev-libs/libxslt: drop Python (2.7 only) bindings
    
    Nothing requires libxslt's Python bindings,
    and they only exist for Python 2.7.
    
    Let's drop them instead, after discussion
    on IRC.
    
    Closes: https://bugs.gentoo.org/702346
    Closes: https://bugs.gentoo.org/685638
    Package-Manager: Portage-3.0.1, Repoman-2.3.23
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-libs/libxslt/libxslt-1.1.34-r1.ebuild | 63 +++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)