Multi-architecture package support in SmartOS
[Updated on 2013-01-16 to use the 12.4.1 dataset which fixes some issues.]
Ever since the release of Solaris 7 back in 1998, Solaris has had the ability to run both 32-bit and 64-bit binaries on the same machine. Even now, 15 years later, with much of the world 64-bit only, there are still reasons to retain 32-bit support:
-
32-bit binaries can be faster in many cases, and if you do not need the additional address space afforded by the 64-bit version then there may be no advantage to running it.
-
Some software you depend upon may only provide a 32-bit version, or may have better compatability in that mode.
-
It’s sometimes nice to have a hard 4GB memory limit on a runaway process instead of it completely trashing your machine ;)
Unfortunately, while the base SmartOS platform is set up to provide both 32-bit and 64-bit binaries, the packaging infrastructure we use, pkgsrc, has not traditionally supported building multi-architecture packages. This has meant we have needed to provide both 32-bit and 64-bit versions of each dataset, which is not ideal:
-
It’s confusing to customers and users, who may think it applies to the kernel and platform version.
-
Users want the choice to be able to run 32-bit for some applications and 64-bit for others, all on the same machine.
-
It is additional work and maintenance for us.
In order to resolve this, I have been working on providing multi-architecture support to pkgsrc, and this work is now available for preview testing.
Getting started
Here is a quick start guide to getting the multi-architecture dataset up and running:
then login and start using it as you would with any other dataset.
Multi-architecture libraries
Libraries are reasonably straight-forward. For most packages which provide shared libraries, you should find both 32-bit and 64-bit libraries are included, for example:
Other directories under lib/
should be handled correctly too, such as .pc
files for pkg-config
:
Multi-architecture binaries
Binaries are similar, but follow a different layout scheme, and have additional controls to allow the user to select which architecture to use.
The basic layout is:
In order to explain this, let us look at how the base platform supports
multi-architecture binaries, using dtrace
as an example:
The i86
and amd64
hold the per-architecture binaries, and the main
/usr/sbin/dtrace
command is a hardlink to the /usr/lib/isaexec
wrapper (as
shown by the inode being identical). This wrapper detects whether the running
kernel is 32-bit or 64-bit, and calls the appropriate native binary, which
nowadays will almost certainly be the 64-bit version.
For the pkgsrc implementation, I needed a way to override this behaviour so
that users could select to run the 32-bit version if so desired, without having
to munge their $PATH
. To do this I took a copy of isaexec
and added it to
pkgsrc, with additional support for an ABI
environment variable.
You can see the behaviour below with the calls to execve()
.
- Default is to run 64-bit
- Set ABI=32 or ABI=i86 to run the 32-bit version
Note that not all binaries have been converted to multi-architecture. In fact, the majority have been left as plain 32-bit binaries. While all libraries ultimately have to be provided for both architectures so that users can choose to compile their own software against either, 64-bit binaries only make sense for certain classes of software:
- Databases such as SQLite, and other servers which may require >4GB address space.
- Language interpreters.
- Software which provides a
foo-config
script with hardcoded references tolibdir
.
Compiler support
The GCC 4.7.2 package provided has been made aware of this layout, and will add the correct library paths depending upon the ABI you target. For example:
No additional flags or linker settings should be required (if they are, let me know!)
Interpreter support
For those interpreters which have been converted, their respective module systems should be multi-architecture aware:
- Perl already had reasonable support for multi-architecture files, and all perl modules provided should be enabled, for example:
-
Python is similar to Perl, but needed a lot more work to support multi-architecture modules. Modules provided by pkgin should work fine, but there may be issues with locally-built modules - let me know!
-
node is built as a multi-architecture binary, but
npm
has received no special handling. This means you need to be careful not to mix-and-match modules. I don’t perceive this to be too much of an issue, as the node community appears to have settled on having onenode_modules
per application, but again let me know if there are better ways to handle this.
Coverage
This work is incomplete, hence it not being available in the default datasets yet, but a large number of packages have been converted:
- Pretty much every package which provides shared libraries.
- Python, Perl, Lua and node.js interpreters (and a significant number of modules).
- MySQL 5.5, PostgreSQL, SQLite and DB4 databases, Apache 2.2.
Notable exceptions currently are Ruby and PHP, and I will be working on those in due course. There may also be a number of packages which should include multi-architecture binaries, please let me know if I have missed any obvious candidates.
You can raise issues against our GitHub project here.
Enjoy!
All Posts
- 16 Jul 2015 » Reducing RAM usage in pkgin
- 03 Mar 2015 » pkgsrc-2014Q4: LTS, signed packages, and more
- 06 Oct 2014 » Building packages at scale
- 04 Dec 2013 » A node.js-powered 8-bit CPU - part four
- 03 Dec 2013 » A node.js-powered 8-bit CPU - part three
- 02 Dec 2013 » A node.js-powered 8-bit CPU - part two
- 01 Dec 2013 » A node.js-powered 8-bit CPU - part one
- 21 Nov 2013 » MDB support for Go
- 30 Jul 2013 » What's new in pkgsrc-2013Q2
- 24 Jul 2013 » Distributed chrooted pkgsrc bulk builds
- 07 Jun 2013 » pkgsrc on SmartOS - creating new packages
- 15 Apr 2013 » What's new in pkgsrc-2013Q1
- 19 Mar 2013 » Installing SVR4 packages on SmartOS
- 27 Feb 2013 » SmartOS is Not GNU/Linux
- 18 Feb 2013 » SmartOS development preview dataset
- 17 Jan 2013 » pkgsrc on SmartOS - fixing broken builds
- 15 Jan 2013 » pkgsrc on SmartOS - zone creation and basic builds
- 10 Jan 2013 » Multi-architecture package support in SmartOS
- 09 Jan 2013 » Solaris portability - cfmakeraw()
- 08 Jan 2013 » Solaris portability - flock()
- 06 Jan 2013 » pkgsrc-2012Q4 illumos packages now available
- 23 Nov 2012 » SmartOS and the global zone
- 24 Oct 2012 » Setting up Samba on SmartOS
- 10 Oct 2012 » pkgsrc-2012Q3 packages for illumos
- 23 Aug 2012 » Creating local SmartOS packages
- 10 Jul 2012 » 7,000 binary packages for OSX Lion
- 09 Jul 2012 » 9,000 packages for SmartOS and illumos
- 07 May 2012 » Goodbye Oracle, Hello Joyent!
- 13 Apr 2012 » SmartOS global zone tweaks
- 12 Apr 2012 » Automated VirtualBox SmartOS installs
- 30 Mar 2012 » iptables script for Debian / Ubuntu
- 20 Feb 2012 » New site design
- 11 Jan 2012 » Set up anonymous FTP upload on Oracle Linux
- 09 Jan 2012 » Kickstart Oracle Linux in VirtualBox
- 09 Jan 2012 » Kickstart Oracle Linux from Ubuntu
- 22 Dec 2011 » Last day at MySQL
- 15 Dec 2011 » Installing OpenBSD with softraid
- 21 Sep 2011 » Create VirtualBox VM from the command line
- 14 Sep 2011 » Creating chroots for fun and MySQL testing
- 30 Jun 2011 » Graphing memory usage during an MTR run
- 29 Jun 2011 » Fix input box keybindings in Firefox
- 24 Jun 2011 » How to lose weight
- 23 Jun 2011 » How to fix stdio buffering
- 13 Jun 2011 » Serving multiple DNS search domains in IOS DHCP
- 13 Jun 2011 » Fix Firefox URL double click behaviour
- 20 Apr 2011 » SSH via HTTP proxy in OSX
- 09 Nov 2010 » How to build MySQL releases
- 29 Apr 2010 » 'apt-get' and 5,000 packages for Solaris10/x86
- 16 Sep 2009 » ZFS and NFS vs OSX
- 12 Sep 2009 » pkgsrc on Solaris
- 09 Dec 2008 » Jumpstart from OSX
- 31 Dec 2007 » Set up local caching DNS server on OSX 10.4