Out of the box, python-2.6 will not compile successfully on IRIX. With some of the changes from Bug 260143 and other changes, python will at least now build. However, ffi support (and therefore _ctypes) is still broken - the bild process for this module stops with: cc -OPT:Olimit=0 -DNDEBUG -c99 -O2 -n32 -mips4 -r14000 -float_const -use_readonly_const -TARG:isa=mips4:platform=ip30:processor=r14000 -TENV:zeroinit_in_bss=ON -OPT:fast_io=ON:Olimit=8192:reorg_common=ON:swp=ON -LNO:auto_dist=ON:fusion_peeling_limit=8:gather_scatter=2 -diag_error 1035 -woff 1174,1183,1185,1552,3968,3970 -I. -I/usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/./Include -Ibuild/temp.irix64-6.5-2.6/libffi/include -Ibuild/temp.irix64-6.5-2.6/libffi -I/usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Modules/_ctypes/libffi/src -I. -IInclude -I./Include -I/opt/gentoo/usr/include -I/usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Include -I/usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1 -c /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Modules/_ctypes/libffi/src/mips/n32.S -o build/temp.irix64-6.5-2.6/usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Modules/_ctypes/libffi/src/mips/n32.o as: Error: /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Modules/_ctypes/libffi/src/mips/n32.S, line 43: undefined assembler operation: .abicalls .abicalls as: Error: /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Modules/_ctypes/libffi/src/mips/n32.S, line 477: String within expression may have only one character: aw .section .eh_frame,"aw",@progbits as: Error: /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Modules/_ctypes/libffi/src/mips/n32.S, line 477: Invalid symbol in expression as: Error: /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Modules/_ctypes/libffi/src/mips/n32.S, line 477: undefined symbol in expression as: Error: /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Modules/_ctypes/libffi/src/mips/n32.S, line 477: Invalid symbol in expression as: Error: /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Modules/_ctypes/libffi/src/mips/n32.S, line 484: undefined assembler operation: .uleb128 .uleb128 0x1 as: Error: /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Modules/_ctypes/libffi/src/mips/n32.S, line 485: undefined assembler operation: .sleb128 .sleb128 -4 as: Error: /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Modules/_ctypes/libffi/src/mips/n32.S, line 488: undefined assembler operation: .uleb128 .uleb128 0x1d as: Error: /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Modules/_ctypes/libffi/src/mips/n32.S, line 489: undefined assembler operation: .uleb128 .uleb128 0x0 as: Error: /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Modules/_ctypes/libffi/src/mips/n32.S, line 502: undefined assembler operation: .uleb128 .uleb128 ( 8 * 8 ) as: Error: /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Modules/_ctypes/libffi/src/mips/n32.S, line 506: undefined assembler operation: .uleb128 .uleb128 2*8/4 as: Error: /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Modules/_ctypes/libffi/src/mips/n32.S, line 508: undefined assembler operation: .uleb128 .uleb128 1*8/4 as: Error: /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Modules/_ctypes/libffi/src/mips/n32.S, line 512: undefined assembler operation: .uleb128 .uleb128 0x1e as: Error: /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Modules/_ctypes/libffi/src/mips/n32.S, line 524: undefined assembler operation: .uleb128 .uleb128 (20 * 8) as: Error: /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Modules/_ctypes/libffi/src/mips/n32.S, line 528: undefined assembler operation: .uleb128 .uleb128 ((20 * 8) - (0 * 8))/4 as: Error: /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Modules/_ctypes/libffi/src/mips/n32.S, line 530: undefined assembler operation: .uleb128 .uleb128 ((20 * 8) - (1 * 8))/4 Failed to find the necessary bits to build these modules: _tkinter 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 ... additionally, the test-suite has the following failures: test_cmath test test_cmath failed -- Traceback (most recent call last): File "/usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Lib/test/test_cmath.py", line 340, in test_specific_values actual = function(arg) ValueError: math domain error test_fileio test test_fileio failed -- Traceback (most recent call last): File "/usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Lib/test/test_fileio.py", line 155, in testAbles self.assertEquals(f.seekable(), False) AssertionError: True != False test_float test test_float failed -- Traceback (most recent call last): File "/usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Lib/test/test_float.py", line 622, in test_from_hex self.identical(fromHex('0x0.ffffffffffffd6p-1022'), MIN-3*TINY) File "/usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Lib/test/test_float.py", line 363, in identical self.fail('%r not identical to %r' % (x, y)) AssertionError: 0.0 not identical to 2.2250738585072014e-308 test test_gzip failed -- Traceback (most recent call last): File "/usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Lib/test/test_gzip.py", line 77, in test_many_append ztxt = zgfile.read(8192) File "/usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Lib/gzip.py", line 219, in read self._read(readsize) File "/usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Lib/gzip.py", line 284, in _read self._read_eof() File "/usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Lib/gzip.py", line 304, in _read_eof hex(self.crc))) IOError: CRC check failed 0x74736574 != 0xe8b7be43L test_math test test_math failed -- Traceback (most recent call last): File "/usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Lib/test/test_math.py", line 879, in test_testfile self.fail(message) AssertionError: Unexpected ValueError in test log0038:log(9.8813129168249309e-324) test_multiprocessing test test_multiprocessing crashed -- <type 'exceptions.OSError'>: [Errno 13] Permission denied test_os /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Lib/os.py:759: DeprecationWarning: integer argument expected, got float bs += read(_urandomfd, n - len(bs)) test_sqlite make: *** [test] Bus error (core dumped) test test_smtplib failed -- Traceback (most recent call last): File "/usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Lib/test/test_smtplib.py", line 225, in testSend self.assertEqual(self.output.getvalue(), mexpect) AssertionError: "---------- MESSAGE FOLLOWS ----------\nA test message\n------------ END MESSAGE ------------\nerror: uncaptured python exception, closing channel <smtpd.SMTPChannel 127.0.0.1:35519 at 0x11ee72d8> (<class 'socket.error'>:[Errno 9] Bad file descriptor [/usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Lib/asyncore.py|readwrite|101] [/usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Lib/asyncore.py|handle_write_event|427] [<string>|getsockopt|1] [/usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.1-r1/work/Python-2.6.1/Lib/socket.py|_dummy|165])\n" != '---------- MESSAGE FOLLOWS ----------\nA test message\n------------ END MESSAGE ------------\n'
Created attachment 188661 [details, diff] Patch to ebuild to incorporate IRIX patches and ensure that libpython.so is installed
Created attachment 188662 [details, diff] Generic patches for python which enable compilation on IRIX For some reason the HAVE_ALLOCA_H logic doesn't seem to work, so I've included this header unconditionally. Other than that, these patches should be generic across all architectures.
patches applied, thanks!
Unfortunately, although these patches work prefectly for Python-2.6.1-r1, with Python-2.6.2, Python builds correctly but libpython26.so isn't being built. This breaks portage if the previous merge did have a libpython26.so present. I added the following to the ebuild within src_install to check for this: [ -e "${ED}"/usr/$(get_libdir)/libpython${PYVER}.so ] || die "libpython${PYVER}.so not installed" ... but I don't know why this behaviour should have changed. More to the point, if calling 'make libpython26.so' isn't going to work, then another means of buiding this will be needed. Actually, I've just noticed that if I manually run "gmake libpython26.so" then I get: Makefile:446: warning: overriding commands for target `libpython2.6.dylib' Makefile:439: warning: ignoring old commands for target `libpython2.6.dylib' gmake: *** No rule to make target `libpython26.so'. Stop. Is some Darwin path stomping on the ability to build the DSO on IRIX, or was the libpython build target added by a Darwin patch in the first place? (I'm confused, since the rule to build "libpython(VERSION).so" seems to start from line 430 of the Makefile...)
n/m - my mistake: It should have been "gmake libpython2.6.so", which works. It seems that libpython2.6.so does get built correctly, but Python's "make install" step no longer copies it to the destination directory if it exists, which it has always done in the past...
I lost track, is there anything to do here still or not?
dev-lang/python-2.6.1-r1 is fixed, works correctly, *and* installs libpython2.6.so - great! However, something has changed in dev-lang/python-2.6.2 so that libpython, even though built, isn't actually installed. This is problematic if upgrading from python-2.6.1-r1, as portage commands fail because the required DSO can't be mapped. An addition to the ebuild to install libpython2.6.so would fix this... but I'd prefer to find how the Makefile expects libpython2.6.so to be installed, so that the same problem shouldn't arise in future versions.
Created attachment 189975 [details, diff] Ensure that libpython2.6.so is built _and_ installed... There's probably a smarter/more standard way to do this... but this does get the job done.
Created attachment 189977 [details, diff] python-2.6-irix-libpython2.6.patch I've just looked at the python buildhell again, to figure out why python doesn't build the shared library on OSX. It appears it does, so modifications are no longer necessary (next to patching). I'm wondering if the attached patch enables auto-building of the shared library on IRIX again?
Words fail me...
Is that good or bad? I know it takes a lot of time... :(
Sorry - that was a gut-reaction to how the Python developers decided whether to install libpython or not ;) More practically, testing that change now...
I actually inserted: IRIX*) LDLIBRARY='libpython$(VERSION).so' BLDLIBRARY='-L. -lpython$(VERSION)' RUNSHARED=LD_LIBRARYN32_PATH=`pwd`:${LD_LIBRARYN32_PATH} INSTSONAME="$LDLIBRARY".$SOVERSION ;; ... at around the same place. On IRIX, LD_LIBRARY_PATH only applies to (o)32 objects, rather than n32 objects (the default) or 64bit objects (which would be LD_LIBRARY64_PATH). I guess that this really should check the ABI being built against and use the correct variable - but the above will almost always be correct (the C99 front-end won't build o32 code, and MIPS isn't register-starved, so long mode/64bit really is just a slower (n)32bit mode with longer longs and access to more memory) The good news is that this worked, and python correctly installed libpython2.6.so.0.1 and libpython2.6.so pointing to it. (I also noticed the following in the build output just at the end of the 'install' stage: Creating directory /opt/gentoo/usr/share/man Creating directory /opt/gentoo/usr/share/man/man1 /opt/gentoo/usr/bin/install -c -m 644 ./Misc/python.man \ /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.2/image//opt/gentoo/usr/share/man/man1/python.1 /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.2/temp/environment: line 3634: /usr/include/python2.6/pyconfig.h: No such file or directory >>> Completed installing python-2.6.2 into /usr/opt/gentoo/var/tmp/portage/dev-lang/python-2.6.2/image/opt/gentoo/ .. which seems to be because the ebuild contains: [[ ${CHOST} == *-solaris* ]] && dosed -e \ 's:^\(^#define \(_POSIX_C_SOURCE\|_XOPEN_SOURCE\|_XOPEN_SOURCE_EXTENDED\).*$\):/* \1 */:' /usr/include/python${PYVER}/pyconfig.h ... instead of: [[ ${CHOST} == *-solaris* ]] && dosed -e \ 's:^\(^#define \(_POSIX_C_SOURCE\|_XOPEN_SOURCE\|_XOPEN_SOURCE_EXTENDED\).*$\):/* \1 */:' \ /usr/include/python${PYVER}/pyconfig.h )
Thanks, that last bug I already caught yesterday, but didn't want to commit the IRIX changes as well. I will apply your patch then. That makes this bug finally closed, right? (weird that the python devs actually dropped IRIX shared lib support...)
I applied your patch, so I guess that fixes everything :)
(In reply to comment #2) > Created an attachment (id=188662) [edit] > Generic patches for python which enable compilation on IRIX > > > For some reason the HAVE_ALLOCA_H logic doesn't seem to work, so I've included > this header unconditionally. Other than that, these patches should be generic > across all architectures. > Err, one part of this patch breaks module '_ctypes' on multiple platforms (linux, hpux, others?): --- Modules/_ctypes/libffi/include/ffi_common.h +++ Modules/_ctypes/libffi/include/ffi_common.h -typedef unsigned int UINT8 __attribute__((__mode__(__QI__))); -... -typedef signed int SINT64 __attribute__((__mode__(__DI__))); +typedef uint8_t UINT8; +... +typedef __int64_t SINT64; The '*int*_t' types aren't necessarily known everywhere. I'm going to put an '#ifdef __sgi' around the '*int*_t' and keep the old ones in '#else' for python-2.6.2-r1 new interrev 01. Please tell if '__sgi' isn't the right one to use here.
fixed in r47262.