[tlbuild] PostScript support in dvisvgm for darwin(legacy)

Mojca Miklavec mojca.miklavec.lists at gmail.com
Sat Mar 17 12:23:29 CET 2018


Dear Martin,

On 17 March 2018 at 10:25, Martin Gieseking wrote:
>
>> Can you please point me to the code that searches for the library? I
>> would like to have a minimum (non)working example, so that I can
>> potentially ask others for help or at least experiment with super
>> simple and fast commands.
>
> Sure. The Mac-related code was provided by Toby Fleming. See
> https://github.com/mgieseki/dvisvgm/issues/66
>
> His patch adapted the function get_libgs located in src/Ghostscript.cpp
> to look for libgs.N.dylib additionally to libgs.so.N. The code that
> actually loads the specified library and its functions is encapsulated
> in class DLLoader (src/DLLoader.{hpp,cpp}).
>
> Hope this helps a little further.

Thank you.

This explains a few things.

Firstly: the patch probably works out of the box for HomeBrew because
they use a different prefix by default.
Secondly: I see that you are using a plain dlopen() which requires
some environmental variables to be set:

https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man3/dlopen.3.html

When path does not contain a slash character (i.e. it is just a leaf
name), dlopen() searches the fol-lowing following
     lowing until it finds a compatible Mach-O file: $LD_LIBRARY_PATH,
$DYLD_LIBRARY_PATH, current working
     directory, $DYLD_FALLBACK_LIBRARY_PATH.

If DYLD_FALLBACK_LIBRARY_PATH is not set, dlopen operates as if
DYLD_FALLBACK_LIBRARY_PATH was
     set to $HOME/lib:/usr/local/lib:/usr/lib.

I feel a bit uncomfortable asking users to set $LD_LIBRARY_PATH. It
would be nice to provide some other checks, but I need to think about
it a bit.

Mojca


More information about the tlbuild mailing list