Corporal
Corporal

Reputation: 157

Adding a dylib to the search path on OSX

I have a project in which I need to convert PDF file into png using ghost4j. The issue I am facing is that when I run my java code the console throws me this error:

Unable to load library 'gs': dlopen(libgs.dylib, 9): image not found

I googled this error and found that I also need to install ghost script and make some changes in the file libgs.dylib. I have installed ghost script using Mac Port but I am not able to find where this file libgs.dylib is located on my file system. I am clueless what to do next. Need Help.

-PS I am using Mac OS X 10.9.2 as my development environment.

Upvotes: 0

Views: 1906

Answers (1)

Jason C
Jason C

Reputation: 40376

From https://github.com/zippy1978/ghost4j/issues/29:

Setting LD_LIBRARY_PATH helped:

$ port install ghostscript
$ port contents ghostscript | grep libgs
  /opt/local/lib/libgs.9.10.dylib
  /opt/local/lib/libgs.9.dylib
  /opt/local/lib/libgs.dylib
$ export LD_LIBRARY_PATH=/opt/local/lib

Use whatever path the port contents command reveals.

To make the changes permanent, you'll have to add it to LD_LIBRARY_PATH permanently. I don't know how to do that on OSX, as I am not a Mac user, but it is an easy thing to find out on the internet.

See also search results for "osx install libgs.dylib".

Upvotes: 0

Related Questions