Python 2.7 SPARC build needs an adjusted patch and a new patch
In an attempt to build python2.7 on a T2000 (SPARC), I received this error:
/usr/gcc/4.4.4/bin/gcc -m32 -O3 -mno-app-regs -fPIC -DPIC -std=c99 -D_XOPEN_SOURCE=600 -m32 -fPIC -DPIC -R/usr/gnu/lib -L/usr/gnu/lib -o python \ Modules/python.o \ -L. -lpython2.7 -lsocket -lnsl -ldl -lm Undefined first referenced symbol in file asm ./libpython2.7.so ld: fatal: symbol referencing errors. No output written to python collect2: ld returned 1 exit status
This happens because Python/ceval.c contains two instances of code like this:
#if defined(__sparc) + asm("nop"); #endif
This code was inserted by a patch called 05-dtrace.patch . The file dtrace.patch.diff, attached to a message with this same title posted to the oi-dev mailing list, shows the changes I made to the patch. These changes fix the problem by replacing asm with asm volatile .
One of the modules also failed to build, producing these errors:
/export/home/mills/Downloads/code/oi-userland/components/python/python27/Python-2.7.14/Modules/_ctypes/libffi/src/sparc/ffi.c:526: error: 'asm' undeclared (first use in this function) /export/home/mills/Downloads/code/oi-userland/components/python/python27/Python-2.7.14/Modules/_ctypes/libffi/src/sparc/ffi.c:526: error: expected ';' before 'volatile'
The new patch 31-sparc.patch, also attached to that message, fixes this problem by replacing asm volatile with asm volatile . Finally, I updated COMPONENT_REVISION in the Makefile to signal the presence of the adjusted patch and the new one as in the file Makefile.diff .
These changes only affect the SPARC build. Later python versions likely require the same changes, but I haven't checked.
Updated by Gary Mills over 5 years ago
- File 31-sparc.patch 31-sparc.patch added
- File dtrace.patch.diff dtrace.patch.diff added
- File Makefile.diff Makefile.diff added
Since the editor messed up my comments, changing a variable with leading and trailing underscores into an Italic font, I'll attach the files here too.