I currently have python-2.6.2-r1 installed, which built cleanly. Unmodified, the latest python fails with: >>> Emerging (1 of 1) dev-lang/python-2.6.2-r01.4 * python-gentoo-patches-2.6.2-r4.tar.bz2 RMD160 SHA1 SHA256 size ;-) ... [ ok ] * Python-2.6.2.tar.bz2 RMD160 SHA1 SHA256 size ;-) ... [ ok ] * checking ebuild checksums ;-) ... [ ok ] * checking auxfile checksums ;-) ... [ ok ] * checking miscfile checksums ;-) ... [ ok ] >>> Unpacking source... >>> Unpacking python-gentoo-patches-2.6.2-r4.tar.bz2 to /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.2-r01.4/work >>> Unpacking Python-2.6.2.tar.bz2 to /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.2-r01.4/work >>> Source unpacked in /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.2-r01.4/work >>> Preparing source in /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.2-r01.4/work/Python-2.6.2 ... * Applying various patches (bugfixes/updates) ... * 02_all_db4.patch ... [ ok ] * 04_all_disable_modules_and_ssl.patch ... [ ok ] * 05_all_mimetypes_gentoo_apache.patch ... [ ok ] * 06_all_add_portage_search_path.patch ... [ ok ] * 07_all_libdir.patch ... [ ok ] * 09_all_turkish.patch ... [ ok ] * 11_all_svnversion.patch ... [ ok ] * 12_all_distutils-rpath-gcc.patch ... [ ok ] * 13_all_static_library_location.patch ... [ ok ] * 15_all_dbm_default_gdbm_compat.patch ... [ ok ] * 16_all_non-zero_exit_status_on_failure.patch ... [ ok ] * 17_all_disable_multiprocessing_with_disabled_threads.patch ... [ ok ] * 18_all_distutils-cxxflags.patch ... [ ok ] * 22_all_internal-expat.patch ... [ ok ] * 23_all_arm_OABI.patch ... [ ok ] * Done with patching * Applying python-2.5.1-no-usrlocal.patch ... [ ok ] * Applying python-2.6.2-readline-prefix.patch ... * Failed Patch: python-2.6.2-readline-prefix.patch ! * ( /usr/opt/gentoo/usr/portage/dev-lang/python/files/python-2.6.2-readline-prefix.patch ) * * Include in your bugreport the contents of: * * /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.2-r01.4/temp/python-2.6.2-readline-prefix.patch-52728002.out * ERROR: dev-lang/python-2.6.2-r01.4 failed: * Failed Patch: python-2.6.2-readline-prefix.patch! * * Call stack: * ebuild.sh: 51: <call call-ebuildshell 'src_prepare'> * environment: 795: <call src_prepare> * environment:4330: <call epatch '/usr/opt/gentoo/usr/portage/dev-lang/python/files/python-2.6.2-readline-prefix.patch'> * environment:2087: die "Failed Patch: ${patchname}!"; The first few lines of the output from patch are: ***** python-2.6.2-readline-prefix.patch ***** ============================================== PATCH COMMAND: patch -p0 -g0 -E --no-backup-if-mismatch < /usr/opt/gentoo/usr/portage/dev-lang/python/files/python-2.6.2-readline-prefix.patch ============================================== patching file setup.py Hunk #1 succeeded at 572 (offset 16 lines). Hunk #2 FAILED at 584. 1 out of 2 hunks FAILED -- saving rejects to file setup.py.rej ... which appears to be because the on-disk setup.py contains the following: elif self.compiler.find_library_file(lib_dirs, 'curses'): readline_libs.append('curses') elif self.compiler.find_library_file(lib_dirs + ['/usr/lib32/termcap'], 'termcap'): readline_libs.append('termcap') exts.append( Extension('readline', ['readline.c'], library_dirs=['/usr/lib32/termcap'], extra_link_args=readline_extra_link_args, libraries=readline_libs) ) ... whereas the patch contains: readline_libs.append('curses') - elif self.compiler.find_library_file(lib_dirs + - ['/usr/lib/termcap'], + elif self.compiler.find_library_file(lib_dirs, 'termcap'): readline_libs.append('termcap') exts.append( Extension('readline', ['readline.c'], - library_dirs=['/usr/lib/termcap'], + library_dirs=[], extra_link_args=readline_extra_link_args, libraries=readline_libs) ) ... note "lib" vs. "lib32".
I hacked a fix by making three copies (well, two and a symlink) of the patch file with different suffix, and then altering the ebuild to contain: use prefix && epatch "${FILESDIR}"/${P}-readline-prefix-$(get_libdir).patch ... although finding where setup.py is generated and fixing it there would be much more sensible :) I'd dig deeper in order to fix this, but I can't get Python to build *with* this fix right now. I'm erroring out at: " Failed to find the necessary bits to build these modules: bsddb185 linuxaudiodev ossaudiodev sunaudiodev To find the necessary bits, look in setup.py in detect_modules() for the module's name. Failed to build these modules: _ctypes running build_scripts creating build/scripts-2.6 copying and adjusting /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.2-r01.4/work/Python-2.6.2/Tools/scripts/pydoc -> build/scripts-2.6 copying and adjusting /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.2-r01.4/work/Python-2.6.2/Tools/scripts/idle -> build/scripts-2.6 copying and adjusting /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.2-r01.4/work/Python-2.6.2/Tools/scripts/2to3 -> build/scripts-2.6 copying and adjusting /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.2-r01.4/work/Python-2.6.2/Lib/smtpd.py -> build/scripts-2.6 changing mode of build/scripts-2.6/pydoc from 644 to 755 changing mode of build/scripts-2.6/idle from 644 to 755 changing mode of build/scripts-2.6/2to3 from 644 to 755 changing mode of build/scripts-2.6/smtpd.py from 644 to 755 make: *** [sharedmods] Error 1 * ERROR: dev-lang/python-2.6.2-r01.4 failed: * emake failed * * Call stack: * ebuild.sh: 51: <call call-ebuildshell 'src_compile'> * environment: 810: <call src_compile> * environment:4171: <call _eapi2_src_compile> * ebuild.sh: 700: emake || die "emake failed" " ... which I'm sure I've encountered (and fixed?) previously, but I can't remember what the fix (if any) was.
Created attachment 205207 [details, diff] Patch resolve all IRIX build issues, including ctypes assembly Great news - with help from http://forums.nekochan.net/viewtopic.php?f=15&t=16721730 I now have a patch which seems to fix all of the outstanding build issues on IRIX :) (Python segfaults when completing the test-suite, but seems fine in general use. This may always have been the way). ebuild changes: --- python-2.6.2-r01.4.ebuild +++ python-2.6.2-r01.4.ebuild @@ -86,7 +86,7 @@ use prefix && epatch "${FILESDIR}"/${PN}-2.5.1-no-usrlocal.patch use prefix && epatch "${FILESDIR}"/${P}-use-first-bsddb-found.patch - epatch "${FILESDIR}"/${P}-readline-prefix.patch + use prefix && epatch "${FILESDIR}"/${P}-readline-prefix-$(get_libdir).patch # build static for mint [[ ${CHOST} == *-mint* ]] && epatch "${FILESDIR}"/${P}-mint.patch @@ -121,7 +121,7 @@ # grep anyway epatch "${FILESDIR}"/${PN}-2.5.1-no-hardcoded-grep.patch # make it compile on IRIX as well - epatch "${FILESDIR}"/${P}-irix.patch + epatch "${FILESDIR}"/${PN}-2.6.2-irix.patch # and generate a libpython2.6.so epatch "${FILESDIR}"/${PN}-2.6-irix-libpython2.6.patch # AIX sometimes keeps ".nfsXXX" files around: ignore them in distutils @@ -495,6 +495,5 @@ pkg_postrm() { eselect python update --ignore 3.0 --ignore 3.1 --ignore 3.2 - python_mod_cleanup /usr/lib/python${PYVER} - [[ "$(get_libdir)" != "lib" ]] && python_mod_cleanup /usr/$(get_libdir)/python${PYVER} + python_mod_cleanup /usr/$(get_libdir)/python${PYVER} }
Created attachment 205208 [details, diff] Patch resolve all IRIX build issues, including ctypes assembly (with corrected attribution)
Hmm - hold on. With dev-libs/libffi-3.0.8 installed, python links against $(get-libdir)/libffi.so.6. The problem here is that libffi.so includes an external symbol 'ffi_call', which causes python to fail with: *** WARNING: renaming "_ctypes" since importing it failed: 2873271:./python: rld: Fatal Error: unresolvable symbol in build/lib.irix64-6.5-2.6/_ctypes.so: ffi_call Failed to find the necessary bits to build these modules: bsddb185 linuxaudiodev ossaudiodev sunaudiodev To find the necessary bits, look in setup.py in detect_modules() for the module's name. Failed to build these modules: _ctypes running build_scripts creating build/scripts-2.6 copying and adjusting /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.2-r2/work/Python-2.6.2/Tools/scripts/pydoc -> build/scripts-2.6 copying and adjusting /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.2-r2/work/Python-2.6.2/Tools/scripts/idle -> build/scripts-2.6 copying and adjusting /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.2-r2/work/Python-2.6.2/Tools/scripts/2to3 -> build/scripts-2.6 copying and adjusting /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.2-r2/work/Python-2.6.2/Lib/smtpd.py -> build/scripts-2.6 changing mode of build/scripts-2.6/pydoc from 644 to 755 changing mode of build/scripts-2.6/idle from 644 to 755 changing mode of build/scripts-2.6/2to3 from 644 to 755 changing mode of build/scripts-2.6/smtpd.py from 644 to 755 make: *** [sharedmods] Error 1 (the 'sharedmods' error seeming to occur whenever _ctypes isn't available in this release of python)
(Alternatively, it occurs to me, Python may be ignoring libffi entirely and the error occurs because the internal implementation happens to be the same version as the external one - and some other change to my build-system has stopped it from working... I'm open to suggestions?)
Not of much help, merely FYI: as python-2.6.2-r2 now removes the local copy of libffi before patching, the irix patch failed to apply. I've copied this to irix-noffi.patch and dropped all libffi things.
(In reply to comment #6) > Not of much help, merely FYI: as python-2.6.2-r2 now removes the local copy of > libffi before patching, the irix patch failed to apply. > I've copied this to irix-noffi.patch and dropped all libffi things. > Hmm - there's something up here. So far as I can tell, the python-2.6.2-r01.4 libffi is the same version as the current libffi - and the same patches apply to both. However, python-2.6.2-r01.4 compiles successfully on IRIX (including _ctypes) whereas python-2.6.2-r2 with external libffi fails because the ffi library has undefined symbols (such as ffi_call). For now, could we get python-2.6.2-r2 (and later) using the built-in libffi implementation (which does appear to work) whilst the problems with the external ffi library are resolved?
fine with me, although it remains strange that external libffi doesn't build the symbols, could it be a python-local change in the sources perhaps?
TODO: report this libffi issue to libffi upstream, because ideally we want libffi to be extern from python.
Created attachment 212014 [details, diff] Patch resolve all IRIX build issues, including ctypes assembly (with corrected attribution) External libffi now builds and can be linked against successfully (as of libffi-3.0.9_rc3) and so the IRIX patch is significantly shorter. To revert the ebuild to remove (now obsolete) IRIX-specific changes: --- python-2.6.4.ebuild.irix +++ python-2.6.4.ebuild @@ -23,7 +23,7 @@ LICENSE="PSF-2.2" SLOT="2.6" -KEYWORDS="~ppc-aix ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +KEYWORDS="~mips-irix ~ppc-aix ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" IUSE="aqua -berkdb build doc elibc_uclibc examples gdbm ipv6 +ncurses +readline sqlite ssl +threads tk ucs2 wininst +xml" # NOTE: dev-python/{elementtree,celementtree,pysqlite,ctypes} @@ -31,7 +31,7 @@ RDEPEND=">=app-admin/eselect-python-20090606 >=sys-libs/zlib-1.1.3 - !m68k-mint? ( !mips-irix? ( virtual/libffi ) ) + !m68k-mint? ( virtual/libffi ) virtual/libintl !build? ( berkdb? ( || ( @@ -75,8 +75,7 @@ src_prepare() { # Ensure that internal copies of expat and libffi aren't used. - rm -fr Modules/expat - use mips-irix || rm -fr Modules/_ctypes/libffi* + rm -fr Modules/expat Modules/_ctypes/libffi* if tc-is-cross-compiler; then epatch "${FILESDIR}/python-2.5-cross-printf.patch" @@ -152,8 +151,8 @@ # at least IRIX starts spitting out ugly errors, but we want to use Prefix # grep anyway epatch "${FILESDIR}"/${PN}-2.5.1-no-hardcoded-grep.patch - # make it compile on IRIX as well (depends on internal libffi) - use mips-irix && epatch "${FILESDIR}"/${PN}-2.6.4-irix-ffi.patch + # make it compile on IRIX as well + epatch "${FILESDIR}"/${PN}-2.6.4-irix.patch # and generate a libpython2.6.so epatch "${FILESDIR}"/${PN}-2.6-irix-libpython2.6.patch # AIX sometimes keeps ".nfsXXX" files around: ignore them in distutils @@ -249,7 +248,7 @@ Makefile.pre.in || die "sed failed" fi - # Export CXX so it ends up in /usr/lib/python2.X/config/Makefile. + # Export CXX so it ends up in /usr/$(get_libdir)/python2.X/config/Makefile. tc-export CXX # Set LDFLAGS so we link modules with -lpython2.6 correctly. @@ -286,7 +285,7 @@ --infodir='${prefix}'/share/info \ --mandir='${prefix}'/share/man \ --with-libc='' \ - $(use_with !mips-irix system-ffi) \ + --with-system-ffi \ ${myconf} }
ok, added this, thanks!