cyrusimap / cassandane

Other
6 stars 11 forks source link

LD_LIBRARY_PATH when 64-bit libs live in "lib64" #19

Open jasontibbitts opened 7 years ago

jasontibbitts commented 7 years ago

I noticed that Cassandane has support for setting LD_LIBRARY_PATH itself, but that I've still had to set it manually. Looking at the code I see that it will combine cyrus_destdir, cyrus_prefix and "/lib" together and prepend that to the existing LD_LIBRARY_PATH setting. But on some distros, 64-bit libraries live in a lib64 directory instead.

The most trivial solution is simply the following, but maybe it would be better to see if either directory exists first.

diff --git a/Cassandane/Instance.pm b/Cassandane/Instance.pm
index 31aa9eb..d3db2e5 100644
--- a/Cassandane/Instance.pm
+++ b/Cassandane/Instance.pm
@@ -1554,6 +1554,7 @@ sub _fork_command
     {
        $ENV{LD_LIBRARY_PATH} = join(':', (
                $self->{cyrus_destdir} . $self->{cyrus_prefix} . "/lib",
+               $self->{cyrus_destdir} . $self->{cyrus_prefix} . "/lib64",
                split(/:/, $ENV{LD_LIBRARY_PATH} || "")
        ));
     }
jasontibbitts commented 7 years ago

Though, oddly, if I do this it still makes no difference. I verified that cassandane is setting the variable properly, but if I don't manually export it then the binaries can't find their libraries. I've verified that the value cassandane is adding is exactly what I'm exporting manually, but it's almost as if Perl doesn't actually change the variable.

elliefm commented 7 years ago

It should be fine to just set it without bothering to check for existence. It's weird that it's not having an effect though? It looks legit to my eye.