# Questions about porting process



## goshanecr (Apr 2, 2017)

Hi friends!

I'm try to port development version of *tesseract-ocr,* and do it regarding to existing graphics/tesseract port.

I write that Makefile (mostly copied from existing):

```
# $FreeBSD$

PORTNAME=       tesseract-devel
PORTVERSION=    4.0.0a
CATEGORIES=     graphics

MAINTAINER=     i.g.e.o@ya.ru
COMMENT=        Development version ot Tesseract-OCR Engine

LICENSE=        APACHE20

LIB_DEPENDS=    liblept.so:graphics/leptonica

USES=           cmake:outsource
USE_LDCONFIG=   yes

USE_GITHUB=     yes
GH_ACCOUNT=     tesseract-ocr
GH_PROJECT=     tesseract
GH_TAGNAME=     362b68ecfd83f975fb0aa2d59c900e98be54373b

CONFIGURE_ENV=  LIBLEPT_HEADERSDIR="${LOCALBASE}/include/leptonica"

DATADIR=        ${PREFIX}/share/tessdata
PORTDATA=       *
PORTDOCS=       AUTHORS ChangeLog README.md
INSTALL_TARGET= install-strip

.include <bsd.port.mk>
```

But after command: 
`make` it configures, builds and in the end failed with linking error:


