zdenop / qt-box-editor

QT4 editor of tesseract-ocr box files
https://zdenop.github.io/qt-box-editor/
Apache License 2.0
170 stars 66 forks source link

Clang error on Mac OS #70

Open fin-eng opened 6 years ago

fin-eng commented 6 years ago

"Make" exits with the following: clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [release/qt-box-editor-1.12rc1.app/Contents/MacOS/qt-box-editor-1.12rc1] Error 1

I guess it has to do with the tesseract version: tesseract -v tesseract 3.05.02 leptonica-1.76.0 libjpeg 9c : libpng 1.6.34 : libtiff 4.0.9 : zlib 1.2.11

Wanted to try the 3.02 of tesseract but that seems unavailable at homebrew.

Any idea how to make it up and running on Mac os?

zdenop commented 6 years ago

Please provide full log and not only last line.

fin-eng commented 6 years ago

Sure, here it is:

make /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -headerpad_max_install_names -stdlib=libc++ -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -mmacosx-version-min=10.9 -Wl,-rpath,/anaconda3/lib -o release/qt-box-editor-1.12rc1.app/Contents/MacOS/qt-box-editor-1.12rc1 build/release/main.o build/release/MainWindow.o build/release/ChildWidget.o build/release/DelegateEditors.o build/release/TessTools.o build/release/SettingsDialog.o build/release/GetRowIDDialog.o build/release/ShortCutsDialog.o build/release/FindDialog.o build/release/DrawRectangle.o build/release/qrc_application.o build/release/qrc_QBE-GNOME.o build/release/qrc_QBE-Faenza.o build/release/qrc_QBE-Oxygen.o build/release/qrc_QBE-Tango.o build/release/moc_MainWindow.o build/release/moc_ChildWidget.o build/release/moc_DelegateEditors.o build/release/moc_SettingsDialog.o build/release/moc_GetRowIDDialog.o build/release/moc_ShortCutsDialog.o build/release/moc_FindDialog.o build/release/moc_DrawRectangle.o -L/usr/local/lib -L/anaconda3/lib -lQt5Svg -framework DiskArbitration -framework IOKit -lQt5Widgets -lQt5Gui -lQt5Network -lQt5Core -framework OpenGL -framework AGL Undefined symbols for architecture x86_64: "tesseract::TessBaseAPI::GetBoxText(int)", referenced from: TessTools::makeBoxes(QImage const&, int) in TessTools.o "tesseract::TessBaseAPI::GetThresholdedImage()", referenced from: TessTools::GetThresholded(QImage const&) in TessTools.o "tesseract::TessBaseAPI::End()", referenced from: TessTools::makeBoxes(QImage const&, int) in TessTools.o TessTools::GetThresholded(QImage const&) in TessTools.o "tesseract::TessBaseAPI::Init(char const, char const, tesseract::OcrEngineMode, char*, int, GenericVector const, GenericVector const, bool)", referenced from: TessTools::makeBoxes(QImage const&, int) in TessTools.o TessTools::GetThresholded(QImage const&) in TessTools.o "tesseract::TessBaseAPI::SetImage(Pix)", referenced from: TessTools::makeBoxes(QImage const&, int) in TessTools.o TessTools::GetThresholded(QImage const&) in TessTools.o "tesseract::TessBaseAPI::TessBaseAPI()", referenced from: TessTools::makeBoxes(QImage const&, int) in TessTools.o TessTools::GetThresholded(QImage const&) in TessTools.o "_fileFormatIsTiff", referenced from: ChildWidget::loadImage(QString const&) in ChildWidget.o "_lept_fclose", referenced from: ChildWidget::loadImage(QString const&) in ChildWidget.o "_lept_fopen", referenced from: ChildWidget::loadImage(QString const&) in ChildWidget.o "_pixCreate", referenced from: TessTools::qImage2PIX(QImage const&) in TessTools.o "_pixDestroy", referenced from: ChildWidget::loadImage(QString const&) in ChildWidget.o ChildWidget::makeBoxPage() in ChildWidget.o ChildWidget::reloadImg() in ChildWidget.o ChildWidget::slotChangePage(int) in ChildWidget.o TessTools::makeBoxes(QImage const&, int) in TessTools.o TessTools::GetThresholded(QImage const&) in TessTools.o "_pixEndianByteSwapNew", referenced from: TessTools::qImage2PIX(QImage const&) in TessTools.o TessTools::PIX2qImage(Pix) in TessTools.o "_pixGetData", referenced from: TessTools::PIX2qImage(Pix) in TessTools.o "_pixGetDepth", referenced from: TessTools::PIX2qImage(Pix) in TessTools.o "_pixGetHeight", referenced from: TessTools::PIX2qImage(Pix) in TessTools.o "_pixGetResolution", referenced from: TessTools::PIX2qImage(Pix) in TessTools.o "_pixGetWidth", referenced from: TessTools::PIX2qImage(Pix) in TessTools.o "_pixGetWpl", referenced from: TessTools::PIX2qImage(Pix*) in TessTools.o "_pixReadStreamTiff", referenced from: ChildWidget::loadImage(QString const&) in ChildWidget.o "_pixReadTiff", referenced from: ChildWidget::makeBoxPage() in ChildWidget.o ChildWidget::reloadImg() in ChildWidget.o ChildWidget::slotChangePage(int) in ChildWidget.o "_pixSetColormap", referenced from: TessTools::qImage2PIX(QImage const&) in TessTools.o "_pixSetResolution", referenced from: TessTools::qImage2PIX(QImage const&) in TessTools.o "_pixSetWpl", referenced from: TessTools::qImage2PIX(QImage const&) in TessTools.o "_tiffGetCount", referenced from: ChildWidget::loadImage(QString const&) in ChildWidget.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [release/qt-box-editor-1.12rc1.app/Contents/MacOS/qt-box-editor-1.12rc1] Error 1

