Pages

Tuesday, April 24, 2018

The RLE configuration

It's been a while since I last dropped a line into this blog. That's not because I've neglected it but because there's been so much to learn in C++ and a wealth of other technologies and metodologies that it gets hard to find time to write all of my findings. But anyway here I am and let's go again.

Among a few other activies I've been conducting is the build of several more up-to-date userland software to Solaris 11.3. More recently I've finally come to a somewhat better procedure which I called Staged Building which basically enhances my original approach to GNU Building Automation.

But while delving into this other subject I thought I knew enough about GCC library search dirs when in fact another point was missing on the particular scenario: the runtime linking environment (RLE). The RLE issue became important because while rebuilding system software there are many interdependencies which sometimes gets hard to deal with and because certain software build process is so intrincate that it's hard to find how or where to inform the required -R GCC option. For instance, that's the case while rebuilding Perl. Of course I'm not relying on the appealing but evil LD_LIBRARY_PATH or symbolic links.

By default in Solaris 11.3 you have the following (ELF) library search path: /lib:/usr/lib. That becomes a problem when one is gradually updating several software with many interdependencies. At some point in the process one will need to point to a more updated library search path before fallbacking to the outdate system defaults. For instance, if I build an updated zlib library (version 1.2.11 at the time of this writing), I won't uninstall or replace the outdated system default version 1.2.8. I just need that the location of the newer version be search beforehand.

NOTE
Just prepend new paths to the default library search paths.

If my newer 64-bit librares are at /opt/gnu/lib and /opt/usr/lib I just need to prepend these paths to the default library search path of my 64-bit artifacts, that is, to achieve: /opt/gnu/lib:/opt/usr/lib:/lib:/usr/lib

Fortunately, Solaris 11.3 provisions the crle(1) tool, a dedicated tool to configure the runtime linking environment. Of course I shall not repeat what's on its very well written man page.

$ crle
Default configuration file (/var/ld/ld.config) not found
  Platform: 32-bit LSB 80386
  ...Library ...: /lib:/usr/lib (... default)
  Trusted ...: /lib/secure:/usr/lib/secure (... default)


$ crle -64
Default configuration file (/var/ld/64/ld.config) not found
  Platform: 64-bit LSB AMD64
  ... Library ...: /lib/64:/usr/lib/64 (... default)
  Trusted ...: /lib/secure/64:/usr/lib/secure/64 (... default)


As per best practice develop the runtime linking environment configuration files in an alternate place than the system's default (shown above). When deploying the stable configuration there are 3 options:

  • Just rely on LD_CONFIG_64 (or LD_CONFIG_32)
  • Move the configuration file to the system default directories
  • Embed the configuration while building the software (ld -c)

I won't furnish any examples because the ones on the man page suffices!