Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 557540 - dev-python/pypy-2.5.1 fails during install on amd64 (likely due to ncurses-6)
Summary: dev-python/pypy-2.5.1 fails during install on amd64 (likely due to ncurses-6)
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:
: 557894 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-08-14 11:35 UTC by Tobias Klausmann (RETIRED)
Modified: 2015-08-26 20:13 UTC (History)
3 users (show)

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


Attachments
pypy-2.5.1 build log (dev-python:pypy-2.5.1:20150814-102235.log,255.22 KB, text/plain)
2015-08-14 11:45 UTC, Tobias Klausmann (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Klausmann (RETIRED) gentoo-dev 2015-08-14 11:35:37 UTC
>>> Source compiled.
>>> Test phase [not enabled]: dev-python/pypy-2.5.1

>>> Install pypy-2.5.1 into /var/tmp/portage/dev-python/pypy-2.5.1/image/ category dev-python
 * Installing PyPy ...
 *      /var/tmp/portage/dev-python/pypy-2.5.1/image/usr/lib64/pypy/pypy-c
 *      /var/tmp/portage/dev-python/pypy-2.5.1/image/usr/lib64/pypy/libpypy-c.so
 TYPE    PAX   FILE 
ET_EXEC --mxe- /var/tmp/portage/dev-python/pypy-2.5.1/image/usr/lib64/pypy/pypy-c 
 TYPE    PAX   FILE 
ET_DYN --mxe- /var/tmp/portage/dev-python/pypy-2.5.1/image/usr/lib64/pypy/libpypy-c.so 
 * Generating caches and byte-compiling ...
/var/tmp/portage/dev-python/pypy-2.5.1/image/usr/lib64/pypy/lib_pypy/__pycache__/_cffi__g29b85a97xace1544d.c: In function ‘_cffi_f_mousemask’:
/var/tmp/portage/dev-python/pypy-2.5.1/image/usr/lib64/pypy/lib_pypy/__pycache__/_cffi__g29b85a97xace1544d.c:744:24: warning: passing argument 2 of ‘mousemask’ from incompatible pointer type
   return mousemask(x0, x1);
                        ^
In file included from /var/tmp/portage/dev-python/pypy-2.5.1/image/usr/lib64/pypy/lib_pypy/__pycache__/_cffi__g29b85a97xace1544d.c:60:0:
/usr/include/curses.h:1617:32: note: expected ‘mmask_t *’ but argument is of type ‘long unsigned int *’
 extern NCURSES_EXPORT(mmask_t) mousemask (mmask_t, mmask_t *);
                                ^
/var/tmp/portage/dev-python/pypy-2.5.1/image/usr/lib64/pypy/lib_pypy/__pycache__/_cffi__g29b85a97xace1544d.c: In function ‘_cffi_const_acs_map’:
/var/tmp/portage/dev-python/pypy-2.5.1/image/usr/lib64/pypy/lib_pypy/__pycache__/_cffi__g29b85a97xace1544d.c:1377:3: warning: return from incompatible pointer type
   return (acs_map);
   ^
Traceback (most recent call last):
  File "<builtin>/app_main.py", line 75, in run_toplevel
  File "<builtin>/app_main.py", line 588, in run_it
  File "<string>", line 1, in <module>
  File "/var/tmp/portage/dev-python/pypy-2.5.1/image/usr/lib64/pypy/lib_pypy/_curses.py", line 327, in <module>
    """, libraries=['ncurses', 'panel'])
  File "/var/tmp/portage/dev-python/pypy-2.5.1/image/usr/lib64/pypy/lib_pypy/cffi/api.py", line 367, in verify
    lib = self.verifier.load_library()
  File "/var/tmp/portage/dev-python/pypy-2.5.1/image/usr/lib64/pypy/lib_pypy/cffi/verifier.py", line 97, in load_library
    return self._load_library()
  File "/var/tmp/portage/dev-python/pypy-2.5.1/image/usr/lib64/pypy/lib_pypy/cffi/verifier.py", line 207, in _load_library
    return self._vengine.load_library()
  File "/var/tmp/portage/dev-python/pypy-2.5.1/image/usr/lib64/pypy/lib_pypy/cffi/vengine_gen.py", line 86, in load_library
    self._load(module, 'loaded', library=library)
  File "/var/tmp/portage/dev-python/pypy-2.5.1/image/usr/lib64/pypy/lib_pypy/cffi/vengine_gen.py", line 112, in _load
    method(tp, realname, module, **kwds)
  File "/var/tmp/portage/dev-python/pypy-2.5.1/image/usr/lib64/pypy/lib_pypy/cffi/vengine_gen.py", line 353, in _loaded_gen_anonymous
    self._loaded_struct_or_union(tp)
  File "/var/tmp/portage/dev-python/pypy-2.5.1/image/usr/lib64/pypy/lib_pypy/cffi/vengine_gen.py", line 318, in _loaded_struct_or_union
    check(layout[0], ffi.sizeof(BStruct), "wrong total size")
  File "/var/tmp/portage/dev-python/pypy-2.5.1/image/usr/lib64/pypy/lib_pypy/cffi/vengine_gen.py", line 314, in check
    % (msg, expectedvalue, realvalue))
VerificationError: anonymous MEVENT: wrong total size (we have 24, but C compiler says 20)
 * ERROR: dev-python/pypy-2.5.1::gentoo failed (install phase):
 *   Failed to import _curses (cffi)Portage 2.2.20.1 (python 2.7.10-final-0, default/linux/amd64/13.0, gcc-4.9.3, glibc-2.21-r1, 4.2.0-rc6 x86_64)
=================================================================
System uname: Linux-4.2.0-rc6-x86_64-Intel-R-_Core-TM-_i7-3770_CPU_@_3.40GHz-with-gentoo-2.2
KiB Mem:    32846580 total,   7275760 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Fri, 14 Aug 2015 07:45:01 +0000
sh bash 4.3_p39
ld GNU ld (Gentoo 2.25.1 p1.0) 2.25.1
app-shells/bash:          4.3_p39::gentoo
dev-lang/perl:            5.22.0::gentoo
dev-lang/python:          2.7.10::gentoo, 3.4.3::gentoo
dev-util/cmake:           3.3.0::gentoo
dev-util/pkgconfig:       0.28-r3::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.17::gentoo
sys-apps/sandbox:         2.6-r1::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r1::gentoo
sys-devel/automake:       1.11.6-r1::gentoo, 1.14.1::gentoo, 1.15::gentoo
sys-devel/binutils:       2.25.1::gentoo
sys-devel/gcc:            4.9.3::gentoo
sys-devel/gcc-config:     1.8::gentoo
sys-devel/libtool:        2.4.6-r1::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 4.1::gentoo (virtual/os-headers)
sys-libs/glibc:           2.21-r1::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync5.de.gentoo.org/gentoo-portage
    priority: -1000

local
    location: /usr/local/portage
    masters: gentoo
    priority: 0
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=corei7"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /etc/stunnel/stunnel.conf /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.6/ext-active/ /etc/php/cgi-php5.6/ext-active/ /etc/php/cli-php5.6/ext-active/ /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 -march=corei7"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms sign strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://ftp.snt.utwente.nl/pub/os/linux/gentoo http://gentoo.tiscali.nl/"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j6"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
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"
PORTAGE_TMPDIR="/var/tmp"
USE="acl acpi amd64 apache2 bash-completion bcmath berkdb bzip2 calendar caps clamav cli cracklib crypt cscope curl cxx dri ethereal exif fortran ftp gd gdbm gif gmp gnutls iconv idn imagemagick imap imlib ipv6 jabber jpeg kdeenablefinal libwww maildir mbox mmap mmx mmxext mng modules mp3 mpeg mpi multilib mysql mysqli ncurses nls nptl nptlonly ogg oggvorbis openmp pam pcre perl php png posix python readline recode sasl session sockets spell sse sse2 ssl svg tcpd truetype unicode vhosts vim vim-pager vim-syntax vorbis xattr xetex zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias reqtimeout slotmem_shm authn_core authz_core authz_dbd cache_disk ratelimit remoteip unixd socache_shmcb" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" DRACUT_MODULES="mdraid dash btrfs ssh-client ifcfg network net" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4 pypy pypy3" RUBY_TARGETS="ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="vga" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
USE_PYTHON="2.7 3.4"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

# equery  l ncurses
 * Searching for ncurses ...
[IP-] [  ] sys-libs/ncurses-6.0:5/6
#
Comment 1 Tobias Klausmann (RETIRED) gentoo-dev 2015-08-14 11:45:01 UTC
Created attachment 408978 [details]
pypy-2.5.1 build log
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2015-08-14 12:19:15 UTC
Well, you can't expect Python projects like cffi not to be braindead. 'm afraid this won't be fixed until upstream fixes it in hg, and we backport.
Comment 3 Marien Zwart (RETIRED) gentoo-dev 2015-08-15 05:31:50 UTC
I'm getting what's probably the same failure. This is especially interesting because this is a USE=-ncurses build (and pypy builds fine, the ebuild fails in "Generating caches and byte-compiling").

We fail doing:
	"${PYTHON}" -c "import _curses" || die "Failed to import _curses (cffi)"

This is a USE=-ncurses build, so I'm a bit puzzled this runs at all. But your build is USE=ncurses, so I'm guessing that doesn't matter.

MEVENT as defined in /usr/include/curses.h (from ncurses-6) is indeed size 20, not 24 (confirmed with a small test program). MEVENT from curses-5.9 is size 24 (mmask_t changed from "unsigned long" to "unsigned").

Ah, and looking at pypy's source tree, it calls cffi's cdef (in pypy-2.5.1-src/lib_pypy/_curses.py) with (among other things) "typedef unsigned long mmask_t;", which is now wrong. It still does this in the current source tree, although things have moved around a little (especially in commit c4c3a9d60c79).

Looking at the cffi docs, cffi should support "..." in the typedef to solve this exact problem (it causes it to defer to the compiler). But that requires some changes to how cffi is used, and might not be supported by the cffi in this version of pypy (haven't tried, but it's a bad sign that "typedef int..." does not occur in the source tree).

This code has also moved around a bit in the next pypy release, so I'm going to try that one rather than trying to fix this one. I don't think it'll actually work out of the box, but it's probably easier/saner to patch there.

It might make sense for Gentoo to patch the typedef in pypy-2.5.1 based on the version of curses we're linking against (ugly, but a better fix is *probably* not trivial, if I understand cffi correctly).
Comment 4 Marien Zwart (RETIRED) gentoo-dev 2015-08-15 05:44:22 UTC
Correction: pypy-2.6.0 should work. Upstream commit 2ac1dfd25d5b ("Use the new syntax "typedef int... foo_t" where appropriate") fixes this the way I expected, but it doesn't apply to pypy-2.5. I'm building it now to confirm.
Comment 5 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2015-08-15 05:46:40 UTC
(In reply to Marien Zwart from comment #3)
> I'm getting what's probably the same failure. This is especially interesting
> because this is a USE=-ncurses build (and pypy builds fine, the ebuild fails
> in "Generating caches and byte-compiling").
> 
> We fail doing:
> 	"${PYTHON}" -c "import _curses" || die "Failed to import _curses (cffi)"
> 
> This is a USE=-ncurses build, so I'm a bit puzzled this runs at all. But
> your build is USE=ncurses, so I'm guessing that doesn't matter.

Fixed USE=-ncurses not to gen curses. Also accidental USE=-gdbm gdbm gen in 2.6.0. Hope this doesn't break anything.

I've also forced ncurses:5/5 for now in the source ebuilds.

> MEVENT as defined in /usr/include/curses.h (from ncurses-6) is indeed size
> 20, not 24 (confirmed with a small test program). MEVENT from curses-5.9 is
> size 24 (mmask_t changed from "unsigned long" to "unsigned").
> 
> Ah, and looking at pypy's source tree, it calls cffi's cdef (in
> pypy-2.5.1-src/lib_pypy/_curses.py) with (among other things) "typedef
> unsigned long mmask_t;", which is now wrong. It still does this in the
> current source tree, although things have moved around a little (especially
> in commit c4c3a9d60c79).
> 
> Looking at the cffi docs, cffi should support "..." in the typedef to solve
> this exact problem (it causes it to defer to the compiler). But that
> requires some changes to how cffi is used, and might not be supported by the
> cffi in this version of pypy (haven't tried, but it's a bad sign that
> "typedef int..." does not occur in the source tree).
> 
> This code has also moved around a bit in the next pypy release, so I'm going
> to try that one rather than trying to fix this one. I don't think it'll
> actually work out of the box, but it's probably easier/saner to patch there.
> 
> It might make sense for Gentoo to patch the typedef in pypy-2.5.1 based on
> the version of curses we're linking against (ugly, but a better fix is
> *probably* not trivial, if I understand cffi correctly).

I'm afraid fixing just one obvious issue isn't going to fix ABI compatibility completely. And certainly I'm not the one who will writing that patch.
Comment 6 Marien Zwart (RETIRED) gentoo-dev 2015-08-15 06:41:41 UTC
Confirmed 2.6 works. Also more or less confirmed the correct fix (the "..." feature I mentioned) requires cffi support introduced in pypy-2.6. I believe making this work in 2.6 would be quite ugly.

I'd recommend either having older pypy depend on old curses (like you did), or applying an unconditional patch to pypy to use the new typedef and depend on new curses. Hopefully pypy-2.6 can be unleashed upon the world not too long from now, which fixes this properly.
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2015-08-15 07:07:25 UTC
Thanks for confirming it. I'm going to revert the dep change in 2.6.0 and unmask it now.
Comment 8 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2015-08-15 07:12:32 UTC
commit 60f4e6436345685d70cbb30fd4790337c4e2e659
Author: Michał Górny <mgorny@gentoo.org>
Date:   Sat Aug 15 09:11:10 2015 +0200

    profiles: Unmask dev-python/pypy-2.6.0
    
    The new version was p.masked long enough, and it is required for
    sys-libs/ncurses upgrade.

commit 2fd64a3588cc4436392871c0001d13f5e7eb0d77
Author: Michał Górny <mgorny@gentoo.org>
Date:   Sat Aug 15 09:10:46 2015 +0200

    dev-python/pypy-2.6.0: restore more flex ncurses dep, confirmed working
    
    Allow the newer sys-libs/ncurses version as it has been confirmed to
    work with pypy-2.6.0.
    
    Bug: https://bugs.gentoo.org/show_bug.cgi?id=557540#c6
    
    Package-Manager: portage-2.2.20
Comment 9 Alexandre Rostovtsev (RETIRED) gentoo-dev 2015-08-26 20:13:23 UTC
*** Bug 557894 has been marked as a duplicate of this bug. ***