Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Clarification request/Improvement] Add version and github info always, also when --enable-debug was missing #723

Closed
Wikinaut opened this issue Feb 16, 2017 · 27 comments

Comments

@Wikinaut
Copy link
Contributor

I know, that tesseract --version outputs the exact version and github commit hash, if it was compiled with ./configure --enable-debug, example:

tesseract 4.00.00alpha-278-gc768b58
 leptonica-1.74.1
  libjpeg 6b (libjpeg-turbo 1.3.1) : libpng 1.2.50 : libtiff 4.0.3 : zlib 1.2.8

 Found AVX
 Found SSE

I wonder, why this is not output, when the configuration setting was not given and I suggest to modify the build code so that the version and github commit hash is always shown with the --versioncommand.

@Shreeshrii
Copy link
Collaborator

Yes. I agree, adding version info with github commit hash in non-debug builds will be very helpful.

An earlier request - #581 (comment)

@Shreeshrii
Copy link
Collaborator

Needs change in

#if defined(GIT_REV) && (defined(DEBUG) || defined(_DEBUG))

@zdenop zdenop closed this as completed Feb 19, 2017
@zdenop zdenop reopened this Feb 19, 2017
@Wikinaut
Copy link
Contributor Author

Wikinaut commented Mar 3, 2017

@zdenop Is

#if defined(GIT_REV) && (defined(DEBUG) || defined(_DEBUG))
the only change needed, and would you accept a corresponding pull request ?

@zdenop
Copy link
Contributor

zdenop commented Mar 4, 2017

I am against to show GIT_REV in release mode:

  • Experienced users/testers should know what they are doing, what their are testing
  • Inexperienced users should use released stable version

@Wikinaut
Copy link
Contributor Author

Wikinaut commented Mar 5, 2017

@zdenop Where exactly is your problem to print the GIT_REV when users use --version ?

I *have a problem when, as an expert, I run always the latest version, but sometimes after git pull the latest build is not the "installed" build. As a user I want to have the fastest code, i.e. built without --enable-debug.

I again request to think over it, and to always - if available - burn the GIT_REV into the code. I ask you for this.

@Wikinaut
Copy link
Contributor Author

Wikinaut commented Mar 6, 2017

Not using --enable-debug increases processing speed about 6%.

@stweil
Copy link
Contributor

stweil commented May 11, 2017

@zdenop, what about using GIT_REV only for versions without tag, no matter whether it is a debug or a release build? Then released stable versions would not show GIT_REV.

@amitdo
Copy link
Collaborator

amitdo commented May 11, 2017

Not using --enable-debug increases processing speed about 6%.

Only ~6%? With LSTM mode?

#40 (comment)

@amitdo
Copy link
Collaborator

amitdo commented May 11, 2017

BTW, maybe we should add another debug/optimization option with -Og?
https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html

@Shreeshrii
Copy link
Collaborator

Shreeshrii commented Mar 28, 2018

This has now been implemented by recent commits by @stweil .

tesseract -v
tesseract 4.0.0-beta.1-59-g2cc4
 leptonica-1.76.0
  libjpeg 8d (libjpeg-turbo 1.3.0) : libpng 1.2.50 : libtiff 4.0.3 : zlib 1.2.8

 Found AVX
 Found SSE

Please check with latest code from master and close the issue.

@Wikinaut
Copy link
Contributor Author

Wikinaut commented Mar 28, 2018

I tried to build the new master version but make stopped with

libtool:   error: REVISION '00' must be a nonnegative integer
libtool:   error: '4:00' is not valid version information

relevant lines are:

libtool: link: ( cd ".libs" && rm -f "libtesseract_api.la" && ln -s "../libtesseract_api.la" "libtesseract_api.la" )
/bin/bash ../libtool  --tag=CXX   --mode=link g++  -g -O2 -std=c++11 -L/usr/local/lib -llept  -version-info 4:00 -no-undefined   -o libtesseract.la -rpath /usr/local/lib  libtesseract_api.la ../ccmain/libtesseract_main.la ../textord/ltesseract_textord.la ../wordrec/libtesseract_wordrec.la ../classify/libtesseract_classify.la ../dict/libtesseract_dict.la ../arch/libtesseract_arch.la ../arch/libtesseract_avx.la ../arch/libtesseract_avx2.la ../arch/libtesseract_sse.l../lstm/libtesseract_lstm.la ../ccstruct/libtesseract_ccstruct.la ../cutil/libtesseract_cutil.la ../viewer/libtesseract_viewer.la ../ccutil/libtesseract_ccutil.la ../opencl/libtesseract_opencl.la  -lpthread 
libtool:   error: REVISION '00' must be a nonnegative integer
libtool:   error: '4:00' is not valid version information
Makefile:524: die Regel für Ziel „libtesseract.la“ scheiterte
make[2]: *** [libtesseract.la] Fehler 1
make[2]: Verzeichnis „/work/usr/local/src/tesseract/api“ wird verlassen
Makefile:494: die Regel für Ziel „all-recursive“ scheiterte
make[1]: *** [all-recursive] Fehler 1
make[1]: Verzeichnis „/work/usr/local/src/tesseract“ wird verlassen
Makefile:403: die Regel für Ziel „all“ scheiterte
make: *** [all] Fehler 2

@Shreeshrii
Copy link
Collaborator

How are you trying to build? I used the following today, without any problem.

#!/bin/bash
./autogen.sh
./configure --disable-openmp --disable-graphics --disable-opencl
make
sudo make install
sudo ldconfig
make training
sudo make training-install

@Wikinaut
Copy link
Contributor Author

make distclean
git pull upstream master
./autogen.sh
./configure
make

@Shreeshrii
Copy link
Collaborator

@stweil Please see make error above.

@stweil
Copy link
Contributor

stweil commented Mar 28, 2018

@Wikinaut, it looks like you are using git, but your latest tag does not match the expectations (MAJOR.MINOR.PATCH with MAJOR, MINOR and PATCH being numerical values, maybe followed by additional non-numeric characters). The latest tag should be 4.0.0-beta.1. What do you get if you run git describe --abbrev=4?

@Wikinaut
Copy link
Contributor Author

Wikinaut commented Mar 28, 2018

I just built the master branch, as usual.

git describe --abbrev=4
4.00.00dev-787-g2cc4

@Wikinaut
Copy link
Contributor Author

@stweil have a look (I just updated this above) to the make output

libtool: link: ( cd ".libs" && rm -f "libtesseract_api.la" && ln -s "../libtesseract_api.la" "libtesseract_api.la" )
/bin/bash ../libtool --tag=CXX --mode=link g++ -g -O2 -std=c++11 -L/usr/local/lib -llept -version-info 4:00 -no-undefined -o libtesseract.la -rpath /usr/local/lib libtesseract_api.la ../ccmain/libtesseract_main.la ../textord/ltesseract_textord.la ../wordrec/libtesseract_wordrec.la ../classify/libtesseract_classify.la ../dict/libtesseract_dict.la ../arch/libtesseract_arch.la ../arch/libtesseract_avx.la ../arch/libtesseract_avx2.la ../arch/libtesseract_sse.l../lstm/libtesseract_lstm.la ../ccstruct/libtesseract_ccstruct.la ../cutil/libtesseract_cutil.la ../viewer/libtesseract_viewer.la ../ccutil/libtesseract_ccutil.la ../opencl/libtesseract_opencl.la -lpthread

Especially to -version-info 4:00. Is the colon correct?

@stweil
Copy link
Contributor

stweil commented Mar 28, 2018

@Wikinaut, your local git has the latest code, but not the latest tags (see list of all tags). It still uses the old tag 4.00.00dev. Are you pulling from your personal fork (where the tag might be missing)? If you pull from tesseract-ocr, you should automatically get the latest tag, unless you have disabled that in your git settings. Try git pull --tags to force pulling all tags.

@stweil
Copy link
Contributor

stweil commented Mar 28, 2018

The error message which you see comes from -version-info 4:00. It should be -version-info 4:0.

@Shreeshrii
Copy link
Collaborator

What info do u see for git remote -v?

@Wikinaut
Copy link
Contributor Author

@Shreeshrii

origin  git@github.com:Wikinaut/tesseract.git (fetch)
origin  git@github.com:Wikinaut/tesseract.git (push)
upstream        https://github.com/tesseract-ocr/tesseract.git (fetch)
upstream        https://github.com/tesseract-ocr/tesseract.git (push)

@Shreeshrii
Copy link
Collaborator

Try git pull --tags to force pulling all tags.

and then

run git describe --abbrev=4

@stweil
Copy link
Contributor

stweil commented Mar 28, 2018

git fetch --all --tags, then we are sure that you won't miss a tag. :-)

@Wikinaut
Copy link
Contributor Author

Wikinaut commented Mar 28, 2018

ok, works now.

Result as wanted:

tesseract -v
tesseract 4.0.0-beta.1-59-g2cc4
 leptonica-1.76.0
  libjpeg 6b (libjpeg-turbo 1.5.1) : libpng 1.2.50 : libtiff 4.0.8 : zlib 1.2.8
 Found AVX2
 Found AVX
 Found SSE

Closing this as solved, thanks.

@amitdo
Copy link
Collaborator

amitdo commented Mar 28, 2018

tesseract 4.0.0-beta.1-59-g2cc4

@stweil, according to the semver 2.0.0 spec, there should be only one -. The rest should be replaced by dots.

BTW, from where the field before the commit hash comes from?
(59 here)

@Shreeshrii
Copy link
Collaborator

Shreeshrii commented Mar 28, 2018 via email

@stweil
Copy link
Contributor

stweil commented Mar 28, 2018

4.0.0-beta.1-59-g2cc4 is not a semver tag, so I don't think that the semver spec applies here. It would be possible to replace '-' by '.', but I'd prefer to use the value which is returned by git describe without modifications.

As @Shreeshrii already said, 59 is the number of commits since the last tagged version. The 'g' before the hash might stand for 'git'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants