Compiling Python 2.6 on Solaris 10

By Alasdair Lumsden on 27 Jan 2009

Sorry for not posting so much lately. Work has been busier than ever – it’s quite incredible. Just a quick post on compiling Python 2.6, which was giving me a few problems.

Dependencies

I’d recommend throwing on ncurses and readline from the Solaris 10 companion CD, the packages are SFWncur and SFWrline. The full dependency list is:

P SFWncur
P SFWrline
P SUNWbzip
P SUNWcry
P SUNWcsl
P SUNWcslr
P SUNWcsr
P SUNWgccruntime
P SUNWlibms
P SUNWlibmsr
P SUNWopenssl-libraries
P SUNWzlib

Compiling

The _ctype module fails to compile with Sun Studio 12. Rather than fix this, I simply used gcc instead. Also Python seemed to be missing _ssl, so I popped in the appropriate library paths. Thus:

export "LDFLAGS=-L/opt/sfw/lib -R/opt/sfw/lib -L/usr/sfw/lib -R/usr/sfw/lib"
export "CPPFLAGS=-I/usr/sfw/include -I/opt/sfw/include -I/opt/sfw/include/ncurses"
export "CFLAGS=-I/opt/sfw/include"
export "LIBS=-lncurses"
export CC=gcc CXX=g++
./configure --prefix=/opt/python26 --enable-shared --disable-ipv6 --with-threads --with-libs="-lncurses" --with-wctype-functions
gmake
gmake install

Not all the modules will compile, but the ones that were missing were not of importance (sqlite, bsdbd, etc).