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

jfbu jfbu at free.fr
Sat Mar 17 11:01:30 CET 2018


Dear Mojca and Martin,

thanks a lot for looking into this.

One piece of information I should have sent to Mojca
but realize only now is that with

$ export LD_LIBRARY_PATH="/opt/local/lib"

the dvisvgm produced by the TeXLive vanilla ./Build
does find the Ghostscript Mac dylib

I have a libgs.9.22.dylib in /opt/local/lib from a MacPorts install
(there is also libgs.dylib which symlinks to it).

I am on 10.9.5 (Darwin 13.4.0)

I found some links on Apple Dev site, which I am inserting here

https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/RunpathDependentLibraries.html#//apple_ref/doc/uid/TP40008306-SW1

https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/UsingDynamicLibraries.html#//apple_ref/doc/uid/TP40002182-SW10

https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/DynamicLibraryUsageGuidelines.html#//apple_ref/doc/uid/TP40001928-SW12

Thanks to all for helping out on this.

As far as I am concerned, I can either set LD_LIBRARY_PATH or alias dvisvgm to
always use --libgs="/opt/local/lib/libgs.9.22.dylib".

I did not realize earlier the LD_LIBRARY_PATH because the MacPorts dvisvgm
does not need it, and although MacPorts uses the dylib's in /opt/local/lib
it does not require the user to set the LD_LIBRARY_PATH in the environment

Best,

Jean-François

Le 17 mars 2018 à 10:25, Martin Gieseking <martin.gieseking at uos.de> a écrit :

> 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