From 780986ebfbe0bae443a94b7b619fbb1498adf631 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Thu, 16 May 2019 17:17:56 +0200 Subject: [PATCH] Fix linker error for baseapi_test when building without legacy engine 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 --- unittest/Makefile.am | 3 +++ unittest/baseapi_test.cc | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/unittest/Makefile.am b/unittest/Makefile.am index ab4e1dd070..e65063f163 100644 --- a/unittest/Makefile.am +++ b/unittest/Makefile.am @@ -20,6 +20,9 @@ AM_CPPFLAGS += -DTESSDATA_BEST_DIR="\"$(TESSDATA_BEST_DIR)\"" AM_CPPFLAGS += -DTESTING_DIR="\"$(TESTING_DIR)\"" AM_CPPFLAGS += -DTESTDATA_DIR="\"$(TESTDATA_DIR)\"" AM_CPPFLAGS += -DPANGO_ENABLE_ENGINE +if DISABLED_LEGACY_ENGINE +AM_CPPFLAGS += -DDISABLED_LEGACY_ENGINE +endif AM_CPPFLAGS += -I$(top_builddir)/src/api AM_CPPFLAGS += -I$(top_srcdir)/src/api AM_CPPFLAGS += -I$(top_srcdir)/src/arch diff --git a/unittest/baseapi_test.cc b/unittest/baseapi_test.cc index b7a1afeb7f..bc70fd0f23 100644 --- a/unittest/baseapi_test.cc +++ b/unittest/baseapi_test.cc @@ -166,6 +166,10 @@ TEST_F(TesseractTest, RickSnyderNotFuckSnyder) { // Tests that Tesseract gets exactly the right answer on some page numbers. TEST_F(TesseractTest, AdaptToWordStrTest) { +#ifdef DISABLED_LEGACY_ENGINE + // Skip test because TessBaseAPI::AdaptToWordStr is missing. + GTEST_SKIP(); +#else static const char* kTrainingPages[] = { "136.tif", "256.tif", "410.tif", "432.tif", "540.tif", "692.tif", "779.tif", "793.tif", "808.tif", "815.tif", @@ -204,6 +208,7 @@ TEST_F(TesseractTest, AdaptToWordStrTest) { EXPECT_STREQ(kTestText[i], ocr_text.c_str()); pixDestroy(&src_pix); } +#endif } // Tests that LSTM gets exactly the right answer on phototest.