Monday, May 28, 2018

Building libffi 3.0.13

The library libffi (from Foreign Function Interface) is a required dependency at least for building Python. It's reported to be used on Ruby and OpenJDK among others as well. The last time I've checked its official website the latest version was 3.2.1, BUT somehow from minor version 1 and beyond, that is, all versions following the 3.0.x branch seems buggy and don't build under (32-bits) Solaris 11 Express, despite the alleged platform support. Nevertheless, it's true I could built version 3.2.1 under Solaris 11.3 GA both 32 and 64 bits, hence the buggy thing on Solaris 11 Express could be other outdate GNU tools as well. In fact, interestingly, Solaris 11.3 GA (since Solaris 11 Express) still packages version 3.0.9 on its official repositories. I don't know if version 3.0.13 brings any enhancement to Solaris, but it builds successfully and is presumably better so I otherwise use it.

NOTE
Version 3.2.1 (libffi.so.6.0.4) can be successfully built under Solaris 11.3 GA, either 32-bits or 64-bits. Hence I'm wondering if the 32-bits version built under Solaris 11.3 could be reused on a 32-bits Solaris 11 Express. AFAIK the only dependencies are on libc.so.1 and libgcc_s.so.1.
The basic building strategy and general assumptions have been detailed on a previous post Staged Building.

 $ pwd
/stage/build

$ ./gnu-build-preparation ../source/.../libffi-3.0.13.tar.gz
...

$ cd libffi/libffi-3.0.13-32

$ source ../setenv-3.0.13 32
...

$ ./configure --build=i386-pc-solaris2.11 --prefix=/opt/usr
...

$ gmake -j3
...


$ sudo gmake install
...
 
$ sudo zfs snapshot -r .../opt/usr@libffi-3.0.13

$ l /opt/usr/lib/ |grep ffi
drwxr-xr-x  ... libffi-3.0.13
-rw-r--r--  ... libffi.a
-rwxr-xr-x  ... libffi.la
lrwxrwxrwx  ... libffi.so -> libffi.so.6.0.1
lrwxrwxrwx  ... libffi.so.6 -> libffi.so.6.0.1
-rwxr-xr-x  ... libffi.so.6.0.1


Furthermore, there's no much else to say.
In fact, if all packages were simple to build like this, life would be much better ;-)