```
[ 98%] Building CXX object CMakeFiles/libtesseract.dir/api/pdfrenderer.cpp.o
/usr/bin/c++   -DHAVE_CONFIG_H -DTESS_EXPORTS -DUSE_STD_NAMESPACE=1 -DWINDLLNAME=\"libtesseract400.dll\" -D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS=1 -Dlibtesseract_EXPORTS -I/usr/local/include/leptonica -I/usr/ports/graphics/tesseract-devel/work/.build -I/usr/ports/graphics/tesseract-devel/work/tesseract-362b68ecfd83f975fb0aa2d59c900e98be54373b/api -I/usr/ports/graphics/tesseract-devel/work/tesseract-362b68ecfd83f975fb0aa2d59c900e98be54373b/arch -I/usr/ports/graphics/tesseract-devel/work/tesseract-362b68ecfd83f975fb0aa2d59c900e98be54373b/ccmain -I/usr/ports/graphics/tesseract-devel/work/tesseract-362b68ecfd83f975fb0aa2d59c900e98be54373b/ccstruct -I/usr/ports/graphics/tesseract-devel/work/tesseract-362b68ecfd83f975fb0aa2d59c900e98be54373b/ccutil -I/usr/ports/graphics/tesseract-devel/work/tesseract-362b68ecfd83f975fb0aa2d59c900e98be54373b/classify -I/usr/ports/graphics/tesseract-devel/work/tesseract-362b68ecfd83f975fb0aa2d59c900e98be54373b/cutil -I/usr/ports/graphics/tesseract-devel/work/tesseract-362b68ecfd83f975fb0aa2d59c900e98be54373b/dict -I/usr/ports/graphics/tesseract-devel/work/tesseract-362b68ecfd83f975fb0aa2d59c900e98be54373b/lstm -I/usr/ports/graphics/tesseract-devel/work/tesseract-362b68ecfd83f975fb0aa2d59c900e98be54373b/opencl -I/usr/ports/graphics/tesseract-devel/work/tesseract-362b68ecfd83f975fb0aa2d59c900e98be54373b/textord -I/usr/ports/graphics/tesseract-devel/work/tesseract-362b68ecfd83f975fb0aa2d59c900e98be54373b/vs2010/port -I/usr/ports/graphics/tesseract-devel/work/tesseract-362b68ecfd83f975fb0aa2d59c900e98be54373b/viewer -I/usr/ports/graphics/tesseract-devel/work/tesseract-362b68ecfd83f975fb0aa2d59c900e98be54373b/wordrec -O2 -pipe -march=opteron-sse3 -fstack-protector -fno-strict-aliasing --std=c++11 -O2 -pipe -march=opteron-sse3 -fstack-protector -fno-strict-aliasing -fPIC -o CMakeFiles/libtesseract.dir/api/pdfrenderer.cpp.o -c /usr/ports/graphics/tesseract-devel/work/tesseract-362b68ecfd83f975fb0aa2d59c900e98be54373b/api/pdfrenderer.cpp
--- liblibtesseract.so.4.0.0 ---
[ 99%] Linking CXX shared library liblibtesseract.so
/usr/local/bin/cmake -E cmake_link_script CMakeFiles/libtesseract.dir/link.txt --verbose=1
/usr/bin/c++  -fPIC -O2 -pipe -march=opteron-sse3 -fstack-protector -fno-strict-aliasing --std=c++11 -O2 -pipe -march=opteron-sse3 -fstack-protector -fno-strict-aliasing  -fstack-protector -shared -Wl,-soname,liblibtesseract.so.4.0.0 -o liblibtesseract.so.4.0.0 CMakeFiles/libtesseract.dir/arch/dotproductavx.cpp.o CMakeFiles/libtesseract.dir/arch/dotproductsse.cpp.o CMakeFiles/libtesseract.dir/arch/simddetect.cpp.o CMakeFiles/libtesseract.dir/ccmain/adaptions.cpp.o CMakeFiles/libtesseract.dir/ccmain/applybox.cpp.o CMakeFiles/libtesseract.dir/ccmain/control.cpp.o CMakeFiles/libtesseract.dir/ccmain/docqual.cpp.o CMakeFiles/libtesseract.dir/ccmain/equationdetect.cpp.o CMakeFiles/libtesseract.dir/ccmain/fixspace.cpp.o CMakeFiles/libtesseract.dir/ccmain/fixxht.cpp.o CMakeFiles/libtesseract.dir/ccmain/linerec.cpp.o CMakeFiles/libtesseract.dir/ccmain/ltrresultiterator.cpp.o CMakeFiles/libtesseract.dir/ccmain/osdetect.cpp.o CMakeFiles/libtesseract.dir/ccmain/output.cpp.o CMakeFiles/libtesseract.dir/ccmain/pageiterator.cpp.o CMakeFiles/libtesseract.dir/ccmain/pagesegmain.cpp.o CMakeFiles/libtesseract.dir/ccmain/pagewalk.cpp.o CMakeFiles/libtesseract.dir/ccmain/par_control.cpp.o CMakeFiles/libtesseract.dir/ccmain/paragraphs.cpp.o CMakeFiles/libtesseract.dir/ccmain/paramsd.cpp.o CMakeFiles/libtesseract.dir/ccmain/pgedit.cpp.o CMakeFiles/libtesseract.dir/ccmain/recogtraining.cpp.o CMakeFiles/libtesseract.dir/ccmain/reject.cpp.o CMakeFiles/libtesseract.dir/ccmain/resultiterator.cpp.o CMakeFiles/libtesseract.dir/ccmain/superscript.cpp.o CMakeFiles/libtesseract.dir/ccmain/tessbox.cpp.o CMakeFiles/libtesseract.dir/ccmain/tessedit.cpp.o CMakeFiles/libtesseract.dir/ccmain/tesseractclass.cpp.o CMakeFiles/libtesseract.dir/ccmain/tessvars.cpp.o CMakeFiles/libtesseract.dir/ccmain/tfacepp.cpp.o CMakeFiles/libtesseract.dir/ccmain/thresholder.cpp.o CMakeFiles/libtesseract.dir/ccmain/werdit.cpp.o CMakeFiles/libtesseract.dir/ccstruct/blamer.cpp.o CMakeFiles/libtesseract.dir/ccstruct/blobbox.cpp.o CMakeFiles/libtesseract.dir/ccstruct/blobs.cpp.o CMakeFiles/libtesseract.dir/ccstruct/blread.cpp.o CMakeFiles/libtesseract.dir/ccstruct/boxread.cpp.o CMakeFiles/libtesseract.dir/ccstruct/boxword.cpp.o CMakeFiles/libtesseract.dir/ccstruct/ccstruct.cpp.o CMakeFiles/libtesseract.dir/ccstruct/coutln.cpp.o CMakeFiles/libtesseract.dir/ccstruct/detlinefit.cpp.o CMakeFiles/libtesseract.dir/ccstruct/dppoint.cpp.o CMakeFiles/libtesseract.dir/ccstruct/fontinfo.cpp.o CMakeFiles/libtesseract.dir/ccstruct/genblob.cpp.o CMakeFiles/libtesseract.dir/ccstruct/imagedata.cpp.o CMakeFiles/libtesseract.dir/ccstruct/linlsq.cpp.o CMakeFiles/libtesseract.dir/ccstruct/matrix.cpp.o CMakeFiles/libtesseract.dir/ccstruct/mod128.cpp.o CMakeFiles/libtesseract.dir/ccstruct/normalis.cpp.o CMakeFiles/libtesseract.dir/ccstruct/ocrblock.cpp.o CMakeFiles/libtesseract.dir/ccstruct/ocrpara.cpp.o CMakeFiles/libtesseract.dir/ccstruct/ocrrow.cpp.o CMakeFiles/libtesseract.dir/ccstruct/otsuthr.cpp.o CMakeFiles/libtesseract.dir/ccstruct/pageres.cpp.o CMakeFiles/libtesseract.dir/ccstruct/params_training_featdef.cpp.o CMakeFiles/libtesseract.dir/ccstruct/pdblock.cpp.o CMakeFiles/libtesseract.dir/ccstruct/points.cpp.o CMakeFiles/libtesseract.dir/ccstruct/polyaprx.cpp.o CMakeFiles/libtesseract.dir/ccstruct/polyblk.cpp.o CMakeFiles/libtesseract.dir/ccstruct/publictypes.cpp.o CMakeFiles/libtesseract.dir/ccstruct/quadlsq.cpp.o CMakeFiles/libtesseract.dir/ccstruct/quspline.cpp.o CMakeFiles/libtesseract.dir/ccstruct/ratngs.cpp.o CMakeFiles/libtesseract.dir/ccstruct/rect.cpp.o CMakeFiles/libtesseract.dir/ccstruct/rejctmap.cpp.o CMakeFiles/libtesseract.dir/ccstruct/seam.cpp.o CMakeFiles/libtesseract.dir/ccstruct/split.cpp.o CMakeFiles/libtesseract.dir/ccstruct/statistc.cpp.o CMakeFiles/libtesseract.dir/ccstruct/stepblob.cpp.o CMakeFiles/libtesseract.dir/ccstruct/vecfuncs.cpp.o CMakeFiles/libtesseract.dir/ccstruct/werd.cpp.o CMakeFiles/libtesseract.dir/ccutil/ambigs.cpp.o CMakeFiles/libtesseract.dir/ccutil/basedir.cpp.o CMakeFiles/libtesseract.dir/ccutil/bits16.cpp.o CMakeFiles/libtesseract.dir/ccutil/bitvector.cpp.o CMakeFiles/libtesseract.dir/ccutil/ccutil.cpp.o CMakeFiles/libtesseract.dir/ccutil/clst.cpp.o CMakeFiles/libtesseract.dir/ccutil/elst.cpp.o CMakeFiles/libtesseract.dir/ccutil/elst2.cpp.o CMakeFiles/libtesseract.dir/ccutil/errcode.cpp.o CMakeFiles/libtesseract.dir/ccutil/globaloc.cpp.o CMakeFiles/libtesseract.dir/ccutil/indexmapbidi.cpp.o CMakeFiles/libtesseract.dir/ccutil/mainblk.cpp.o CMakeFiles/libtesseract.dir/ccutil/memry.cpp.o CMakeFiles/libtesseract.dir/ccutil/params.cpp.o CMakeFiles/libtesseract.dir/ccutil/scanutils.cpp.o CMakeFiles/libtesseract.dir/ccutil/serialis.cpp.o CMakeFiles/libtesseract.dir/ccutil/strngs.cpp.o CMakeFiles/libtesseract.dir/ccutil/tessdatamanager.cpp.o CMakeFiles/libtesseract.dir/ccutil/tprintf.cpp.o CMakeFiles/libtesseract.dir/ccutil/unichar.cpp.o CMakeFiles/libtesseract.dir/ccutil/unicharcompress.cpp.o CMakeFiles/libtesseract.dir/ccutil/unicharmap.cpp.o CMakeFiles/libtesseract.dir/ccutil/unicharset.cpp.o CMakeFiles/libtesseract.dir/ccutil/unicodes.cpp.o CMakeFiles/libtesseract.dir/ccutil/universalambigs.cpp.o CMakeFiles/libtesseract.dir/classify/adaptive.cpp.o CMakeFiles/libtesseract.dir/classify/adaptmatch.cpp.o CMakeFiles/libtesseract.dir/classify/blobclass.cpp.o CMakeFiles/libtesseract.dir/classify/classify.cpp.o CMakeFiles/libtesseract.dir/classify/cluster.cpp.o CMakeFiles/libtesseract.dir/classify/clusttool.cpp.o CMakeFiles/libtesseract.dir/classify/cutoffs.cpp.o CMakeFiles/libtesseract.dir/classify/errorcounter.cpp.o CMakeFiles/libtesseract.dir/classify/featdefs.cpp.o CMakeFiles/libtesseract.dir/classify/float2int.cpp.o CMakeFiles/libtesseract.dir/classify/fpoint.cpp.o CMakeFiles/libtesseract.dir/classify/intfeaturedist.cpp.o CMakeFiles/libtesseract.dir/classify/intfeaturemap.cpp.o CMakeFiles/libtesseract.dir/classify/intfeaturespace.cpp.o CMakeFiles/libtesseract.dir/classify/intfx.cpp.o CMakeFiles/libtesseract.dir/classify/intmatcher.cpp.o CMakeFiles/libtesseract.dir/classify/intproto.cpp.o CMakeFiles/libtesseract.dir/classify/kdtree.cpp.o CMakeFiles/libtesseract.dir/classify/mastertrainer.cpp.o CMakeFiles/libtesseract.dir/classify/mf.cpp.o CMakeFiles/libtesseract.dir/classify/mfdefs.cpp.o CMakeFiles/libtesseract.dir/classify/mfoutline.cpp.o CMakeFiles/libtesseract.dir/classify/mfx.cpp.o CMakeFiles/libtesseract.dir/classify/normfeat.cpp.o CMakeFiles/libtesseract.dir/classify/normmatch.cpp.o CMakeFiles/libtesseract.dir/classify/ocrfeatures.cpp.o CMakeFiles/libtesseract.dir/classify/outfeat.cpp.o CMakeFiles/libtesseract.dir/classify/picofeat.cpp.o CMakeFiles/libtesseract.dir/classify/protos.cpp.o CMakeFiles/libtesseract.dir/classify/sampleiterator.cpp.o CMakeFiles/libtesseract.dir/classify/shapeclassifier.cpp.o CMakeFiles/libtesseract.dir/classify/shapetable.cpp.o CMakeFiles/libtesseract.dir/classify/tessclassifier.cpp.o CMakeFiles/libtesseract.dir/classify/trainingsample.cpp.o CMakeFiles/libtesseract.dir/classify/trainingsampleset.cpp.o CMakeFiles/libtesseract.dir/cutil/bitvec.cpp.o CMakeFiles/libtesseract.dir/cutil/callcpp.cpp.o CMakeFiles/libtesseract.dir/cutil/cutil.cpp.o CMakeFiles/libtesseract.dir/cutil/cutil_class.cpp.o CMakeFiles/libtesseract.dir/cutil/danerror.cpp.o CMakeFiles/libtesseract.dir/cutil/efio.cpp.o CMakeFiles/libtesseract.dir/cutil/emalloc.cpp.o CMakeFiles/libtesseract.dir/cutil/freelist.cpp.o CMakeFiles/libtesseract.dir/cutil/oldlist.cpp.o CMakeFiles/libtesseract.dir/cutil/structures.cpp.o CMakeFiles/libtesseract.dir/dict/context.cpp.o CMakeFiles/libtesseract.dir/dict/dawg.cpp.o CMakeFiles/libtesseract.dir/dict/dawg_cache.cpp.o CMakeFiles/libtesseract.dir/dict/dict.cpp.o CMakeFiles/libtesseract.dir/dict/hyphen.cpp.o CMakeFiles/libtesseract.dir/dict/permdawg.cpp.o CMakeFiles/libtesseract.dir/dict/stopper.cpp.o CMakeFiles/libtesseract.dir/dict/trie.cpp.o CMakeFiles/libtesseract.dir/lstm/convolve.cpp.o CMakeFiles/libtesseract.dir/lstm/ctc.cpp.o CMakeFiles/libtesseract.dir/lstm/fullyconnected.cpp.o CMakeFiles/libtesseract.dir/lstm/functions.cpp.o CMakeFiles/libtesseract.dir/lstm/input.cpp.o CMakeFiles/libtesseract.dir/lstm/lstm.cpp.o CMakeFiles/libtesseract.dir/lstm/lstmrecognizer.cpp.o CMakeFiles/libtesseract.dir/lstm/lstmtrainer.cpp.o CMakeFiles/libtesseract.dir/lstm/maxpool.cpp.o CMakeFiles/libtesseract.dir/lstm/network.cpp.o CMakeFiles/libtesseract.dir/lstm/networkbuilder.cpp.o CMakeFiles/libtesseract.dir/lstm/networkio.cpp.o CMakeFiles/libtesseract.dir/lstm/parallel.cpp.o CMakeFiles/libtesseract.dir/lstm/plumbing.cpp.o CMakeFiles/libtesseract.dir/lstm/recodebeam.cpp.o CMakeFiles/libtesseract.dir/lstm/reconfig.cpp.o CMakeFiles/libtesseract.dir/lstm/reversed.cpp.o CMakeFiles/libtesseract.dir/lstm/series.cpp.o CMakeFiles/libtesseract.dir/lstm/stridemap.cpp.o CMakeFiles/libtesseract.dir/lstm/tfnetwork.cpp.o CMakeFiles/libtesseract.dir/lstm/weightmatrix.cpp.o CMakeFiles/libtesseract.dir/opencl/openclwrapper.cpp.o CMakeFiles/libtesseract.dir/textord/alignedblob.cpp.o CMakeFiles/libtesseract.dir/textord/baselinedetect.cpp.o CMakeFiles/libtesseract.dir/textord/bbgrid.cpp.o CMakeFiles/libtesseract.dir/textord/blkocc.cpp.o CMakeFiles/libtesseract.dir/textord/blobgrid.cpp.o CMakeFiles/libtesseract.dir/textord/ccnontextdetect.cpp.o CMakeFiles/libtesseract.dir/textord/cjkpitch.cpp.o CMakeFiles/libtesseract.dir/textord/colfind.cpp.o CMakeFiles/libtesseract.dir/textord/colpartition.cpp.o CMakeFiles/libtesseract.dir/textord/colpartitiongrid.cpp.o CMakeFiles/libtesseract.dir/textord/colpartitionset.cpp.o CMakeFiles/libtesseract.dir/textord/devanagari_processing.cpp.o CMakeFiles/libtesseract.dir/textord/drawedg.cpp.o CMakeFiles/libtesseract.dir/textord/drawtord.cpp.o CMakeFiles/libtesseract.dir/textord/edgblob.cpp.o CMakeFiles/libtesseract.dir/textord/edgloop.cpp.o CMakeFiles/libtesseract.dir/textord/equationdetectbase.cpp.o CMakeFiles/libtesseract.dir/textord/fpchop.cpp.o CMakeFiles/libtesseract.dir/textord/gap_map.cpp.o CMakeFiles/libtesseract.dir/textord/imagefind.cpp.o CMakeFiles/libtesseract.dir/textord/linefind.cpp.o CMakeFiles/libtesseract.dir/textord/makerow.cpp.o CMakeFiles/libtesseract.dir/textord/oldbasel.cpp.o CMakeFiles/libtesseract.dir/textord/pithsync.cpp.o CMakeFiles/libtesseract.dir/textord/pitsync1.cpp.o CMakeFiles/libtesseract.dir/textord/scanedg.cpp.o CMakeFiles/libtesseract.dir/textord/sortflts.cpp.o CMakeFiles/libtesseract.dir/textord/strokewidth.cpp.o CMakeFiles/libtesseract.dir/textord/tabfind.cpp.o CMakeFiles/libtesseract.dir/textord/tablefind.cpp.o CMakeFiles/libtesseract.dir/textord/tablerecog.cpp.o CMakeFiles/libtesseract.dir/textord/tabvector.cpp.o CMakeFiles/libtesseract.dir/textord/textlineprojection.cpp.o CMakeFiles/libtesseract.dir/textord/textord.cpp.o CMakeFiles/libtesseract.dir/textord/topitch.cpp.o CMakeFiles/libtesseract.dir/textord/tordmain.cpp.o CMakeFiles/libtesseract.dir/textord/tospace.cpp.o CMakeFiles/libtesseract.dir/textord/tovars.cpp.o CMakeFiles/libtesseract.dir/textord/underlin.cpp.o CMakeFiles/libtesseract.dir/textord/wordseg.cpp.o CMakeFiles/libtesseract.dir/textord/workingpartset.cpp.o CMakeFiles/libtesseract.dir/viewer/scrollview.cpp.o CMakeFiles/libtesseract.dir/viewer/svmnode.cpp.o CMakeFiles/libtesseract.dir/viewer/svpaint.cpp.o CMakeFiles/libtesseract.dir/viewer/svutil.cpp.o CMakeFiles/libtesseract.dir/wordrec/associate.cpp.o CMakeFiles/libtesseract.dir/wordrec/chop.cpp.o CMakeFiles/libtesseract.dir/wordrec/chopper.cpp.o CMakeFiles/libtesseract.dir/wordrec/drawfx.cpp.o CMakeFiles/libtesseract.dir/wordrec/findseam.cpp.o CMakeFiles/libtesseract.dir/wordrec/gradechop.cpp.o CMakeFiles/libtesseract.dir/wordrec/language_model.cpp.o CMakeFiles/libtesseract.dir/wordrec/lm_consistency.cpp.o CMakeFiles/libtesseract.dir/wordrec/lm_pain_points.cpp.o CMakeFiles/libtesseract.dir/wordrec/lm_state.cpp.o CMakeFiles/libtesseract.dir/wordrec/outlines.cpp.o CMakeFiles/libtesseract.dir/wordrec/params_model.cpp.o CMakeFiles/libtesseract.dir/wordrec/pieces.cpp.o CMakeFiles/libtesseract.dir/wordrec/plotedges.cpp.o CMakeFiles/libtesseract.dir/wordrec/render.cpp.o CMakeFiles/libtesseract.dir/wordrec/segsearch.cpp.o CMakeFiles/libtesseract.dir/wordrec/tface.cpp.o CMakeFiles/libtesseract.dir/wordrec/wordclass.cpp.o CMakeFiles/libtesseract.dir/wordrec/wordrec.cpp.o CMakeFiles/libtesseract.dir/api/baseapi.cpp.o CMakeFiles/libtesseract.dir/api/capi.cpp.o CMakeFiles/libtesseract.dir/api/renderer.cpp.o CMakeFiles/libtesseract.dir/api/pdfrenderer.cpp.o -lpthread -llept
/usr/bin/ld: cannot find -llept
c++: error: linker command failed with exit code 1 (use -v to see invocation)
*** [liblibtesseract.so.4.0.0] Error code 1

make[3]: stopped in /usr/ports/graphics/tesseract-devel/work/.build
1 error

make[3]: stopped in /usr/ports/graphics/tesseract-devel/work/.build
*** [CMakeFiles/libtesseract.dir/all] Error code 2

make[2]: stopped in /usr/ports/graphics/tesseract-devel/work/.build
1 error

make[2]: stopped in /usr/ports/graphics/tesseract-devel/work/.build
*** [all] Error code 2

make[1]: stopped in /usr/ports/graphics/tesseract-devel/work/.build
1 error

make[1]: stopped in /usr/ports/graphics/tesseract-devel/work/.build
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make: stopped in /usr/ports/graphics/tesseract-devel
```
How can I solve that error?


