[gobolinux-users] Rootless and host libraries

Daed Lee daed at thoughtsofcode.com
Sat Apr 11 13:34:54 NZST 2009


On Fri, Mar 27, 2009 at 4:28 AM, Daed Lee <daed at thoughtsofcode.com> wrote:
> As I'm starting to test Rootless hosted on an Ubuntu installation, I'm
> finding that I have to modify more and more recipes in order to get
> them to build correctly. For example, I had to specify the path to the
> Rootless zlib library to build Apache. Previously the same recipe
> worked on Mac OS X without having to specify the path to zlib. The
> difference seems to be that Mac OS X comes with its own built-in
> version of zlib in /usr/lib, whereas I was starting with a clean
> installation of Ubuntu without its own version of zlib. The issue is
> essentially the same one I encountered earlier:
> http://lists.gobolinux.org//pipermail/gobolinux-users/2008-July/007814.html.

I encountered another aspect of this problem while doing some more
testing on Ubuntu. StartRootless sets LD_LIBRARY_PATH to
${goboPrefix}/System/Links/Libraries, which allows programs built
within Rootless to locate their linked libraries and run correctly.
However, an issue arises with programs built within the host
environment against the host libraries. I get messages like the
following when trying to run those programs:

wget: /GoboLinux/System/Links/Libraries/libcrypto.so.0.9.8: no version
information available (required by wget)
wget: /GoboLinux/System/Links/Libraries/libssl.so.0.9.8: no version
information available (required by wget)

Most of the time, the program runs fine and the messages can be
ignored, but sometimes the program crashes with a segmentation fault.
It seems the LD_LIBRARY_PATH setting forces the host program to use
the Rootless version of the library at runtime, and this causes
problems when the Rootless version of the library is incompatible with
the hosted version the program was linked against. Removing the
LD_LIBRARY_PATH setting from StartRootless resolves the issue with the
host program, but then some of the Rootless programs stop working.

Researching the issue further, it seems setting LD_LIBRARY_PATH
globally is generally a bad idea
(http://www.eyrie.org/~eagle/notes/rpath.html). The suggested
workaround is to set the rpath for each program to point to the shared
library location. This can be accomplished without modifying each
individual recipe by setting the LD_RUN_PATH environment variable.
After recompiling, programs from both environments run without errors.

Here is a patch that implements the fix:

diff -Naur bin/CreateRootlessEnvironment bin.patched/CreateRootlessEnvironment
--- bin/CreateRootlessEnvironment	2009-04-10 21:11:01.000000000 -0400
+++ bin.patched/CreateRootlessEnvironment	2009-04-10 21:16:36.000000000 -0400
@@ -166,7 +166,7 @@

 export PKG_CONFIG_PATH="${goboPrefix}/System/Links/Libraries/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig"

-export LD_LIBRARY_PATH="${goboPrefix}/System/Links/Libraries${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
+export LD_RUN_PATH="${goboPrefix}/System/Links/Libraries${LD_RUN_PATH:+:$LD_RUN_PATH}"

 if [ "`uname -s`" = "Darwin" ]
 then

I've tested this with several programs I was having trouble with and
they all seem to work after being recompiled. I'll try to get around
to testing this on an Ubuntu installation from scratch next month.
I'll be away from the computer for a few weeks, so I wanted to get
this out there. Appreciate any feedback. Thanks.


More information about the gobolinux-users mailing list