62mkv
62mkv

Reputation: 1542

How to properly install Ghostscript under Linux as shared library

The link on this page (https://www.ghostscript.com/download.html) for Linux x64, gets you a .tgz with an executable binary.

However, while trying to use this binary as an .so, (after renaming it into libgs.so and putting into appropriate place) via Ghost4J, I invariably get errors as follows:

java.lang.UnsatisfiedLinkError: /tmp/jna-100923095/jna3513656669313044092.tmp: cannot dynamically load executable

Once I install the Ghostscript via apt-get install ghostscript, the same code runs fine (as it now loads an .so from /usr/lib/x86_64-linux-gnu/libgs.so.9.22)

Question: which minimal set of files should I put to some folder, so that I could link to Ghostscript dynamic library (.so) successfully, without Ghostscript being installed on the machine/container?

UPD: under Windows, this seems to be possible, the /bin folder of the installation contains both DLL and EXE files; if I put that .dll file into a win32-x86-64 folder under resources, it is being picked up by JNA (via Ghost4j) and Ghostscript instance works fine, even once I remove the "official" installation). I would like to have same behaviour (i.e. self-sufficient, self-containing JAR file) for Linux as well.

Upvotes: 1

Views: 1929

Answers (1)

62mkv
62mkv

Reputation: 1542

Well, I ended up building the shared object myself, using Ubuntu 18.04 installed as WSL 1 distribution, following the guidelines from here: https://www.ghostscript.com/doc/current/Make.htm#Shared_object

These were the exact commands:

./configure --without-luratech --with-system-libtiff --with-drivers=PCLXL
make so

and then, in the sobin folder, you have libgs.so, that works as expected. But sad it's not possible to download it from the official site.

Upvotes: 0

Related Questions