Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 600888 - python3 modules use host libraries when cross-compiling
Summary: python3 modules use host libraries when cross-compiling
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-26 09:06 UTC by Stuart Longland
Modified: 2016-11-28 16:02 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stuart Longland 2016-11-26 09:06:16 UTC
Seems the relevant build infrastructure for Python modules gets confused between the system libraries and the cross-compiled library environment when one tries to cross-build python modules.

I noticed cross-building Python 3.4.5 for mips64el-unknown-linux-gnu, it'd try to #include my host's ncurses in /usr/include instead of the one in /usr/mips64el-unknown-linux-gnu/include.

pyxattr is one such module that exhibits this; and sadly, is needed for portage.

/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: skipping incompatible /usr/lib64/libc.so when searching for -lc
/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: skipping incompatible /usr/lib64/libc.a when searching for -lc
 * python3_4: running distutils-r1_run_phase distutils-r1_python_compile
/usr/bin/python3.4 setup.py build
running build
running build_ext
building 'xattr' extension
creating /usr/mips64el-unknown-linux-gnu/tmp/portage/dev-python/pyxattr-0.5.5/work/pyxattr-0.5.5-python3_4/temp.linux-x86_6
4-3.4
mips64el-unknown-linux-gnu-gcc -O2 -pipe -fomit-frame-pointer -Wa,-mfix-loongson2f-nop -Wa,-mfix-loongson2f-jump -fPIC -D_X
ATTR_VERSION="0.5.5" -D_XATTR_AUTHOR="Iustin Pop" -D_XATTR_EMAIL="iustin@k1024.org" -I/usr/include/python3.4 -c xattr.c -o 
/usr/mips64el-unknown-linux-gnu/tmp/portage/dev-python/pyxattr-0.5.5/work/pyxattr-0.5.5-python3_4/temp.linux-x86_64-3.4/xat
tr.o -Wall
cc1: warning: include location "/usr/include/python3.4" is unsafe for cross-compilation [-Wpoison-system-directories]
mips64el-unknown-linux-gnu-gcc -shared -Wl,-O1 -Wl,--as-needed -O2 -pipe -fomit-frame-pointer -Wa,-mfix-loongson2f-nop -Wa,
-mfix-loongson2f-jump /usr/mips64el-unknown-linux-gnu/tmp/portage/dev-python/pyxattr-0.5.5/work/pyxattr-0.5.5-python3_4/tem
p.linux-x86_64-3.4/xattr.o -L/usr/lib64 -lattr -lpython3.4 -o /usr/mips64el-unknown-linux-gnu/tmp/portage/dev-python/pyxatt
r-0.5.5/work/pyxattr-0.5.5-python3_4/lib/xattr.cpython-34.so
/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: skipping incompatible /usr/lib64/libattr.so when searching for -lattr
/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: skipping incompatible /usr/lib64/libpython3.4.so when searching for -lpython3.4
/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: skipping incompatible /usr/lib64/libpython3.4.a when searching for -lpython3.4
/usr/libexec/gcc/mips64el-unknown-linux-gnu/ld: cannot find -lpython3.4
collect2: error: ld returned 1 exit status
error: command 'mips64el-unknown-linux-gnu-gcc' failed with exit status 1
 * ERROR: dev-python/pyxattr-0.5.5::gentoo failed (compile phase):

Seems fine with the Python 2.7 build, but 3.4 seems to get confused in this manner.

Steps to reproduce:
1. emerge =crossdev-20151026
2. crossdev -s4 -A n64 --b 2.25.1 --without-headers mips64el-unknown-linux-gnu # binutils 2.27 pulls in binutils-libs, and glibc won't pick up ABI if you don't specify --without-headers
3. Set up /usr/mips64el-unknown-linux-gnu/etc/portage; I set the profile to default/linux/mips/13.0/mipsel/n64/desktop and tweaked CFLAGS to include Loongson2F workarounds.
4. mips64el-unknown-linux-gnu-emerge --keep-going --load-average 12.0 -j6 -1av @system

You might see other failures, but that is the one that is giving me pain at present.
Comment 1 Mike Gilbert gentoo-dev 2016-11-28 16:02:23 UTC
AFAIK, Python doesn't really support cross-compiling modules; it sometimes works by accident.

In this case, it should be linking against libpython3.4m, not libpython3.4.

You probably have an older version of python:3.4 installed on the host that is performing this build. Please upgrade that to python-3.4.5 and try again.