Page 1 of 1

trying to get Horndude77's ruby logo removal script working

Posted: Sat Mar 07, 2009 10:35 am
by kcleung
Hi!

I am running Ubuntu 8.10 on Intel quadcore

I have tried the script, and installed everything (ruby, rubygem, libleptonica 1.6, libtiff4 etc)
However when I try to run the script, the system seems to fail to find the TIFFFdOpen function despite libtiff4 is already installed

abc@Q6600:~/imslp/scripts$ ruby1.9 clean_om_pdf.rb
ruby1.9: symbol lookup error: /usr/lib/liblept.so: undefined symbol: TIFFFdOpen
abc@Q6600:~/imslp/scripts$

How can I get it working again?

ffi seems to be able to load only dynamic libraries (.so). for some reason, liblept (which calls the tiff functions) can't locate the function concerned.

Re: trying to get Horndude77's ruby logo removal script working

Posted: Sat Mar 07, 2009 3:14 pm
by horndude77
Yes, it's not straight forward unfortunately to create a working leptonica shared library. I haven't been able to get the standard leptonica shared library make target to work. So I just convert the .a file into a .so.

Code: Select all

ar -x liblept.a
gcc -shared -ltiff -ljpeg -lpng -lz  -lm *.o -o liblept.so.1.60
Also I haven't tested it yet with ruby 1.9, but I don't see why it wouldn't work.

Re: trying to get Horndude77's ruby logo removal script working

Posted: Sat Mar 07, 2009 7:56 pm
by kcleung
Thanks! This is working now...... but I think we should update README so that users can get the script running properly.

The other problem is that my Ruby can't handle unicode:

For example in file_mapper.rb:

abc@Q6600:~/imslp/scripts$ ruby1.9 clean_om_pdf.rb BIZ01.pdf Cello
clean_om_pdf.rb:5:in `require': /home/abc/imslp/scripts/file_mapper.rb:184: invalid multibyte char (SyntaxError)
/home/abc/imslp/scripts/file_mapper.rb:184: invalid multibyte char
/home/abc/imslp/scripts/file_mapper.rb:184: syntax error, unexpected $end, expecting '}'
"suppco01.pdf" => "Suppé Poet and Peasant Overture",
^
from clean_om_pdf.rb:5:in `<main>'
abc@Q6600:~/imslp/scripts$

Re: trying to get Horndude77's ruby logo removal script working

Posted: Sat Mar 07, 2009 8:29 pm
by kcleung
Oh, I found out that you need to add:

# encoding: utf-8

at the beginning of file_mapper.rb

then everything works

Re: trying to get Horndude77's ruby logo removal script working

Posted: Sat Mar 07, 2009 8:51 pm
by horndude77
I haven't looked into ruby 1.9 much yet so thanks for fixing that encoding gotcha. I'll fix this and the README later today.