在 linux 服务器tesseract 3.0.2
库上已正确安装:
[root@XXX as]# rpm -qa | grep ".*tess.*"
tesseract-3.02-alt1.r723
尝试运行tess4j
包装器时,出现此异常:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Error looking up function 'TessBaseAPICreate': /usr/lib64/libtesseract.so.3.0.2: undefined symbol: TessBaseAPICreate
at com.sun.jna.Function.<init>(Function.java:208)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:536)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:513)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:499)
at com.sun.jna.Library$Handler.invoke(Library.java:199)
at com.sun.proxy.$Proxy0.TessBaseAPICreate(Unknown Source)
at net.sourceforge.tess4j.Tesseract.init(Tesseract.java:284)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:219)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:200)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:184)
(... private code ...)
异常文件中提到的存在:
[root@XXX as]# test -e /usr/lib64/libtesseract.so.3.0.2 && echo "Found" || echo "Not found"
Found
tess4j
代码中引发异常的位置如下所示:
/**
* Initializes Tesseract engine.
*/
private void init() {
pageNum = 0;
api = TessAPI.INSTANCE;
handle = api.TessBaseAPICreate(); // ERROR HERE, line #184
api.TessBaseAPIInit2(handle, datapath, language, ocrEngineMode);
api.TessBaseAPISetPageSegMode(handle, psm);
}
我不知道如何解决它,因为所有库版本都相同,它在 Windows 下完美运行。