How to compile tesseract v4 with special rpath

20 views
Skip to first unread message

Michael Chen

unread,
Apr 10, 2020, 1:31:25 AM4/10/20
to tesseract-ocr
Hi everyone,

I want to use tesseract in my company's file structure. I plan to compile tesseract with it's dependencies (leptonica) and copy over the binary and shared object files (.so) onto a CentOS linux box in a custom folder structure. Our app will be deployed to these linux boxes along with the tesseract binary and .so files.

I am looking to run something like this so that the binary knows how to find the shared library files on my on premise linux box. I need to specify an rpath because I want to use the binary in a different environment and I plan to copy over the `.so` files (as mentioned earlier).

./configure \
--prefix=$tesseract_dir \
--with-extra-libraries=$tesseract_dir/local/lib/ \
--with-rpath='\$$'ORIGIN/../lib \

I took a look at the source code and it seems `with-rpath` is an invalid param and doesn't do anything. (https://github.com/tesseract-ocr/tesseract/blob/master/configure.ac)

Is this possible? I basically want readelf to output the exact following: '\$$'ORIGIN/../lib
Instead I have this:

Screen Shot 2020-04-08 at 7.21.59 PM.png


This is because I had set $tesseract_dir to "/tmp/tesseract".

Is what I'm trying to achieve possible? If so, what should I do? Any tips and guidance is appreciated!


Screen Shot 2020-04-08 at 7.21.59 PM.png

JB Data31

unread,
Apr 10, 2020, 6:21:55 AM4/10/20
to tesser...@googlegroups.com
Another way:
1/ Build a dynamic tesseract
2/ Move bin and .so.
3/ Use LD_LIBRARY_PATH on the target host to set .so paths and execute bin.

@JBΔ



--
You received this message because you are subscribed to the Google Groups "tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tesseract-oc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tesseract-ocr/6dfce719-1d6e-4bd3-bea4-7e1c499bd1b6%40googlegroups.com.

Michael Chen

unread,
Apr 10, 2020, 3:00:43 PM4/10/20
to tesseract-ocr
Thanks for the suggestion! Noob question, what is a "dynamic" tesseract?
To unsubscribe from this group and stop receiving emails from it, send an email to tesser...@googlegroups.com.

林博仁

unread,
Apr 10, 2020, 5:17:52 PM4/10/20
to tesseract-ocr
Hello,

AFAICT the `rpath` setting is only functional during the linking phase but not in the runtime, thus it won't really work as you expected.

The proper solution would be, as JB indicates, to build a dynamically-linked Tesseract, and use the LD_LIBRARY_PATH environment variable to make the dynamic linker load the depending libraries from the right paths.

I'm actually building a Tesseract distribution that ships a launcher that'll automatically done this, however it isn't released yet.

Cheers,
林博仁(Buo-ren, Lin)
Buo.R...@gmail.com
Reply all
Reply to author
Forward
0 new messages