How to install Uniconvertor (command-line app) on Mac OS 10.7.2 (Lion)?

Uniconvertor is a command-line tool that shares code with the sK1 Project. it's used to convert from one type of vector graphic file to another like this:

uniconvertor before.eps after.svg

I'm looking for a step by step solution to install this tool on my laptop.

A similar question posted on the Uniconvertor Forum back in August is still unanswered.

I read about Uniconvertor in an answer posted by Neil but don't understand how to send him a message directly for more details.


Solution 1:

I have Lion with MacPorts installed packages.

I will describe here all what I did to make compilation work. May be some steps are unnecessary, maybe some additionnal libraries will have to be installed (using MacPorts) prior to sk1libs or uniconvertor compilation to make it work.

My answer is based on @bitboxer's answer with some additions.

Downloads

I used the links provided here: http://sk1project.org/modules.php?name=Products&product=uniconvertor&op=download

Downloaded and extracted uniconvertor and sk1libs

sk1libs installation

First try

I first ran the following:

$ export LDFLAGS="-L/usr/X11/lib"
$ export CFLAGS="-I/usr/X11/include -I/usr/X11/include/freetype2 -I/usr/X11/include/libpng15"
$ python setup.py build

Please notice that the libpng version is 15 (not 12 as in @bitboxer's answer). I noticed this searching in /usr/X11/include directory.

Which gave some errors:

ld: library not found for -llcms
collect2: ld returned 1 exit status
ld: library not found for -llcms
collect2: ld returned 1 exit status
lipo: can't open input file: /var/folders/3w/5x6f3w0n4rg0w6sdq2n_48j00000gn/T//cc8y3Erh.out (No such file or directory)
error: command 'llvm-gcc-4.2' failed with exit status 1

Troubleshooting

So I tried to figure out if I had already lcms library installed:

$ locate lcms
...
/opt/local/include/lcms.h
...
/opt/local/lib/liblcms.a
....

lcms was installed by MacPort on my computer (lcms seems to be a dependency of Inkscape).

Second try: success

So I did this:

$ export LDFLAGS="-L/usr/X11/lib -L/opt/local/lib/"
$ export CFLAGS="-I/usr/X11/include -I/usr/X11/include/freetype2 -I/usr/X11/include/libpng15 -I/opt/local/include"

Which added the MacPorts include and lib dir to compilation flags.

Then:

$ python setup.py build

Which ended with no errors (but some warnings).

Then:

$ sudo python setup.py install

Uniconvertor installation

Same thing (I ran it just after sk1libs compilation, so LDFLAGS and CFLAGS value are the same):

$ python setup.py build
$ sudo python setup.py install

Solution 2:

Download sk1libs and uniconvertor and extract it. Open Terminal.app and go into the sk1libs dir. Execute this:

export LDFLAGS="-L/usr/X11/lib"
export CFLAGS="-I/usr/X11/include -I/usr/X11/include/freetype2 -I/usr/X11/include/libpng12"
python setup.py build
sudo python setup.py install

After that go into the uniconvert dir and do the same. That should do the trick.

You may get an error like this:

In file included from src/imaging/libimagingft/_imagingft.c:31: /usr/local/include/ft2build.h:56:10: fatal error: 'freetype/config/ftheader.h' file not found

You can fix it with symbolic link - execute this command:

sudo ln -s /usr/local/include/freetype2/freetype/ /usr/include/freetype