LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   libstdc++ error during tesseract compilation (https://www.linuxquestions.org/questions/linux-newbie-8/libstdc-error-during-tesseract-compilation-4175608380/)

shahrukhsatti21 06-22-2017 05:42 AM

libstdc++ error during tesseract compilation
 
Hi,
I am compiling tesseract 4.00 at oracle linux 6.8 following these steps.
Code:

git clone https://github.com/tesseract-ocr/tesseract.git

cd tesseract

./autogen.sh

PKG_CONFIG_PATH=/usr/local/lib/pkgconfig LIBLEPT_HEADERSDIR=/usr/local/include ./configure --with-extra-includes=/usr/local/include --with-extra-libraries=/usr/local/lib

LDFLAGS="-L/usr/local/lib" CFLAGS="-I/usr/local/include" make

sudo make install

sudo ldconfig

The pre-built version of gcc (gcc-4.4) does not support c++11 (which is essential for tesseract compilation) so I had to compile gcc-6.3. While compiling tesseract, ./autogen.sh and ./configure went good without errors but "make" step shows following error:
Code:

/usr/local/lib/../lib/libstdc++.so: could not read symbols: File in wrong format
collect2: error: ld returned 1 exit status

Kindly help me with this.
Thanks.

knudfl 06-22-2017 06:50 AM

Welcome to LQ.
Quote:

The pre-built version of gcc (gcc-4.4)
That's the CentOS 6.9 / Oracle 6.x system compiler, gcc-4.4.7 .

Please use gcc-5.3 for CentOS 6.9 / RHEL 6.9 : Comes with internal {libstdc++ libgomp libgcc_s}
→ gcc53-c++-5.3.0-1.el6.x86_64.rpm
https://drive.google.com/file/d/0B7S...ew?usp=sharing
# cd Downloads/ && yum install ./gcc53-c++-5.3.0-1.el6.x86_64.rpm
exit
cd tesseract/
make distclean
export CC=gcc53 CXX=g++53 && ./configure --options

-

shahrukhsatti21 06-22-2017 07:12 AM

Quote:

Originally Posted by knudfl (Post 5725583)
Welcome to LQ.

That's the CentOS 6.9 / Oracle 6.x system compiler, gcc-4.4.7 .

Please use gcc-5.3 for CentOS 6.9 / RHEL 6.9 : Comes with internal {libstdc++ libgomp libgcc_s}
→ gcc53-c++-5.3.0-1.el6.x86_64.rpm
https://drive.google.com/file/d/0B7S...ew?usp=sharing
# cd Downloads/ && yum install ./gcc53-c++-5.3.0-1.el6.x86_64.rpm
exit
cd tesseract/
make distclean
export CC=gcc53 CXX=g++53 && ./configure --options

-

Thanks knudfl,
Upon drilling deeper, I've found out that I'll have to change the default libstdc++. When I run
Code:

/sbin/ldconfig -p | grep stdc++
Result is
Code:

/usr/lib64/libstdc++.so.5
. Which shows version 5 is currently default libstdc++. I can see version 6 files too in /usr/local/lib64 which, I believe, came internal with the compilation of gcc 6.3. Would you help me change this default lib? Your suggestion is good too but I want to make sure if this works. It might prevent gcc-5.3 compilation. Thanks again.

knudfl 06-22-2017 07:27 AM

Re #3.
Quote:

/usr/lib64/libstdc++.so.5
Can't be right that you have no libstdc++.so.6 ? Then no firefox etc. ?
→ # yum install gcc-c++
It's not about "change": You can have both (all) versions of libstdc++.


About gcc53-c++-5.3.0-1.el6.x86_64 : Time stamp = Jul 22 2016.
Is well tested as "CentOS 6 / RHEL 6 extra compiler".
Anyone on the internet can download it.
And does OK with tesseract :
Code:

libtool: link: g++53 -g -O2 -std=c++11 -o .libs/tesseract tesseract-tesseractmain.o -fopenmp  ./.libs/libtesseract.so /usr/local/gcc53/lib/../lib64/libstdc++.so /usr/lib64/liblept.so -lm -lz -lpng -ljpeg -lgif -ltiff -lrt -lpthread -fopenmp -Wl,-rpath -Wl,/usr/local/lib -Wl,-rpath -Wl,/usr/local/gcc53/lib/../lib64
make[2]: Leaving directory '/home/knudfl/tmp/tesseract/api'
Making all in .
make[2]: Entering directory '/home/knudfl/tmp/tesseract'
make[2]: Leaving directory '/home/knudfl/tmp/tesseract'
Making all in tessdata
make[2]: Entering directory '/home/knudfl/tmp/tesseract/tessdata'
Making all in configs
make[3]: Entering directory '/home/knudfl/tmp/tesseract/tessdata/configs'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/knudfl/tmp/tesseract/tessdata/configs'
Making all in tessconfigs
make[3]: Entering directory '/home/knudfl/tmp/tesseract/tessdata/tessconfigs'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/knudfl/tmp/tesseract/tessdata/tessconfigs'
make[3]: Entering directory '/home/knudfl/tmp/tesseract/tessdata'
make[3]: Nothing to be done for 'all-am'.
make[3]: Leaving directory '/home/knudfl/tmp/tesseract/tessdata'
make[2]: Leaving directory '/home/knudfl/tmp/tesseract/tessdata'
Making all in doc
make[2]: Entering directory '/home/knudfl/tmp/tesseract/doc'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/knudfl/tmp/tesseract/doc'
make[1]: Leaving directory '/home/knudfl/tmp/tesseract'

( That's the last lines in the 'make' sequence.)

-

shahrukhsatti21 07-22-2017 03:29 PM

Hi, I'm sorry I was away for exams and other commitments.
"make distclean" is unsuccessful stating "leptonica 1.74 or higher version is required". Did you have libtiff5, libpng12 and libjpeg8 already which are mentioned as prereqs in tesseract compilation doc? I can't find them at yum and epel repos and only older versions are available. Leptonica compilation is done without errors but I guess unavailability of prereq libs could be the reason for unsuccessful distclean or may be not. Just in case you needed to know I'm trying to OCR vehicle license plates as part of my school project. Would distribute output in HDFS files.
Thanks!

shahrukhsatti21 07-24-2017 03:40 PM

Quote:

Originally Posted by knudfl (Post 5725645)
Re #3.


( That's the last lines in the 'make' sequence.)

-

Just in case you didn't see the reply #5.


All times are GMT -5. The time now is 04:20 AM.