Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 864911 - dev-lang/python: fails to cross-compile for aarch64_be-unknown-linux-gnu (AssertionError: SRE module mismatch, generate-posix-vars failed)
Summary: dev-lang/python: fails to cross-compile for aarch64_be-unknown-linux-gnu (Ass...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2022-08-11 14:18 UTC by Sam James
Modified: 2022-12-06 19:39 UTC (History)
0 users

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


Attachments
build.log (file_864911.txt,101.02 KB, text/plain)
2022-08-11 14:18 UTC, Sam James
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-08-11 14:18:49 UTC
Created attachment 799305 [details]
build.log

aarch64_be-unknown-linux-gnu-gcc   -Wl,-O1 -Wl,--as-needed  -Xlinker -export-dynamic -o Programs/_testembed Programs/_testembed.o -L. -lpython3.10 -ldl  -lpthread -lm   -lm
_PYTHON_PROJECT_BASE=/usr/aarch64_be-unknown-linux-gnu/tmp/portage/dev-lang/python-3.10.6_p2/work/Python-3.10.6 _PYTHON_HOST_PLATFORM=linux-aarch64_be PYTHONPATH=./Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata__linux_aarch64_be-linux-gnu python -S -m sysconfig --generate-posix-vars ;\
if test $? -ne 0 ; then \
        echo "generate-posix-vars failed" ; \
        rm -f ./pybuilddir.txt ; \
        exit 1 ; \
fi
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/aarch64_be-unknown-linux-gnu/tmp/portage/dev-lang/python-3.10.6_p2/work/Python-3.10.6/Lib/sysconfig.py", line 803, in <module>
    _main()
  File "/usr/aarch64_be-unknown-linux-gnu/tmp/portage/dev-lang/python-3.10.6_p2/work/Python-3.10.6/Lib/sysconfig.py", line 791, in _main
    _generate_posix_vars()
  File "/usr/aarch64_be-unknown-linux-gnu/tmp/portage/dev-lang/python-3.10.6_p2/work/Python-3.10.6/Lib/sysconfig.py", line 412, in _generate_posix_vars
    import pprint
  File "/usr/aarch64_be-unknown-linux-gnu/tmp/portage/dev-lang/python-3.10.6_p2/work/Python-3.10.6/Lib/pprint.py", line 38, in <module>
    import dataclasses as _dataclasses
  File "/usr/aarch64_be-unknown-linux-gnu/tmp/portage/dev-lang/python-3.10.6_p2/work/Python-3.10.6/Lib/dataclasses.py", line 1, in <module>
    import re
  File "/usr/aarch64_be-unknown-linux-gnu/tmp/portage/dev-lang/python-3.10.6_p2/work/Python-3.10.6/Lib/re.py", line 125, in <module>
    import sre_compile
  File "/usr/aarch64_be-unknown-linux-gnu/tmp/portage/dev-lang/python-3.10.6_p2/work/Python-3.10.6/Lib/sre_compile.py", line 17, in <module>
    assert _sre.MAGIC == MAGIC, "SRE module mismatch"
AssertionError: SRE module mismatch
generate-posix-vars failed
make: *** [Makefile:614: pybuilddir.txt] Error 1
 * ERROR: dev-lang/python-3.10.6_p2::gentoo failed (compile phase):
 *   emake failed

----

# aarch64_be-unknown-linux-gnu-emerge --info
Portage 3.0.34 (python 3.11.0-candidate-1, default/linux/arm64/17.0/big-endian, gcc-12.1.1, glibc-2.35-r8, 5.15.58-gentoo-dist-hardened x86_64)
=================================================================
System uname: Linux-5.15.58-gentoo-dist-hardened-x86_64-AMD_Ryzen_9_3950X_16-Core_Processor-with-glibc2.36
KiB Mem:    65765032 total,  16791004 free
KiB Swap:    8290300 total,   4164860 free
Timestamp of repository gentoo: Thu, 11 Aug 2022 12:32:17 +0000
sh dash 0.5.11.5
ld GNU ld (Gentoo 2.38 p4) 2.38
ccache version 4.6.1 [disabled]
app-shells/bash:           5.1_p16-r1::gentoo
sys-apps/baselayout:       2.8-r2::gentoo
sys-devel/binutils:        2.38-r2::gentoo
sys-devel/binutils-config: 5.4.1::gentoo
sys-devel/gcc-config:      2.5-r1::gentoo
sys-devel/make:            4.3::gentoo
sys-kernel/linux-headers:  5.19::gentoo (virtual/os-headers)
sys-libs/glibc:            2.35-r8::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-extra-opts:
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-metamanifest: yes

ACCEPT_KEYWORDS="arm64 ~arm64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -fomit-frame-pointer"
CHOST="aarch64_be-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -pipe -fomit-frame-pointer"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news nodoc noinfo noman parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_GB.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
PKGDIR="/usr/aarch64_be-unknown-linux-gnu/cache/binpkgs/"
PORTAGE_CONFIGROOT="/usr/aarch64_be-unknown-linux-gnu/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/usr/aarch64_be-unknown-linux-gnu/tmp/"
SHELL="/bin/bash"
USE="acl arm64 big-endian bzip2 cli crypt dri fortran gdbm iconv ipv6 libglvnd libtirpc ncurses nls nptl openmp pam pcre readline seccomp split-usr ssl unicode xattr zlib" ADA_TARGET="gnat_2020" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_ARM="edsp thumb thumb2 v4 v5 v6 v7 v8 vfp vfp-d32 vfpv3 vfpv4" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_10" RUBY_TARGETS="ruby27" USERLAND="GNU" VIDEO_CARDS="fbdev dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LEX, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, MAKEOPTS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-08-11 14:21:15 UTC
>_PYTHON_PROJECT_BASE=/usr/aarch64_be-unknown-linux-gnu/tmp/portage/dev-lang/python-3.10.6_p2/work/Python-3.10.6 _PYTHON_HOST_PLATFORM=linux-aarch64_be PYTHONPATH=./Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata__linux_aarch64_be-linux-gnu python -S -m sysconfig --generate-posix-vars ;\

Note that it's calling 'python'. 'python' here for me is Python 3.11.

Now, if I do EPYTHON=python3.10 aarch64_be-unknown-linux-gnu-emerge -v1 dev-lang/python:3.10, it works!

So, we need a CBUILD Python which is the same version, apparently. Or at least not newer, but I'm guessing we actually do need the same version?

(Note that we've already implemented this logic for Python 3.11.)
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-08-11 14:28:05 UTC
We can set PYTHON_FOR_BUILD.
Comment 4 Larry the Git Cow gentoo-dev 2022-10-11 17:53:44 UTC
The bug has been closed via the following commit(s):

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

commit 29d2314810bd8e1de73df5c3ebe30c826281c253
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-10-11 14:18:03 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-10-11 17:53:26 +0000

    dev-lang/python: build CBUILD Python for cross in older versions
    
    See bug 864911 for details.
    
    Bug: https://bugs.gentoo.org/847910
    Closes: https://bugs.gentoo.org/864911
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-lang/python/python-3.10.7.ebuild | 45 ++++++++++++++++++++++++++++++++++++
 dev-lang/python/python-3.8.14.ebuild | 45 ++++++++++++++++++++++++++++++++++++
 dev-lang/python/python-3.9.14.ebuild | 45 ++++++++++++++++++++++++++++++++++++
 3 files changed, 135 insertions(+)
Comment 5 Larry the Git Cow gentoo-dev 2022-12-06 19:39:18 UTC
The bug has been referenced in the following commit(s):

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

commit 3478cabb5f94e9d90ae1ed9e3f7909a1146aa471
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-12-06 19:35:41 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-12-06 19:38:51 +0000

    dev-lang/python: disable _ctypes, _crypt for cross (CBUILD) Python
    
    * Use a hack to deduce libdir to nudge the build system in the right
      direction because get_libdir can't handle BROOT/CBUILD right now.
    
    * Disable _ctypes (libffi) and _crypt (lib(x)crypt) modules for cross (CBUILD)
      Python as they're not needed and Python struggles to find the libraries
      correctly.
    
      This avoids an issue where setup.py can't handle deducing libdir
      (or even being passed it) for cross-compilation. Fortunately, cpython
      is migrating away from setup.py to autotools.
    
    Note that this isn't the same as what bug 633712 would've been at the time
    it was reported, but it certainly showed up the same way on more modern
    Pythons since we introduced the CBUILD part a few months ago.
    
    Bug: https://bugs.gentoo.org/633712
    Bug: https://bugs.gentoo.org/794181
    Bug: https://bugs.gentoo.org/864911
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-lang/python/python-3.10.8_p3.ebuild     | 13 +++++++++++--
 dev-lang/python/python-3.11.0_p2.ebuild     | 13 +++++++++++--
 dev-lang/python/python-3.12.0_alpha2.ebuild | 13 +++++++++++--
 dev-lang/python/python-3.8.15_p3.ebuild     | 13 +++++++++++--
 dev-lang/python/python-3.9.15_p3.ebuild     | 13 +++++++++++--
 5 files changed, 55 insertions(+), 10 deletions(-)