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

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

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

安装Tesseract的脚本

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

cd /opt

yum -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-Archive
wget ftp://mirror.switch.ch/pool/4/mirror/epel/7/ppc64/a/autoconf-archive-2016.09.16-1.el7.noarch.rpm
rpm -i autoconf-archive-2016.09.16-1.el7.noarch.rpm

# Install Leptonica from Source
wget http://www.leptonica.com/source/leptonica-1.74.4.tar.gz
tar -zxvf leptonica-1.74.4.tar.gz
cd leptonica-1.74.4
./autobuild
./configure
make
make install
cd ..

# Install Tesseract from Source
wget https://github.com/tesseract-ocr/tesseract/archive/3.05.01.tar.gz
tar -zxvf 3.05.01.tar.gz
cd tesseract-3.05.01
./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
make install
ldconfig
cd ..

# Download and install tesseract language files
wget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/ben.traineddata
wget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/eng.traineddata
wget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/hin.traineddata
wget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/tha.traineddata
wget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/osd.traineddata
mv *.traineddata /usr/local/share/tessdata

# Download Hindi Cube data
wget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/hin.cube.bigrams
wget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/hin.cube.fold
wget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/hin.cube.lm
wget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/hin.cube.nn
wget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/hin.cube.params
wget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/hin.cube.word-freq
wget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/hin.tesseract_cube.nn
mv hin.* /usr/local/share/tessdata

ln -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++

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值