[libbluray-devel] improve dlopen on osx

Nathan Hjelm hjelmn at mac.com
Sat Aug 11 08:58:34 CEST 2012


On Aug 10, 2012, at 4:19 PM, Rafaël Carré <funman at videolan.org> wrote:

> Le 2012-08-10 22:53, Nathan Hjelm a écrit :
>> With the current version of VLC (2.0.3) users can not simply drop libaacs.dylib into VLC.app/Contents/MacOS/lib. As far as I can tell this is because neither @loader_path/../lib (@loader_path references from the location of the Mach-O binary that is calling dlopen. In this case VLC.app/Contents/MacOS/plugins/) or @executable_path/lib (@executable_path references from the current running executable: VLC.app/Contents/MacOS) are part of the default search path for dynamically loaded libraries. Now this can be fixed in several ways including:
>> 
>> 1) VLC adds @loader_path/../lib to the rpath of liblibbluray_plugin.dylib (install_name_path -add_rpath @loader_path/../lib liblibbluray_plugin.dylib),
>> 2) VLC adds @executable_path/lib to the rpath of VLC executable (install_name_path -add_rpath @executable_path/../lib VLC), or
>> 3) update libbluray.dylib to search for libaacs and libbbdplus through some common paths if libaacs.dylib can't be found in the default path.
>> 
>> I think #3 is a more general fix for to the loading problem and a patch vs the latest tarball (0.2.2) is attached.
>> 
>> Thoughts?
> 
> 3) is a good idea IMO, although I'm not sure we should specifically
> mention VLC; other applications can use libbluray as well?

I can update the patch without that wording in the comment. I can make it more general to point out the common locations an app might put libaacs.dylib or libbdplus.dylib (Contents/MacOS/lib, Contents/MacOS, Contents/lib, etc).

> Does anyone know another app using it? Where in the .app would they put
> libbluray.dylib?

I don't know about other apps but it just occurred to me libaacs likely would be in the same directory as either the executable or libbluray.dylib so I probably should add @executable_path and @loader_path to the list of search paths.

I will post an updated patch tomorrow (it is a bit late in my time zone-- GMT-6).

> Your patch looks OK at a quick glance.
> 
>> 
>> -Nathan
>> 
>> FYI, I will be posting another patch to the libaacs devel list to add support for IOKit to libaacs.
> 
> Nice, I look forward to it.

Posted! Might need some small changes as well but it works!

-Nathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/libbluray-devel/attachments/20120811/1efb4f77/attachment.html>


More information about the libbluray-devel mailing list