----------



## jrm@ (Apr 2, 2017)

Try changing  the USES line to

```
USES=           cmake:outsource localbase:ldflags libtool pkgconfig
```
That should fix the linking error anyway.


----------



## goshanecr (Apr 3, 2017)

Yes, it solves error on linking stage, but now I have problem on install stage:
Makefile

```
# $FreeBSD$

PORTNAME=       tesseract-devel
PORTVERSION=    4.0.0a
CATEGORIES=     graphics

MAINTAINER=     i.g.e.o@ya.ru
COMMENT=        Development version ot Tesseract-OCR Engine

LICENSE=        APACHE20

LIB_DEPENDS=    liblept.so:graphics/leptonica

USES=           cmake:outsource localbase:ldflags libtool pkgconfig
USE_LDCONFIG=   yes

USE_GITHUB=     yes
GH_ACCOUNT=     tesseract-ocr
GH_PROJECT=     tesseract
GH_TAGNAME=     168e7998ebeee76121045d5a176904349cad9639

CONFIGURE_ENV=  LIBLEPT_HEADERSDIR="${LOCALBASE}/include/leptonica"

DATADIR=        ${PREFIX}/share/tessdata
PORTDATA=       *
PORTDOCS=       AUTHORS ChangeLog README.md
#INSTALL_TARGET= install

.include <bsd.port.mk>
```


