Bug 267233 - graphics/tesseract: fails to build if science/py-tensorflow is installed
Summary: graphics/tesseract: fails to build if science/py-tensorflow is installed
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-21 04:45 UTC by jinxiaoyong
Modified: 2022-10-21 18:59 UTC (History)
2 users (show)

See Also:


Attachments
add --without-tensorflow to CONFIGURE_ARGS (433 bytes, patch)
2022-10-21 04:45 UTC, jinxiaoyong
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description jinxiaoyong 2022-10-21 04:45:20 UTC
Created attachment 237494 [details]
add --without-tensorflow to CONFIGURE_ARGS

By default tesseract configure checks for tensorflow.  Tensorflow installed from port breaks the build of tesseract, see error messages below.  The fault is in the tensorflow port, though I'm not sure how to fix that.  For tesseract to build, it's enough to patch the Makefile and add CONFIGURE_ARGS+=--without-tensorflow

--- src/lstm/libtesseract_lstm_la-tfnetwork.pb.lo ---
In file included from src/lstm/tfnetwork.pb.cc:4:
./src/lstm/tfnetwork.pb.h:17:4: error: This file was generated by an older version of protoc which is
#  error This file was generated by an older version of protoc which is
   ^                                                                                           
./src/lstm/tfnetwork.pb.h:18:4: error: incompatible with your Protocol Buffer headers.  Please
#  error incompatible with your Protocol Buffer headers.  Please
   ^                                                                                           
./src/lstm/tfnetwork.pb.h:19:4: error: regenerate this file with a newer version of protoc.
#  error regenerate this file with a newer version of protoc.
   ^                                                                                           
--- src/lstm/libtesseract_lstm_la-tfnetwork.pb.lo ---
./src/lstm/tfnetwork.pb.h:25:10: fatal error: 'google/protobuf/generated_message_table_driven.h' file not found
#include <google/protobuf/generated_message_table_driven.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--- src/lstm/libtesseract_lstm_la-network.lo ---
In file included from src/lstm/network.cpp:42:                                                 
In file included from ./src/lstm/tfnetwork.h:30:
In file included from /usr/local/include/tensorflow/core/public/session.h:24:
/usr/local/include/tensorflow/core/framework/tensor.h:22:10: fatal error: 'third_party/eigen3/unsupported/Eigen/CXX11/Tensor' file not found
#include "third_party/eigen3/unsupported/Eigen/CXX11/Tensor"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--- src/lstm/libtesseract_lstm_la-tfnetwork.lo ---
In file included from src/lstm/tfnetwork.cpp:20:
In file included from ./src/lstm/tfnetwork.h:30:
In file included from /usr/local/include/tensorflow/core/public/session.h:24:
/usr/local/include/tensorflow/core/framework/tensor.h:22:10: fatal error: 'third_party/eigen3/unsupported/Eigen/CXX11/Tensor' file not found
#include "third_party/eigen3/unsupported/Eigen/CXX11/Tensor"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Comment 1 Anthony Donnelly 2022-10-21 11:40:06 UTC
Are you mixing ports and packages? 

Just curious. The Eigen headers should be an easy fix for the tensorflow package, but it won't resolve the generated headers issues in the tesseract package.
Comment 2 jinxiaoyong 2022-10-21 18:59:59 UTC
(In reply to Anthony Donnelly from comment #1)

Everything is installed via ports here.  I can see all the necessary tensorflow headers under

    /usr/local/lib/python3.9/site-packages/tensorflow/include

but not under

    /usr/local/include/tensorflow

which tesseract found by default.

As to the protobuf headers in tesseract, I'm not sure if it's a version mismatch between tensorflow and system protobuf, or some issue within tesseract.