RedHat安装Tesseract方式以及遇到升级GCC时遇到的问题和解决办法

来源:互联网 发布:实名淘宝号购买 编辑:程序博客网 时间:2024/05/29 11:42

RedHat安装Tesseract方式以及遇到升级GCC时遇到的问题和解决办法

摘要: 之前在CentOS中安装过Tesseract,遇到很多问题,在RedHat中安装时,直接使用的当时网上找到的一个脚本,相对CentOS要顺利很多,但还是遇到需要了升级gcc的各种问题,在这里对几个主要问题以及解决办法做一下汇总。

安装Tesseract的脚本

引用自:https://github.com/EisenVault/install-tesseract-redhat-centos/blob/master/install-tesseract.sh

cd /optyum -y update yum -y install libstdc++ autoconf automake libtool autoconf-archive pkg-config gcc gcc-c++ make libjpeg-devel libpng-devel libtiff-devel zlib-devel# Install AutoConf-Archivewget ftp://mirror.switch.ch/pool/4/mirror/epel/7/ppc64/a/autoconf-archive-2016.09.16-1.el7.noarch.rpmrpm -i autoconf-archive-2016.09.16-1.el7.noarch.rpm# Install Leptonica from Sourcewget http://www.leptonica.com/source/leptonica-1.74.4.tar.gztar -zxvf leptonica-1.74.4.tar.gzcd leptonica-1.74.4./autobuild./configuremakemake installcd ..# Install Tesseract from Sourcewget https://github.com/tesseract-ocr/tesseract/archive/3.05.01.tar.gztar -zxvf 3.05.01.tar.gzcd tesseract-3.05.01./autogen.shPKG_CONFIG_PATH=/usr/local/lib/pkgconfig LIBLEPT_HEADERSDIR=/usr/local/include ./configure --with-extra-includes=/usr/local/include --with-extra-libraries=/usr/local/libLDFLAGS="-L/usr/local/lib" CFLAGS="-I/usr/local/include" makemake installldconfigcd ..# Download and install tesseract language fileswget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/ben.traineddatawget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/eng.traineddatawget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/hin.traineddatawget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/tha.traineddatawget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/osd.traineddatamv *.traineddata /usr/local/share/tessdata# Download Hindi Cube datawget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/hin.cube.bigramswget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/hin.cube.foldwget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/hin.cube.lmwget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/hin.cube.nnwget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/hin.cube.paramswget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/hin.cube.word-freqwget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/hin.tesseract_cube.nnmv hin.* /usr/local/share/tessdataln -s /opt/tesseract-3.05.01 /opt/tesseract-latest

升级gcc问题记录

在RedHat中安装Tesseract可能遇到gcc需要升级的问题,安装gcc又会发现一堆问题,以下针对需要升级gcc以及出现的问题做了汇总:

  • 问题1、安装Tesseract报错:linux Your compiler does not have the necessary c++11 support!

    解决办法:升级GCC版本。

  • 问题2、configure: error: source directory already configured; run "make distclean" there first

    解决办法:编译不要在gcc目录下执行,在根目录统计目录创建新文件夹,在新文件夹编译。
    参考自:http://www.bkjia.com/Linuxjc/757160.html

  • 问题3、undefined reference to 'lexer_line'

    解决办法:安装 bison build-essential flex,命令行如下:
    sudo apt-get install bison build-essential flex
    软件包管理是yum,安装build-essential会找不到package。使用如下命令安装:
    build-essential: yum groupinstall "Development Tools"

  • 问题4、error: in '/root/gcc-4.8.2/gcc-build/x86_64-unknown-linux-gnu/libgcc' && 问题5、error: cannot compute suffix of object files: cannot compile

    解决办法:配置/user/local/lib/到环境变量LD_LIBRARY_PATH。
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/user/local/lib/

  • 问题6、fatal error: gnu/stubs-32.h: No such file or directory #include <gnu/stubs-32.h>

    解决办法:安装glibc-devel包。
    yum -y install glibc-devel

  • 问题7、make[2]: *** [all-recursive] Error 1

    解决办法:配置是讲语言设置为c,c++即可。如下:
    ./configure --prefix=/usr/local/gcc-4.6.1 -enable-threads=posix -disable-checking -disable-multilib -enable-languages=c,c++

阅读全文
0 0
原创粉丝点击