```
[100%] Linking CXX executable bin/tesseract
/usr/local/bin/cmake -E cmake_link_script CMakeFiles/tesseract.dir/link.txt --verbose=1
/usr/bin/c++   -O2 -pipe -march=opteron-sse3 -fstack-protector -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include --std=c++11 -O2 -pipe -march=opteron-sse3 -fstack-protector -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include   -fstack-protector -L/usr/local/lib CMakeFiles/tesseract.dir/api/tesseractmain.cpp.o  -o bin/tesseract -Wl,-rpath,/usr/ports/graphics/tesseract-devel/work/.build  liblibtesseract.so.4.0.0 -lpthread -llept
[100%] Built target tesseract
/usr/local/bin/cmake -E cmake_progress_start /usr/ports/graphics/tesseract-devel/work/.build/CMakeFiles 0
===>  Staging for tesseract-devel-4.0.0a
===>   Generating temporary packing list
make[1]: don't know how to make install/strip. Stop

make[1]: stopped in /usr/ports/graphics/tesseract-devel/work/.build
*** Error code 2

Stop.
make: stopped in /usr/ports/graphics/tesseract-devel
```
I'm check /usr/ports/graphics/tesseract-devel/work/.build/Makefile but it has not install target. Only preinstall.
Sorry for stupid questions, I just have not successfull experience with porting software.


----------



## goshanecr (Apr 5, 2017)

Guys, is it any ideas how can I fix that problem?


----------



## acheron (Apr 6, 2017)

There is no install target with cmake. The recommanded way to build tesseract is with autohell. Here is a quick patch:

```
--- Makefile.orig       2017-04-06 09:56:41.358408000 +0000
+++ Makefile    2017-04-06 09:53:59.774816000 +0000
@@ -10,8 +10,12 @@ COMMENT=        Development version ot T
LICENSE=        APACHE20

LIB_DEPENDS=    liblept.so:graphics/leptonica
+BUILD_DEPENDS= ${LOCALBASE}/share/aclocal/ax_check_compile_flag.m4:devel/autoconf-archive
+
+USES=           autoreconf localbase libtool pathfix pkgconfig
+GNU_CONFIGURE=  yes
+USE_LDCONFIG=   yes

-USES=           cmake:outsource localbase:ldflags libtool pkgconfig
USE_LDCONFIG=   yes

USE_GITHUB=     yes
```


----------



## goshanecr (Apr 7, 2017)

I think that porting process very close to finish, but has last error:
Makefile

```
# $FreeBSD$

PORTNAME=       tesseract-devel
PORTVERSION=    4.0.0a
CATEGORIES=     graphics

MAINTAINER=     i.g.e.o@ya.ru
COMMENT=        Development version ot Tesseract-OCR Engine

LICENSE=        APACHE20

LIB_DEPENDS=    liblept.so:graphics/leptonica
BUILD_DEPENDS=  ${LOCALBASE}/share/aclocal/ax_check_compile_flag.m4:devel/autoconf-archive

USES=           autoreconf localbase libtool pathfix pkgconfig
GNU_CONFIGURE=  yes
USE_LDCONFIG=   yes

USE_GITHUB=     yes
GH_ACCOUNT=     tesseract-ocr
GH_PROJECT=     tesseract
GH_TAGNAME=     168e7998ebeee76121045d5a176904349cad9639

CONFIGURE_ENV=  LIBLEPT_HEADERSDIR="${LOCALBASE}/include/leptonica"

DATADIR=        ${PREFIX}/share/tessdata
PORTDATA=       *
PORTDOCS=       AUTHORS ChangeLog README.md
PORTEXAMPLES=   eurotext.tif phototext.tif
INSTALL_TARGET= install

OPTIONS_DEFINE= DOCS EXAMPLES TOOLS
OPTIONS_DEFAULT=TOOLS
OPTIONS_SUB=    yes
TOOLS_DESC=     Include training tools
TOOLS_LIB_DEPENDS=libicui18n.so:devel/icu \
                libfontconfig.so:x11-fonts/fontconfig
TOOLS_USES=     compiler:c++11-lib
TOOLS_USE=      GNOME=cairo,glib20,pango

post-patch:
        @${REINPLACE_CMD} -e 's|-O3 -DNDEBUG||' ${WRKSRC}/configure.ac

post-build-TOOLS-on:
        @cd ${WRKSRC} && ${MAKE} training

post-install-DOCS-on:
        @${MKDIR} ${STAGEDIR}${DOCSDIR}
        cd ${WRKSRC} && ${INSTALL_DATA} ${PORTDOCS} ${STAGEDIR}${DOCSDIR}

post-install-EXAMPLES-on:
        @${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
        cd ${WRKSRC} && ${INSTALL_DATA} testing/eurotext.tif \
                testing/phototest.tif ${STAGEDIR}${EXAMPLESDIR}

post-install-TOOLS-on:
        @cd ${WRKSRC} && ${MAKE} DESTDIR=${STAGEDIR} training-install

.include <bsd.port.mk>
```

