Linux安装OSRA遇到的坑

环境:Ubuntu16 64位

OSRA官网:

https://cactus.nci.nih.gov/osra/#2 

以下是OSRA里README的安装流程,作为我们安装的参考

Compilation:



General notes: 

Potrace (as of version 1.9) can install libpotrace.a and potracelib.h files. Run ./configure --with-libpotrace;make;make install 

or ./configure --with-libpotrace --disable-shared... for static only library.



GOCR compilation (use the patched version from OSRA website: ./configure; make libs; make install.



GraphicsMagick++-config should be in the PATH.

Depending on your installation you might also have to set up LD_LIBRARY_PATH to include /usr/local/lib.



TCLAP:

./configure; make; make install



OCRAD:

if compiling libosra later on - 

./configure CXXFLAGS=-fPIC LDFLAGS=-fPIC

otherwise - 

./configure

then -  

make; make install



libosra: You can create a library version of OSRA (libosra.a and one of the

following - libosra.so, libosra.dylib, or libosra.dll) by adding

--enable-lib command-line option to ./configure



libosra_java: set up JAVA_HOME environment variable and use --enable-java

option to configure. See addons/java/net/sf/osra/ and

addons/lib_java_sample/net/sf/osra/ on examples of usage.

If you're not getting any output try setting up LD_PRELOAD environment

variable:

LD_PRELOAD=/usr/local/lib/libopenbabel.so $JAVA_HOME/bin/java TestOsra

(taken from openbabel-2.3.0/scripts/java/README).

=========================================================================

Compiling on Linux/Unix systems:



If compiling GraphicsMagick from source check the output of configure run to make sure all of the important image formats are

getting configured (PNG, JPEG, TIFF) and that it finds GhostScript (gs).

On Linux you might want to use:

./configure --enable-shared

make

make install



Unpack OSRA package. Starting with 1.3.7 the build process is simplified to the common procedure:

./configure

make

make install



You can now optionally add Tesseract (2.0 for OSRA-1.3.7, 3.0 for OSRA-1.3.8, 3.01 for OSRA-1.3.9)  and Cuneiform OCR engines to OSRA. For Tesseract simply run configure

with:

./configure --with-tesseract 

assuming it's installed in a common location. For Cuneiform

(cuneiform-linux-1.1.0) it is now simply:

./configure --with-cuneiform 

You might have to add the path to the libraries to LD_LIBRARY_PATH.

***************************************************分割线******************************************************************

首先安装zlib:

http://www.zlib.net/ 下载源码

./configure 

make 

sudo make install

依赖安装:

GraphicsMagick

ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/

下载源码 GraphicsMagick-LATEST.tar.gz

http://www.graphicsmagick.org/INSTALL-unix.html

用tar -xzvf解压

./configure

可能需要安装c++, sudo apt-get install g++

make

sudo make install


potrace

http://potrace.sourceforge.net/#downloading 下载源码

./configure --with-libpotrace

make 

sudo make install

gocr

https://cactus.nci.nih.gov/osra/#6 


下载源码

./configure


照README里的过程编译OSRA有这样的错,可能是./configure某个选项 类似于--enable-shared 没有开启,这里我没找到,我们有替代方法

我们进入gocr的src文件夹,在./configure之后,修改


CC=gcc 后面加上 -fPIC  ,保存 ,然后退回到gocr的文件夹里

make libs

sudo make install

tclap:

https://sourceforge.net/projects/tclap/files/ 下载源码

./configure

make 

sudo make install

ocrad:

http://mirrors.ustc.edu.cn/gnu/ocrad/ 下载源码

./configure CXXFLAGS=-fPIC LDFLAGS=-fPIC

make 

sudo make install

openbabel:

        我用的是 sudo apt-get install libopenbabel-dev,因为下面的过程我安装过程中编译OSRA有错

https://sourceforge.net/projects/openbabel/files/openbabel/ 下载源码

mkdir build

cd build

sudo apt-get install cmake

cmake ..

make -j2

sudo make install 

最后开始安装我们的OSRA:

./configure --enable-lib --enable-java 出现如下错误


解决方法

sudo apt-get install libgraphicsmagick++1-dev

./configure --enable-lib

(也可 ./configure --enable-lib --enable-java  添加java支持,这需要安装好java并且设置好环境变量)

sudo make all install

出现如下错误


这是由于代码错误

在你的 osra-1.4.0/src/osra_grayscale.cpp的第270行和275出错的行找到


把里面的7都改成  7.0 

保存后重新 sudo make all install

效果图:

编译成功后

测试:

我们用OSRA官网上的图



我们用分子图测试,结果如下

至此安装完成。




猜你喜欢

转载自blog.csdn.net/SiYueDePuTaoShu/article/details/80722853