By Alasdair Lumsden on 23 Jan 2011
IPS/pkg5 is the native package manager on OpenSolaris, and thus by extension on OpenIndiana (The OpenSolaris fork I started last year). Over the past 6 months I’ve become familiar with IPS, and I can honestly say I’ve fallen in love with it. It’s very powerful, useful and fairly easy to use (If you forgive it’s obscure error messages).
It was developed from scratch to be cross-platform, allowing Sun to deliver packages to other systems such as Linux, AIX, and Solaris 10. I decided it might be a good idea for us to roll it out on our Solaris 10 cloud for use with managing software. Our clients love the power of Solaris 10, but they sure do hate the lack of native package management, so IPS could really be a big win for us.
But boy, is getting it working on Solaris 10 no easy task. IPS itself is written mostly in Python, however the dependency list is huge, and some of the packages are a real pain to compile. The IPS build system also makes a few assumptions that aren’t correct on Solaris 10 which complicated things.
Whilst other guides bypass a lot of the problems by using OpenCSW/Blastwave packages such as this one here, I wanted a little self-contained “/opt/pkg” directory with it’s own Python install and any dependencies. The whole point of my deployment of IPS is to get away from OpenCSW/Blastwave and friends, which introduce a whole other stack of software you have to keep up to date.
While I don’t have time to go into the build process in detail, I can offer some hints to help out.
I found I had to build the following packages (the ordering here is completely incorrect, sorry):
gettext expat rarian intltool python2.6 setuptools swig pyOpenSSL gnome-doc-utils libxml2 libxml2-python libxslt
You’ll want to skip building the gui tools, update manager and the brand stuff, so in pkg-gate/src/Makefile, change the SUBDIRS variable as such:
#SUBDIRS=web gui um po util/misc brand SUBDIRS=web util/misc
Also remember to set PYTHON= to your new python.
I had to patch M2Crypto – it uses SWIG to generate Python bindings, and assumes ENGINE_load_openssl is present in the OpenSSL library. When running pkg I was getting:
ImportError: ld.so.1: python2.6: fatal: relocation error: file /opt/pkg/python26/lib/python2.6/site-packages/M2Crypto/__m2crypto.so: symbol ENGINE_load_openssl: referenced symbol not found
This is because the Solaris 10 OpenSSL install is missing the ENGINE_load_openssl function – it has been yanked out for crypto export reasons (that now probably don’t apply as OpenSolaris contains it). I removed references to it, and managed to coerce it to work. The patches for M2Crypto are here:
# pwd /root/pkg-gate/src/patch/M2Crypto # cat pkg-gate_m2c.patch --- SWIG/_engine.i.orig 2011-01-22 23:32:17.583271086 +0000 +++ SWIG/_engine.i 2011-01-22 23:32:50.478960838 +0000 @@ -26,9 +26,6 @@ %rename(engine_load_dynamic) ENGINE_load_dynamic; extern void ENGINE_load_dynamic(void); -%rename(engine_load_openssl) ENGINE_load_openssl; -extern void ENGINE_load_openssl(void); - %rename(engine_cleanup) ENGINE_cleanup; extern void ENGINE_cleanup(void); # cat setup.patch --- setup.py.orig 2011-01-22 23:49:21.466821165 +0000 +++ setup.py 2011-01-22 23:49:32.286055614 +0000 @@ -40,7 +40,7 @@ self.openssl = 'c:pkg' else: self.libraries = ['ssl', 'crypto'] - self.openssl = '/usr' + self.openssl = '/usr/sfw' def finalize_options(self):
Lastly some tips – the NetBSD pkgsrc system contains useful patches for getting some of the above dependencies to compile on Solaris 10. I can’t remember which ones I used but it did come in handy. And don’t forget about your CFLAGS/LDFLAGS/PATH. I also found I had to temporarily rename Solaris patch to patch.off and symlink gpatch to get pkg5 to auto-patch M2Crypto as it assumes GNU flags. You may also need to add -lintl and -lsocket at some point during the dependency build process to your LDFLAGS (I can’t remember where).
I’m delighted to have pkg5 working on Solaris 10 now. I’ll report back at a later date how I’m getting on. For those that want to cheat, I have a tar’d version you can stick at /opt/pkg here. It’s a strange layout – forgive me. And keep in mind, I haven’t tried it much yet.