Error on `make install`

```
Making install in lstm
 /bin/mkdir -p '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/include/tesseract'
 install  -m 0644 convolve.h ctc.h fullyconnected.h functions.h input.h lstm.h lstmrecognizer.h lstmtrainer.h maxpool.h networkbuilder.h network.h networkio.h networkscratch.h parallel.h plumbing.h recodebeam.h reconfig.h reversed.h series.h static_shape.h stridemap.h tfnetwork.h weightmatrix.h '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/include/tesseract'
Making install in ccmain
 /bin/mkdir -p '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/include/tesseract'
 install  -m 0644 thresholder.h ltrresultiterator.h pageiterator.h resultiterator.h osdetect.h '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/include/tesseract'
Making install in api
 /bin/mkdir -p '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/lib'
 /bin/sh ../libtool   --mode=install /usr/bin/install -c   libtesseract.la '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/libtesseract.so.4.0.0 /usr/ports/graphics/tesseract-devel/work/stage/usr/local/lib/libtesseract.so.4.0.0
libtool: install: (cd /usr/ports/graphics/tesseract-devel/work/stage/usr/local/lib && { ln -s -f libtesseract.so.4.0.0 libtesseract.so.4 || { rm -f libtesseract.so.4 && ln -s libtesseract.so.4.0.0 libtesseract.so.4; }; })
libtool: install: (cd /usr/ports/graphics/tesseract-devel/work/stage/usr/local/lib && { ln -s -f libtesseract.so.4.0.0 libtesseract.so || { rm -f libtesseract.so && ln -s libtesseract.so.4.0.0 libtesseract.so; }; })
libtool: install: /usr/bin/install -c .libs/libtesseract.lai /usr/ports/graphics/tesseract-devel/work/stage/usr/local/lib/libtesseract.la
libtool: install: /usr/bin/install -c .libs/libtesseract.a /usr/ports/graphics/tesseract-devel/work/stage/usr/local/lib/libtesseract.a
libtool: install: chmod 644 /usr/ports/graphics/tesseract-devel/work/stage/usr/local/lib/libtesseract.a
libtool: install: ranlib /usr/ports/graphics/tesseract-devel/work/stage/usr/local/lib/libtesseract.a
libtool: warning: remember to run 'libtool --finish /usr/local/lib'
 /bin/mkdir -p '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin'
  /bin/sh ../libtool   --mode=install install  -s -m 555 tesseract '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin'
libtool: warning: 'libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/tesseract /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/tesseract
 /bin/mkdir -p '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/include/tesseract'
 install  -m 0644 apitypes.h baseapi.h capi.h renderer.h '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/include/tesseract'
Making install in .
 /bin/mkdir -p '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/libdata/pkgconfig'
 install  -m 0644 tesseract.pc '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/libdata/pkgconfig'
Making install in tessdata
Making install in configs
 /bin/mkdir -p '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/share/tessdata/configs'
 install  -m 0644 inter makebox box.train unlv ambigs.train lstm.train api_config kannada box.train.stderr quiet logfile digits hocr tsv linebox pdf rebox strokewidth bigram txt '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/share/tessdata/configs'
Making install in tessconfigs
 /bin/mkdir -p '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/share/tessdata/tessconfigs'
 install  -m 0644 batch batch.nochop nobatch matdemo segdemo msdemo '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/share/tessdata/tessconfigs'
 /bin/mkdir -p '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/share/tessdata'
 install  -m 0644 pdf.ttf '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/share/tessdata'
Making install in doc
 /bin/mkdir -p '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/man/man1'
 install  -m 0644 cntraining.1 combine_tessdata.1 mftraining.1 tesseract.1 unicharset_extractor.1 wordlist2dawg.1 ambiguous_words.1 shapeclustering.1 dawg2wordlist.1 '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/man/man1'
 /bin/mkdir -p '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/man/man5'
 install  -m 0644 unicharambigs.5 unicharset.5 '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/man/man5'
 /bin/mkdir -p '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin'
  /bin/sh ../libtool   --mode=install install  -s -m 555 ambiguous_words classifier_tester cntraining combine_tessdata dawg2wordlist lstmeval lstmtraining mftraining set_unicharset_properties shapeclustering text2image unicharset_extractor wordlist2dawg '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin'
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/ambiguous_words /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/ambiguous_words
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/classifier_tester /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/classifier_tester
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/cntraining /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/cntraining
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/combine_tessdata /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/combine_tessdata
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/dawg2wordlist /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/dawg2wordlist
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/lstmeval /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/lstmeval
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/lstmtraining /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/lstmtraining
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/mftraining /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/mftraining
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/set_unicharset_properties /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/set_unicharset_properties
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/shapeclustering /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/shapeclustering
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/text2image /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/text2image
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/unicharset_extractor /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/unicharset_extractor
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/wordlist2dawg /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/wordlist2dawg
====> Compressing man pages (compress-man)
```


----------



## acheron (Apr 7, 2017)

```
/usr/bin/ld: cannot find -llept
```
-L /usr/local/lib is missing in the compiler flag and the compilers can't find lept.so


----------



## acheron (Apr 7, 2017)

bah, put back USE+= localbase:ldflags in your makefile, jrm gave you the solution in #2. Told you it was a quick patch


----------



## goshanecr (Apr 7, 2017)

Guys, I'm absolutely confused, feel myself like blind mouse trying to find hole 

Now I try these variants of *USES* option:

```
USES=           cmake:outsource localbase:ldflags libtool pkgconfig
```
Follows:

```
make[2]: don't know how to make install. Stop

make[2]: stopped in /usr/ports/graphics/tesseract-devel/work/.build
*** Error code 2

Stop.
make[1]: stopped in /usr/ports/graphics/tesseract-devel
*** Error code 1

Stop.
```


```
USES=         localbase:ldflags autoreconf localbase libtool pathfix pkgconfig
```


