How can i use ghost4j on OS X 10.9

馋奶兔 提交于 2019-12-31 05:12:28

问题


When i want to use ghost4j on OS X 10.9, i see this error:

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

I have installed ghostscript library on my macbook using this site. how can i fix this problem. I can not install ghostscript using port and brew for some reason.


回答1:


First you need to find the file libgs.dylib which was installed by the installer package compile the libgs.dylib library from source, and make a note of where you installed it to.

Hopefully it should have been installed to a standard library location, and there should be nothing more you need to do. If not, you need to set the environment variable DYLD_LIBRARY_PATH. In a terminal this would be done by typing export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/directory, replacing /directory with the full path of the actual directory containing libgs.dylib. After typing this, in that terminal, if you run your application, it should work. To make it take effect permanently you would need to add the export command to your ~/.bash_profile. Or to make it take effect for all user accounts on your computer, you could add it to your /etc/profile.

If this doesn't work, I suppose the Ghostscript library could be 32-bit - you would need a 64-bit library I think.




回答2:


A bit of an old thread but maybe useful for people still looking for an answer.

Install ghostscript using port

port install ghostscript

That done, you need to create a link so ghost4j finds the dylib.

cd /usr/lib
sudo ln -s /opt/local/lib/libgs.9.10.dylib libgs.dylib

Once I did that it worked like a charm.



来源:https://stackoverflow.com/questions/20823756/how-can-i-use-ghost4j-on-os-x-10-9

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!