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

Martin Gieseking martin.gieseking at uos.de
Sat Mar 17 10:25:45 CET 2018


Dear Mojca,

> On 15 March 2018 at 14:26, Martin Gieseking wrote:
>> If you don't link libgs directly, dvisvgm tries to dlopen the library.
>> Therefore, libgs must be located in a directory that is part of the ld
>> search path. Otherwise, it's necessary to specify the location via
>> command-line option --libgs or environment variable LIBGS. It's almost the
>> same on Windows except that the Ghostscript DLL is looked up through the
>> executable's search PATH.
> 
> How could I add some path to the search path (on macOS)?
> The --libgs flag apparently helps, but it's annoying to have to
> specify it each time when the user wants to run dvisvgm.
> Not that this would always help, but we could at least add the default
> path of MacPorts and HomeBrew (the one from HomeBrew might already
> work out of the box, I'm not eager to check right now though).

I agree that option --libgs can only be a fallback if nothing else works
reliably. Setting environment variable LIBGS in .bashrc or the like
could be a less annoying alternative.

Unfortunately, I don't know how to add paths or libraries to the search
mechanism of the dynamic linker on Mac OS. Maybe some Mac
users/developers of the TL team can help here?


> 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.

Best,
Martin


More information about the tlbuild mailing list