```
Making install in api
 /bin/mkdir -p '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/lib'
 /bin/sh ../libtool   --mode=install /usr/bin/install -c   libtesseract.la '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/libtesseract.so.4.0.0 /usr/ports/graphics/tesseract-devel/work/stage/usr/local/lib/libtesseract.so.4.0.0
libtool: install: (cd /usr/ports/graphics/tesseract-devel/work/stage/usr/local/lib && { ln -s -f libtesseract.so.4.0.0 libtesseract.so.4 || { rm -f libtesseract.so.4 && ln -s libtesseract.so.4.0.0 libtesseract.so.4; }; })
libtool: install: (cd /usr/ports/graphics/tesseract-devel/work/stage/usr/local/lib && { ln -s -f libtesseract.so.4.0.0 libtesseract.so || { rm -f libtesseract.so && ln -s libtesseract.so.4.0.0 libtesseract.so; }; })
libtool: install: /usr/bin/install -c .libs/libtesseract.lai /usr/ports/graphics/tesseract-devel/work/stage/usr/local/lib/libtesseract.la
libtool: install: /usr/bin/install -c .libs/libtesseract.a /usr/ports/graphics/tesseract-devel/work/stage/usr/local/lib/libtesseract.a
libtool: install: chmod 644 /usr/ports/graphics/tesseract-devel/work/stage/usr/local/lib/libtesseract.a
libtool: install: ranlib /usr/ports/graphics/tesseract-devel/work/stage/usr/local/lib/libtesseract.a
libtool: warning: remember to run 'libtool --finish /usr/local/lib'
 /bin/mkdir -p '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin'
  /bin/sh ../libtool   --mode=install install  -s -m 555 tesseract '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin'
libtool: warning: 'libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/tesseract /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/tesseract
 /bin/mkdir -p '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/include/tesseract'
 install  -m 0644 apitypes.h baseapi.h capi.h renderer.h '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/include/tesseract'
Making install in .
 /bin/mkdir -p '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/libdata/pkgconfig'
 install  -m 0644 tesseract.pc '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/libdata/pkgconfig'
Making install in tessdata
Making install in configs
 /bin/mkdir -p '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/share/tessdata/configs'
 install  -m 0644 inter makebox box.train unlv ambigs.train lstm.train api_config kannada box.train.stderr quiet logfile digits hocr tsv linebox pdf rebox strokewidth bigram txt '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/share/tessdata/configs'
Making install in tessconfigs
 /bin/mkdir -p '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/share/tessdata/tessconfigs'
 install  -m 0644 batch batch.nochop nobatch matdemo segdemo msdemo '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/share/tessdata/tessconfigs'
 /bin/mkdir -p '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/share/tessdata'
 install  -m 0644 pdf.ttf '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/share/tessdata'
Making install in doc
 /bin/mkdir -p '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/man/man1'
 install  -m 0644 cntraining.1 combine_tessdata.1 mftraining.1 tesseract.1 unicharset_extractor.1 wordlist2dawg.1 ambiguous_words.1 shapeclustering.1 dawg2wordlist.1 '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/man/man1'
 /bin/mkdir -p '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/man/man5'
 install  -m 0644 unicharambigs.5 unicharset.5 '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/man/man5'
 /bin/mkdir -p '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin'
  /bin/sh ../libtool   --mode=install install  -s -m 555 ambiguous_words classifier_tester cntraining combine_tessdata dawg2wordlist lstmeval lstmtraining mftraining set_unicharset_properties shapeclustering text2image unicharset_extractor wordlist2dawg '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin'
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/ambiguous_words /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/ambiguous_words
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/classifier_tester /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/classifier_tester
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/cntraining /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/cntraining
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/combine_tessdata /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/combine_tessdata
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/dawg2wordlist /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/dawg2wordlist
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/lstmeval /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/lstmeval
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/lstmtraining /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/lstmtraining
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/mftraining /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/mftraining
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/set_unicharset_properties /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/set_unicharset_properties
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/shapeclustering /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/shapeclustering
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/text2image /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/text2image
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/unicharset_extractor /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/unicharset_extractor
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/wordlist2dawg /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/wordlist2dawg
====> Compressing man pages (compress-man)
```


----------



## acheron (Apr 8, 2017)

Don't use cmake. Here is a patch:

```
Index: Makefile
===================================================================
--- Makefile    (revision 437949)
+++ Makefile    (working copy)
@@ -2,8 +2,7 @@
 # $FreeBSD$

 PORTNAME=    tesseract
-PORTVERSION=    3.05.00
-PORTREVISION=    1
+PORTVERSION=    4.0.0a
 CATEGORIES=    graphics

 MAINTAINER=    pkubaj@anongoth.pl
@@ -11,14 +10,16 @@

 LICENSE=    APACHE20

+BUILD_DEPENDS=    ${LOCALBASE}/share/aclocal/ax_check_compile_flag.m4:devel/autoconf-archive
 LIB_DEPENDS=    liblept.so:graphics/leptonica

-USES=        autoreconf localbase libtool pathfix pkgconfig
+USES=        autoreconf localbase:ldflags libtool pathfix pkgconfig
 GNU_CONFIGURE=    yes
 USE_LDCONFIG=    yes

 USE_GITHUB=    yes
 GH_ACCOUNT=    ${PORTNAME}-ocr
+GH_TAGNAME=    168e799

 CONFIGURE_ENV=    LIBLEPT_HEADERSDIR="${LOCALBASE}/include/leptonica"

Index: distinfo
===================================================================
--- distinfo    (revision 437949)
+++ distinfo    (working copy)
@@ -1,3 +1,3 @@
-TIMESTAMP = 1488548040
-SHA256 (tesseract-ocr-tesseract-3.05.00_GH0.tar.gz) = 3fe83e06d0f73b39f6e92ed9fc7ccba3ef734877b76aa5ddaaa778fac095d996
-SIZE (tesseract-ocr-tesseract-3.05.00_GH0.tar.gz) = 3581853
+TIMESTAMP = 1491588316
+SHA256 (tesseract-ocr-tesseract-4.0.0a-168e799_GH0.tar.gz) = 755c37c66dd1157ef80bb3c9f2621a9ac5ba475b8e7df3661bf132df6072ceb0
+SIZE (tesseract-ocr-tesseract-4.0.0a-168e799_GH0.tar.gz) = 3582301
Index: pkg-plist
===================================================================
--- pkg-plist    (revision 437949)
+++ pkg-plist    (working copy)
@@ -3,6 +3,8 @@
 %%TOOLS%%bin/cntraining
 %%TOOLS%%bin/combine_tessdata
 %%TOOLS%%bin/dawg2wordlist
+%%TOOLS%%bin/lstmeval
+%%TOOLS%%bin/lstmtraining
 %%TOOLS%%bin/mftraining
 %%TOOLS%%bin/set_unicharset_properties
 %%TOOLS%%bin/shapeclustering
@@ -14,33 +16,60 @@
 include/tesseract/baseapi.h
 include/tesseract/basedir.h
 include/tesseract/capi.h
+include/tesseract/convolve.h
+include/tesseract/ctc.h
+include/tesseract/dotproductavx.h
+include/tesseract/dotproductsse.h
 include/tesseract/errcode.h
 include/tesseract/fileerr.h
+include/tesseract/fullyconnected.h
+include/tesseract/functions.h
 include/tesseract/genericvector.h
 include/tesseract/helpers.h
 include/tesseract/host.h
+include/tesseract/input.h
+include/tesseract/lstm.h
+include/tesseract/lstmrecognizer.h
+include/tesseract/lstmtrainer.h
 include/tesseract/ltrresultiterator.h
+include/tesseract/maxpool.h
 include/tesseract/memry.h
 include/tesseract/ndminx.h
+include/tesseract/network.h
+include/tesseract/networkbuilder.h
+include/tesseract/networkio.h
+include/tesseract/networkscratch.h
 include/tesseract/ocrclass.h
 include/tesseract/osdetect.h
 include/tesseract/pageiterator.h
+include/tesseract/parallel.h
 include/tesseract/params.h
 include/tesseract/platform.h
+include/tesseract/plumbing.h
 include/tesseract/publictypes.h
+include/tesseract/recodebeam.h
+include/tesseract/reconfig.h
 include/tesseract/renderer.h
 include/tesseract/resultiterator.h
+include/tesseract/reversed.h
 include/tesseract/serialis.h
+include/tesseract/series.h
+include/tesseract/simddetect.h
+include/tesseract/static_shape.h
+include/tesseract/stridemap.h
 include/tesseract/strngs.h
 include/tesseract/tesscallback.h
+include/tesseract/tfnetwork.h
 include/tesseract/thresholder.h
 include/tesseract/unichar.h
+include/tesseract/unicharcompress.h
 include/tesseract/unicharmap.h
 include/tesseract/unicharset.h
+include/tesseract/weightmatrix.h
 lib/libtesseract.a
 lib/libtesseract.so
-lib/libtesseract.so.3
-lib/libtesseract.so.3.0.5
+lib/libtesseract.so.4
+lib/libtesseract.so.4.0.0
 libdata/pkgconfig/tesseract.pc
 man/man1/ambiguous_words.1.gz
 man/man1/cntraining.1.gz
```


----------



## goshanecr (Aug 17, 2017)