zdenop commented 6 years ago

Problem is here:

Undefined symbols for architecture x86_64: "tesseract::TessBaseAPI::GetBoxText(int)" ... ld: symbol(s) not found for architecture x86_64

I am not familiar with Mac OS, but if I got it right log: you do not have 64bit tesseract library (or you are mixing 64bit build with 32bit library...) Can you check where is located/installed tesseract?

fin-eng commented 6 years ago

Sorry for the late reply, was already posting but somehow it got lost on its way.

Do you mean that information?

brew info tesseract tesseract: stable 3.05.02 (bottled), HEAD OCR (Optical Character Recognition) engine https://github.com/tesseract-ocr/ /usr/local/Cellar/tesseract/3.05.02 (235 files, 1.2GB) * Built from source on 2018-06-26 at 16:10:48 with: --with-all-languages From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/tesseract.rb ==> Dependencies Build: autoconf ✔, autoconf-archive ✔, automake ✔, libtool ✔, pkg-config ✔ Required: leptonica ✔, libtiff ✔ ==> Options --with-all-languages Install recognition data for all languages --with-opencl Enable OpenCL support --with-serial-num-pack Install serial number recognition pack --with-training-tools Install OCR training tools --HEAD Install HEAD version

zdenop commented 6 years ago

I am sorry - this seems to be Mac OS specific and I am not familiar with it. @IRobL @xErik can you check/help with this?

fin-eng commented 6 years ago

No worries @zdenop, thanks for your fast response

PumpMagic commented 6 years ago

Hey there,

I encountered this myself and looked into it. I have created a PR to fix the issue.

The gist of it is that the qmake configuration for macOS is currently expecting a custom installation of Tesseract, instead of the official Homebrew package. It was also not linking libtesseract or liblept.

I am guessing the original custom install was expected because at the time (three years ago?), the official Tesseract package did not support installing training tools. It does, now, so I don't see a need for it.

Ryan

fin-eng commented 6 years ago

Hi Ryan,

Many thanks for working on that issue, only tried it today, but it works wonderful.

Cheers & have a nice weekend!

outlawski commented 5 years ago
  1. 51 #

    Duplicate of #