[asterisk-dev] Feedback requested for rpath patch

David M. Lee dlee at digium.com
Thu Sep 27 09:29:43 CDT 2012


On Sep 26, 2012, at 9:29 PM, Tzafrir Cohen wrote:

> On Wed, Sep 26, 2012 at 01:30:36PM -0500, David M. Lee wrote:
>> Hello, all!
>> 
>> If you would please take a look at ASTERSIK-20407[1], I'd like some
>> input from the fine folks on asterisk-dev.
>> 
>> (tl;dr - Asterisk fails to start if prefix isn't /usr, b/c we don't
>> specify the rpath when building the asterisk binary)
>> 
>> I have a patch which fixes this problem[2]. This patch will:
>> 
>> * For OS's other than OS X, add the -rpath linker option if libdir is
>>   anything other than /lib or /usr/lib. This can be disabled by
>>   passing --disable-rpath to ./configure.
>> 
>> * For OS X, we have macosx_version_min set to 10.4, which doesn't
>>   support rpath. So instead, the patch adds the -dynamiclib and
>>   -install_name flags for linking libasteriskssl.dylib, along with
>>   cleaning up some of the other OS X specific linker flags.
> 
> The patch sets rpath on just about everything. This is wrong. If you
> need to set rpath on libasteriskssl, set it on libasteriskssl. Please
> don't potentially break other thing with path.

Hm, rpath needs to be set on the main executable so that it can find
libasteriskssl. Just setting it on libasteriskssl won't help.

> Q: What's wrong with rpath?
> A: it works after you install things but magically fails to work if you
>   move things around.

I would say "magically works" :-) Does Linux have the equivalent of
@executable_path or @loader_path to solve the moving things around
problem? I don't think so...

If you move things around, you have to set an explicit
LD_LIBRARY_PATH. If you don't set rpath, you have to set
LD_LIBRARY_PATH whether or not you move things around. I would say
that rpath is a net positive in terms of "making things work".

> I prefer an explicit LD_LIBRARY_PATH.

In that case, you can pass --disable-rpath to ./configure and use
LD_LIBRARY_PATH. Actually, LD_LIBRARY_PATH would trump rpath, so you
can be explicit whether rpath is set or not.

Whether rpath on/off by default is right or wrong... There are
trade-offs either way. I believe that only setting it when prefix !=
/usr, and giving a --disable-rpath option to disable that behavior, we
are at a decent middle ground.

>> So here's where I can use some input. Please reply to the list, or
>> comment on my review[3].
>> 
>> * I don't immediately have a way to check my patch for Solaris, BSD's
>>   and whatever else someone might be interested in building Asterisk
>>   on. If you're interesting in building Asterisk on not Linux, mind
>>   checking out my patch and providing feedback?
>> 
>> * I really don't like the check against /lib and /usr/lib. Is there a
>>   better way to check whether the rpath flag should be set?  Should
>>   rpath always be set unless --disable-rpath is passed in?
> 
> Note that Debian and Ubuntu systems now have [/usr]/lib/<arch-triplet>,
> such as /usr/lib/x86_64-linux-gnu .

I've taken Jeff's suggestion; now the patch checks prefix instead of
libdir. That should handle those cases properly now.

> I prefer that it won't be set at all.
> 
>> 
>> * Having the rpath thing differ just because of OS X 10.4 (Tiger)
>>   bothers me. That version of OS X hasn't even received a security
>>   update since 2009. For trunk, I'd like to bump the min version to
>>   10.5 (Leopard) and set rpath consistently across platforms.[4] Any
>>   objections?
>> 
>> [1]: https://issues.asterisk.org/jira/browse/ASTERISK-20407
>> [2]: https://issues.asterisk.org/jira/secure/attachment/44760/ASTERISK-20407-fix-11.diff
>> [3]: https://reviewboard.asterisk.org/r/2132
>> [4]: https://issues.asterisk.org/jira/secure/attachment/44761/ASTERISK-20407-fix-trunk.diff
>> 
>> Thanks!
>> -- 
>> David M. Lee
>> Digium, Inc. | Software Developer
>> 445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
>> Check us out at:  www.digium.com  & www.asterisk.org
>> 
>> 
>> --
>> _____________________________________________________________________
>> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>> 
>> asterisk-dev mailing list
>> To UNSUBSCRIBE or update options visit:
>>   http://lists.digium.com/mailman/listinfo/asterisk-dev
> 
> -- 
>               Tzafrir Cohen
> icq#16849755              jabber:tzafrir.cohen at xorcom.com
> +972-50-7952406           mailto:tzafrir.cohen at xorcom.com
> http://www.xorcom.com  iax:guest at local.xorcom.com/tzafrir
> 
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> 
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-dev




More information about the asterisk-dev mailing list