Good day!

I have a new trying of making that port with latest tag. I do Makefile, after that `make makesum && make makeplist` and copy output of command to pkg-plist.
After that command `make install clean` works fine, except that I have not any of tesseract binary or other files installed. I'm check in /usr/local/bin and in /usr/local/include and there have not any files or folders related to tesseract. What I do wrong?

Makefile

```
# Created by: Andrew Pantyukhin <infofarmer@FreeBSD.org>
# $FreeBSD: head/graphics/tesseract/Makefile 447406 2017-08-05 16:55:33Z swills $

PORTNAME=       tesseract
PORTVERSION=    4.0.0a
CATEGORIES=     graphics

MAINTAINER=     pkubaj@anongoth.pl
COMMENT=        Commercial quality open source OCR engine

LICENSE=        APACHE20
                         
BUILD_DEPENDS=  ${LOCALBASE}/share/aclocal/ax_check_compile_flag.m4:devel/autoconf-archive
LIB_DEPENDS=    liblept.so:graphics/leptonica

USES=           autoreconf localbase:ldflags libtool pathfix pkgconfig

GNU_CONFIGURE=  yes
USE_LDCONFIG=   yes

USE_GITHUB=     yes
GH_ACCOUNT=     ${PORTNAME}-ocr
GH_TAGNAME=     3847b7d

CONFIGURE_ENV=  LIBLEPT_HEADERSDIR="${LOCALBASE}/include/leptonica"

DATADIR=        ${PREFIX}/share/tessdata
PORTDATA=       *
PORTDOCS=       AUTHORS ChangeLog README.md
PORTEXAMPLES=   eurotext.tif phototest.tif
INSTALL_TARGET= install-strip

OPTIONS_DEFINE= DOCS EXAMPLES TOOLS
OPTIONS_DEFAULT=TOOLS
OPTIONS_SUB=    yes
TOOLS_DESC=     Include training tools
TOOLS_LIB_DEPENDS=libicui18n.so:devel/icu \
                libfontconfig.so:x11-fonts/fontconfig
TOOLS_USES=     compiler:c++11-lib
TOOLS_USE=      GNOME=cairo,glib20,pango

post-patch:
        @${REINPLACE_CMD} -e 's|-O3 -DNDEBUG||' ${WRKSRC}/configure.ac

post-build-TOOLS-on:
        @cd ${WRKSRC} && ${MAKE} training

post-install-DOCS-on:
        @${MKDIR} ${STAGEDIR}${DOCSDIR}
        cd ${WRKSRC} && ${INSTALL_DATA} ${PORTDOCS} ${STAGEDIR}${DOCSDIR}

post-install-EXAMPLES-on:
        @${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
        cd ${WRKSRC} && ${INSTALL_DATA} testing/eurotext.tif \
                testing/phototest.tif ${STAGEDIR}${EXAMPLESDIR}

post-install-TOOLS-on:
        @cd ${WRKSRC} && ${MAKE} DESTDIR=${STAGEDIR} training-install

.include <bsd.port.mk>
```

pkg-plist

```
bin/ambiguous_words
bin/classifier_tester
bin/cntraining
bin/combine_lang_model
bin/combine_tessdata
bin/dawg2wordlist
bin/lstmeval
bin/lstmtraining
bin/mftraining
bin/set_unicharset_properties
bin/shapeclustering
bin/tesseract
bin/text2image
bin/unicharset_extractor
bin/wordlist2dawg
include/tesseract/apitypes.h
include/tesseract/baseapi.h
include/tesseract/basedir.h
include/tesseract/capi.h
include/tesseract/convolve.h
include/tesseract/ctc.h
include/tesseract/dotproductavx.h
include/tesseract/dotproductsse.h
include/tesseract/errcode.h
include/tesseract/fileerr.h
include/tesseract/fullyconnected.h
include/tesseract/functions.h
include/tesseract/genericvector.h
include/tesseract/helpers.h
include/tesseract/host.h
include/tesseract/input.h
include/tesseract/lstm.h
include/tesseract/lstmrecognizer.h
include/tesseract/lstmtrainer.h
include/tesseract/ltrresultiterator.h
include/tesseract/maxpool.h
include/tesseract/memry.h
include/tesseract/ndminx.h
include/tesseract/network.h
include/tesseract/networkbuilder.h
include/tesseract/networkio.h
include/tesseract/networkscratch.h
include/tesseract/ocrclass.h
include/tesseract/osdetect.h
include/tesseract/pageiterator.h
include/tesseract/parallel.h
include/tesseract/params.h
include/tesseract/platform.h
include/tesseract/plumbing.h
include/tesseract/publictypes.h
include/tesseract/recodebeam.h
include/tesseract/reconfig.h
include/tesseract/renderer.h
include/tesseract/resultiterator.h
include/tesseract/reversed.h
include/tesseract/serialis.h
include/tesseract/series.h
include/tesseract/simddetect.h
include/tesseract/static_shape.h
include/tesseract/stridemap.h
include/tesseract/strngs.h
include/tesseract/tesscallback.h
include/tesseract/tfnetwork.h
include/tesseract/thresholder.h
include/tesseract/unichar.h
include/tesseract/unicharcompress.h
include/tesseract/unicharmap.h
include/tesseract/unicharset.h
include/tesseract/version.h
include/tesseract/weightmatrix.h
lib/libtesseract.a
lib/libtesseract.so
lib/libtesseract.so.4
lib/libtesseract.so.4.0.0
libdata/pkgconfig/tesseract.pc
%%PORTDOCS%%%%DOCSDIR%%/AUTHORS
%%PORTDOCS%%%%DOCSDIR%%/ChangeLog
%%PORTDOCS%%%%DOCSDIR%%/README.md
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/eurotext.tif
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/phototest.tif
%%DATADIR%%/configs/ambigs.train
%%DATADIR%%/configs/api_config
%%DATADIR%%/configs/bigram
%%DATADIR%%/configs/box.train
%%DATADIR%%/configs/box.train.stderr
%%DATADIR%%/configs/digits
%%DATADIR%%/configs/hocr
%%DATADIR%%/configs/inter
%%DATADIR%%/configs/kannada
%%DATADIR%%/configs/linebox
%%DATADIR%%/configs/logfile
%%DATADIR%%/configs/lstm.train
%%DATADIR%%/configs/makebox
%%DATADIR%%/configs/pdf
%%DATADIR%%/configs/quiet
%%DATADIR%%/configs/rebox
%%DATADIR%%/configs/strokewidth
%%DATADIR%%/configs/tsv
%%DATADIR%%/configs/txt
%%DATADIR%%/configs/unlv
%%DATADIR%%/pdf.ttf
%%DATADIR%%/tessconfigs/batch
%%DATADIR%%/tessconfigs/batch.nochop
%%DATADIR%%/tessconfigs/matdemo
%%DATADIR%%/tessconfigs/msdemo
%%DATADIR%%/tessconfigs/nobatch
%%DATADIR%%/tessconfigs/segdemo
```


----------



## SirDice (Aug 18, 2017)

It's difficult to say what's wrong without actually seeing what it does. Can you do the following?

```
cd /to/your/port
make clean
script build.log
make install
exit
```
This should create a build.log file with _all_ the output of the build process. Post it to Pastebin (or a similar service) and post the link here.


----------



## goshanecr (Aug 18, 2017)

I do that steps, there is output:
https://pastebin.com/sb0fTdvv

I'm cut some build output because pastebin limits to 512Kb.


----------



## SirDice (Aug 18, 2017)

Looking at the duplicate files messages at the end I'm guessing you already have a different tesseract port installed and the new one installs files in the same place. So make sure to add some conflict handling to your port. This will prevent installation when the original tesseract port is already installed.


----------



## goshanecr (Aug 18, 2017)

But I have not installed graphics/tesseract on that system. I check this by `pkg info | grep tess` and by deinstalling graphics/tesseract-devel and after that there is no *tessdata *folder in /usr/local/share.

And also it's not installs any binary after `make install`

Sorry. Now check again and tesseract binary is installed after `make install`


----------



## acheron (Aug 23, 2017)

It works for me with this pkg-plist:

```
bin/ambiguous_words
bin/classifier_tester
bin/cntraining
bin/combine_lang_model
bin/combine_tessdata
bin/dawg2wordlist
bin/lstmeval
bin/lstmtraining
bin/mftraining
bin/set_unicharset_properties
bin/shapeclustering
bin/tesseract
bin/text2image
bin/unicharset_extractor
bin/wordlist2dawg
include/tesseract/apitypes.h
include/tesseract/baseapi.h
include/tesseract/basedir.h
include/tesseract/capi.h
include/tesseract/convolve.h
include/tesseract/ctc.h
include/tesseract/dotproductavx.h
include/tesseract/dotproductsse.h
include/tesseract/errcode.h
include/tesseract/fileerr.h
include/tesseract/fullyconnected.h
include/tesseract/functions.h
include/tesseract/genericvector.h
include/tesseract/helpers.h
include/tesseract/host.h
include/tesseract/input.h
include/tesseract/lstm.h
include/tesseract/lstmrecognizer.h
include/tesseract/lstmtrainer.h
include/tesseract/ltrresultiterator.h
include/tesseract/maxpool.h
include/tesseract/memry.h
include/tesseract/ndminx.h
include/tesseract/network.h
include/tesseract/networkbuilder.h
include/tesseract/networkio.h
include/tesseract/networkscratch.h
include/tesseract/ocrclass.h
include/tesseract/osdetect.h
include/tesseract/pageiterator.h
include/tesseract/parallel.h
include/tesseract/params.h
include/tesseract/platform.h
include/tesseract/plumbing.h
include/tesseract/publictypes.h
include/tesseract/recodebeam.h 
include/tesseract/reconfig.h 
include/tesseract/renderer.h 
include/tesseract/resultiterator.h 
include/tesseract/reversed.h 
include/tesseract/serialis.h 
include/tesseract/series.h 
include/tesseract/simddetect.h 
include/tesseract/static_shape.h 
include/tesseract/stridemap.h 
include/tesseract/strngs.h 
include/tesseract/tesscallback.h 
include/tesseract/tfnetwork.h 
include/tesseract/thresholder.h 
include/tesseract/unichar.h 
include/tesseract/unicharcompress.h 
include/tesseract/unicharmap.h 
include/tesseract/unicharset.h 
include/tesseract/version.h 
include/tesseract/weightmatrix.h 
lib/libtesseract.a 
lib/libtesseract.so 
lib/libtesseract.so.4 
lib/libtesseract.so.4.0.0 
libdata/pkgconfig/tesseract.pc
```


```
/usr/local/bin/tesseract -v 
tesseract 4.00.00alpha 
leptonica-1.74.1 
 libgif 5.1.4 : libjpeg 8d (libjpeg-turbo 1.5.2) : libpng 1.6.31+apng : libtiff 4.0.8 : zlib 1.2.11 : libwebp 0.6.0 : libopenjp2 2.1.2 

Found SSE
```


----------



## goshanecr (Aug 23, 2017)

Yes, I have now graphics/tesseract-devel installs successfully, but in the end of `make install` output appears some warnings related to *libtesseract.la*:

```
ranlib: warning: can't find .strtab section
libtool: warning: remember to run 'libtool --finish /usr/local/lib'
 /bin/mkdir -p '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin'
 STRIPPROG='strip' /bin/sh ../libtool   --mode=install /bin/sh /usr/ports/graphics/tesseract-devel/work/tesseract-1e3bf29/config/install-sh -c -s tesseract '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin'
libtool: warning: 'libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: /bin/sh /usr/ports/graphics/tesseract-devel/work/tesseract-1e3bf29/config/install-sh -c -s .libs/tesseract /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/tesseract
 /bin/mkdir -p '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/include/tesseract'
 install  -m 0644 apitypes.h baseapi.h capi.h renderer.h '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/include/tesseract'
Making install in .
 /bin/mkdir -p '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/libdata/pkgconfig'
 install  -m 0644 tesseract.pc '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/libdata/pkgconfig'
Making install in tessdata
Making install in configs
 /bin/mkdir -p '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/share/tessdata/configs'
 install  -m 0644 inter makebox box.train unlv ambigs.train lstm.train api_config kannada box.train.stderr quiet logfile digits hocr tsv linebox pdf rebox strokewidth bigram txt '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/share/tessdata/configs'
Making install in tessconfigs
 /bin/mkdir -p '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/share/tessdata/tessconfigs'
 install  -m 0644 batch batch.nochop nobatch matdemo segdemo msdemo '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/share/tessdata/tessconfigs'
 /bin/mkdir -p '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/share/tessdata'
 install  -m 0644 pdf.ttf '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/share/tessdata'
Making install in doc
cd /usr/ports/graphics/tesseract-devel/work/tesseract-1e3bf29 && install  -m 0644 AUTHORS ChangeLog README.md /usr/ports/graphics/tesseract-devel/work/stage/usr/local/share/doc/tesseract
cd /usr/ports/graphics/tesseract-devel/work/tesseract-1e3bf29 && install  -m 0644 testing/eurotext.tif  testing/phototest.tif /usr/ports/graphics/tesseract-devel/work/stage/usr/local/share/examples/tesseract
 /bin/mkdir -p '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin'
  /bin/sh ../libtool   --mode=install install  -s -m 555 ambiguous_words classifier_tester cntraining combine_lang_model combine_tessdata dawg2wordlist lstmeval lstmtraining mftraining set_unicharset_properties shapeclustering text2image unicharset_extractor wordlist2dawg '/usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin'
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/ambiguous_words /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/ambiguous_words
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/classifier_tester /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/classifier_tester
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/cntraining /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/cntraining
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/combine_lang_model /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/combine_lang_model
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/combine_tessdata /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/combine_tessdata
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/dawg2wordlist /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/dawg2wordlist
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/lstmeval /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/lstmeval
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/lstmtraining /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/lstmtraining
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/mftraining /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/mftraining
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/set_unicharset_properties /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/set_unicharset_properties
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/shapeclustering /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/shapeclustering
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/text2image /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/text2image
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/unicharset_extractor /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/unicharset_extractor
libtool: warning: '../api/libtesseract.la' has not been installed in '/usr/local/lib'
libtool: install: install -m 555 -s .libs/wordlist2dawg /usr/ports/graphics/tesseract-devel/work/stage/usr/local/bin/wordlist2dawg
====> Compressing man pages (compress-man)
===>  Installing for tesseract-4.0.0a
===>  Checking if tesseract already installed
===>   Registering installation for tesseract-4.0.0a
Installing tesseract-4.0.0a...
===>  Cleaning for tesseract-4.0.0a
```
But program installs and works fine. Is that warnings critical and how it can be fixed?


----------



## acheron (Aug 24, 2017)

I don't think the warning is critical.


----------



## goshanecr (Aug 24, 2017)

Finally I'm add PR 221755 and PR 221756 with patches for graphics/tesseract-devel and graphics/tesseract-data-devel. I hope it will be my first ports 
Also I'm add PR 221757 with www/otter-browser-devel.

I think that using bleeding edge versions of software by peoples will increase feedback to developers of that software.


----------

