Hello everyone,
I'm on Linux, using Tesseract 3.05.01, Leptonica 1.74.4. Building both from source. I have built them with no problem.
What I want to achieve is, statically link leptonica and tesseract to a shared object, which uses the functions from tesseract's API. Following this linkage, I wanted to link this shared object to an executable. Finally, there should be an executable with a shared object and these should not need any other shared object.
I've successfully linked the libraries to shared object(I thought so) but when I try to link to the executable, I see that Leptonica functions are not linked. What am I doing wrong?
The linking of the shared object:
g++ -I. -I/usr/local/include/tesseract -I/usr/local/include/leptonica -std=gnu++11 wrap.cpp /usr/local/lib/liblept.a /usr/local/lib/libtesseract.a -shared -o wrap.so -fPIC -Wl,-Bsymbolic
Linking of the executable:
gcc test.c -o test wrap.so
The error I receive:
wrap.so: undefined reference to `sem_init'
wrap.so: undefined reference to `pixExpandReplicate'
wrap.so: undefined reference to `pixConvertTo8'
wrap.so: undefined reference to `pixGetWpl'
...
...
wrap.so: undefined reference to `pixConvertTo32'
wrap.so: undefined reference to `pixaCreate'
wrap.so: undefined reference to `sem_wait'
collect2: error: ld returned 1 exit status
What should I do to overcome these linkage problems?
I've attached the wrap.cpp, wrap.h and test.c: