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

make check fails with unittest/baseapi_test.cc:190: undefined reference #2439

Closed
Shreeshrii opened this issue May 16, 2019 · 13 comments
Closed

Comments

@Shreeshrii
Copy link
Collaborator

Making check in unittest
make[1]: Entering directory '/home/shreeshrii/tesseract/unittest'
make  libgtest.la libgtest_main.la libgmock.la libgmock_main.la libabseil.la apiexample_test applybox_test baseapi_test bitvector_test cleanapi_test colpartition_test dawg_test denorm_test fileio_test heap_test imagedata_test indexmapbidi_test intfeaturemap_test intsimdmatrix_test lang_model_test layout_test linlsq_test loadlang_test mastertrainer_test matrix_test nthitem_test osd_test paragraphs_test params_model_test progress_test qrsequence_test recodebeam_test rect_test resultiterator_test shapetable_test stats_test stringrenderer_test tablefind_test tablerecog_test tabvector_test tfile_test commandlineflags_test lstm_recode_test lstm_squashed_test lstm_test lstmtrainer_test unichar_test unicharcompress_test unicharset_test validate_grapheme_test validate_indic_test validate_khmer_test validate_myanmar_test validator_test
make[2]: Entering directory '/home/shreeshrii/tesseract/unittest'
make[2]: 'libgtest.la' is up to date.
make[2]: 'libgtest_main.la' is up to date.
make[2]: 'libgmock.la' is up to date.
make[2]: 'libgmock_main.la' is up to date.
make[2]: 'libabseil.la' is up to date.
make[2]: 'apiexample_test' is up to date.
make[2]: 'applybox_test' is up to date.
/bin/sh ../libtool  --tag=CXX   --mode=link g++  -g -O2 -std=c++14   -o baseapi_test baseapi_test.o libabseil.la libgtest.la libgtest_main.la -lpthread ../src/api/libtesseract.la  -llept  -lpthread
libtool: link: g++ -g -O2 -std=c++14 -o baseapi_test baseapi_test.o  ./.libs/libabseil.a ./.libs/libgtest.a ./.libs/libgtest_main.a ../src/api/.libs/libtesseract.a -llept -lpthread
baseapi_test.o: In function `TestBody':
/home/shreeshrii/tesseract/unittest/baseapi_test.cc:190: undefined reference to `tesseract::TessBaseAPI::AdaptToWordStr(tesseract::PageSegMode, char const*)'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:1305: baseapi_test] Error 1
make[2]: Leaving directory '/home/shreeshrii/tesseract/unittest'
make[1]: *** [Makefile:2248: check-am] Error 2
make[1]: Leaving directory '/home/shreeshrii/tesseract/unittest'
make: *** [Makefile:500: check-recursive] Error 1

@Shreeshrii
Copy link
Collaborator Author

latest code from master, built with

./autogen.sh
./configure --disable-shared --disable-opencl --disable-graphics --disable-openmp --disable-debug --disable-legacy
make -j 4
make training -j 4

make check -j 4

stweil added a commit to stweil/tesseract that referenced this issue May 16, 2019
Linker error reported in issue tesseract-ocr#2439:

    unittest/baseapi_test.cc:190:
      undefined reference to
      `tesseract::TessBaseAPI::AdaptToWordStr(tesseract::PageSegMode, char const*)'

Signed-off-by: Stefan Weil <sw@weilnetz.de>
@stweil
Copy link
Contributor

stweil commented May 16, 2019

Please try pull request #2440.

@Shreeshrii
Copy link
Collaborator Author

Updated to tesseract -v
tesseract 5.0.0-alpha-67-g7e9d2
leptonica-1.76.0
libgif 5.1.4 : libjpeg 6b (libjpeg-turbo 1.5.3) : libpng 1.6.34 : libtiff 4.0.9 : zlib 1.2.11 : libwebp 1.0.0

(Not yet updated with #2440)

Now getting the following errors:

/bin/sh ../libtool  --tag=CXX   --mode=link g++  -g -O2 -std=c++14   -o intfeaturemap_test intfeaturemap_test.o libgtest.la libgtest_main.la -lpthread ../src/api/libtesseract.la  -lpthread
/bin/sh ../libtool  --tag=CXX   --mode=link g++  -g -O2 -std=c++14   -o intsimdmatrix_test intsimdmatrix_test-intsimdmatrix_test.o libgtest.la libgtest_main.la -lpthread ../src/api/libtesseract.la   -lpthread
/bin/sh ../libtool  --tag=CXX   --mode=link g++  -g -O2 -std=c++14   -o lang_model_test lang_model_test.o libabseil.la libgtest.la libgtest_main.la -lpthread ../src/training/libtesseract_training.la ../src/training/libtesseract_tessopt.la ../src/api/libtesseract.la  -licui18n -licuuc -licudata  -licuuc -licudata  -lpthread
libtool: link: g++ -g -O2 -std=c++14 -o intfeaturemap_test intfeaturemap_test.o  ./.libs/libgtest.a ./.libs/libgtest_main.a ../src/api/.libs/libtesseract.a -llept -lpthread
intfeaturemap_test.o: In function `TestBody':
/home/shreeshrii/tesseract/unittest/intfeaturemap_test.cc:41: undefined reference to `tesseract::IntFeatureSpace::IntFeatureSpace()'
/home/shreeshrii/tesseract/unittest/intfeaturemap_test.cc:42: undefined reference to `tesseract::IntFeatureSpace::Init(unsigned char, unsigned char, unsigned char)'
/home/shreeshrii/tesseract/unittest/intfeaturemap_test.cc:43: undefined reference to `tesseract::IntFeatureMap::IntFeatureMap()'
/home/shreeshrii/tesseract/unittest/intfeaturemap_test.cc:44: undefined reference to `tesseract::IntFeatureMap::Init(tesseract::IntFeatureSpace const&)'
intfeaturemap_test.o: In function `tesseract::IntFeatureMap::IndexAndSortFeatures(INT_FEATURE_STRUCT const*, int, GenericVector<int>*) const':
/home/shreeshrii/tesseract/unittest/../src/classify/intfeaturemap.h:107: undefined reference to `tesseract::IntFeatureSpace::IndexAndSortFeatures(INT_FEATURE_STRUCT const*, int, GenericVector<int>*) const'
intfeaturemap_test.o: In function `TestBody':
/home/shreeshrii/tesseract/unittest/intfeaturemap_test.cc:79: undefined reference to `tesseract::IntFeatureMap::OffsetFeature(int, int) const'
/home/shreeshrii/tesseract/unittest/intfeaturemap_test.cc:83: undefined reference to `tesseract::IntFeatureMap::InverseIndexFeature(int) const'
/home/shreeshrii/tesseract/unittest/intfeaturemap_test.cc:84: undefined reference to `tesseract::IntFeatureMap::InverseIndexFeature(int) const'
/home/shreeshrii/tesseract/unittest/intfeaturemap_test.cc:79: undefined reference to `tesseract::IntFeatureMap::OffsetFeature(int, int) const'
/home/shreeshrii/tesseract/unittest/intfeaturemap_test.cc:102: undefined reference to `tesseract::IntFeatureMap::DeleteMapFeature(int)'
/home/shreeshrii/tesseract/unittest/intfeaturemap_test.cc:103: undefined reference to `tesseract::IntFeatureMap::DeleteMapFeature(int)'
/home/shreeshrii/tesseract/unittest/intfeaturemap_test.cc:104: undefined reference to `tesseract::IntFeatureMap::FinalizeMapping(tesseract::SampleIterator*)'
intfeaturemap_test.o: In function `tesseract::IntFeatureMap::IndexAndSortFeatures(INT_FEATURE_STRUCT const*, int, GenericVector<int>*) const':
/home/shreeshrii/tesseract/unittest/../src/classify/intfeaturemap.h:107: undefined reference to `tesseract::IntFeatureSpace::IndexAndSortFeatures(INT_FEATURE_STRUCT const*, int, GenericVector<int>*) const'
intfeaturemap_test.o: In function `TestBody':
/home/shreeshrii/tesseract/unittest/intfeaturemap_test.cc:43: undefined reference to `tesseract::IntFeatureMap::~IntFeatureMap()'
/home/shreeshrii/tesseract/unittest/intfeaturemap_test.cc:94: undefined reference to `tesseract::IntFeatureMap::InverseIndexFeature(int) const'
/home/shreeshrii/tesseract/unittest/intfeaturemap_test.cc:43: undefined reference to `tesseract::IntFeatureMap::~IntFeatureMap()'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:1349: intfeaturemap_test] Error 1
make[2]: *** Waiting for unfinished jobs....
libtool: link: g++ -g -O2 -std=c++14 -o intsimdmatrix_test intsimdmatrix_test-intsimdmatrix_test.o  ./.libs/libgtest.a ./.libs/libgtest_main.a ../src/api/.libs/libtesseract.a -llept -lpthread
libtool: link: g++ -g -O2 -std=c++14 -o lang_model_test lang_model_test.o  ./.libs/libabseil.a ./.libs/libgtest.a ./.libs/libgtest_main.a ../src/training/.libs/libtesseract_training.a ../src/training/.libs/libtesseract_tessopt.a ../src/api/.libs/libtesseract.a -llept -licui18n -licuuc -licudata -lpthread
make[2]: Leaving directory '/home/shreeshrii/tesseract/unittest'
make[1]: *** [Makefile:2248: check-am] Error 2
make[1]: Leaving directory '/home/shreeshrii/tesseract/unittest'
make: *** [Makefile:500: check-recursive] Error 1

@stweil
Copy link
Contributor

stweil commented May 16, 2019

@Shreeshrii, I just tested it myself. The reported linker error is fixed. But there are lots of similar linker errors.

@stweil
Copy link
Contributor

stweil commented May 16, 2019

We got the same result. :-)

@Shreeshrii
Copy link
Collaborator Author

I will wait for your fix. :-)

stweil added a commit to stweil/tesseract that referenced this issue May 16, 2019
Linker error reported in issue tesseract-ocr#2439:

    unittest/baseapi_test.cc:190:
      undefined reference to
      `tesseract::TessBaseAPI::AdaptToWordStr(tesseract::PageSegMode, char const*)'

Signed-off-by: Stefan Weil <sw@weilnetz.de>
@zdenop
Copy link
Contributor

zdenop commented May 16, 2019

I think tests should be run with standard (default) setup (that does not modified API).
And IMO disabling legacy engine is bad idea: it has better result in some cases e.g. OSD see #2062

stweil added a commit to stweil/tesseract that referenced this issue May 16, 2019
Linker error reported in issue tesseract-ocr#2439:

    unittest/baseapi_test.cc:190:
      undefined reference to
      `tesseract::TessBaseAPI::AdaptToWordStr(tesseract::PageSegMode, char const*)'

Signed-off-by: Stefan Weil <sw@weilnetz.de>
@stweil
Copy link
Contributor

stweil commented May 16, 2019

Pull request #2441 fixes the build make check without legacy engine. It does not fix the unittest. Some fail and need more care.

stweil added a commit that referenced this issue May 16, 2019
Linker error reported in issue #2439:

    unittest/baseapi_test.cc:190:
      undefined reference to
      `tesseract::TessBaseAPI::AdaptToWordStr(tesseract::PageSegMode, char const*)'

Signed-off-by: Stefan Weil <sw@weilnetz.de>
@Shreeshrii
Copy link
Collaborator Author

@stweil Thanks. make check is building ok now. However as mentioned above by you, some unittests are failing.

Should I leave this issue open till that is fixed?

@stweil
Copy link
Contributor

stweil commented Jul 26, 2019

Yes, please leave it open.

@Shreeshrii
Copy link
Collaborator Author

@amitdo
Copy link
Collaborator

amitdo commented Oct 12, 2020

I recently made a few changes related to this issue.

Does someone want to test this and see if the issue of failing tests when the legacy engine is disabled still occurs?

@Shreeshrii
Copy link
Collaborator Author

See #3226 for currently failing tests with --disable-legacy

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

No branches or pull requests

4 participants