I'm using Homebrew to checkout and compile the latest tesseract 3.03 (within a few hours of this post 2014-april-16, maybe noonish HST) and have stumbled upon some path problems when doing "make training-install". Admittedly, I don't know what I'm doing, and of course Homebrew should probably be the first contact I make. Yet, this post stated:
"
I have hacked configure.ac to check for them an add the needed includes. Not sure if it will work on all platforms though, so please test."—Ray
So, perhaps the following info about the errors I'm getting about some paths might be relevant or helpful. Unfortunately, I haven't been able to resolve them, but mostly because I can imagine there are many ways to resolve this and I'm not sure which would be the right way, e.g. directly in tesseract files, or perhaps indirectly in Homebrew.
Here's the first relevant error I've encountered with "make training-install", which is with pango:
<---- begin quote: pango error ---->
In file included from ligature_table.cpp:26:
./pango_font_info.h:30:10: fatal error: 'pango/pango-font.h' file not found
#include "pango/pango-font.h"
^
<---- end quote: pango error ---->
I did a search for the file "pango-font.h" using the Finder and found the file in "/usr/local/include/" where I'd expected it, because of Homebrew. Specifically, it file was in "/usr/local/include/pango-1.0/pango/pango-font.h". From this I figured maybe the "pango-1.0" directory was the path problem. I don't know much of anything about how or where these paths are set, or what environments variables to set and how to not clobber them. Much of the contents of the include directory are symlinks, so I created yet another symlink to the pango stuff, but much more directly than stopping at "pango-1.0". In a Terminal window I typed:
"ln -s ../Cellar/pango/1.36.3/include/pango-1.0/pango"
This meant there was the previous "pango-1.0" symlink along with the new "pango" symlink. I used Homebrew to do a reinstall and apparently the new symlink helped it get past this path error. That got me thinking Homebrew needed to change how it created the symlink to pango, or perhaps create this other symlink in addition. At least, I was thinking that until I reviewed next error that occurred.
Here's the next error that happened after resolving the location of "pango-font.h" file, this time with "glib.h":
<---- begin quote: glib error ---->
In file included from ligature_table.cpp:26:
In file included from ./pango_font_info.h:30:
In file included from /usr/local/include/pango/pango-font.h:25:
/usr/local/include/pango/pango-coverage.h:25:10: fatal error: 'glib.h' file not found
#include <glib.h>
^
<---- end quote: glib error ---->
So now after being able to find "pango-font.h" with the new symlink I provided in my file system, that file refers to "pango-coverage.h" which in turn wants "glib.h". Any guess where "glib.h" is located? That's right, it's in a subdirectory of "/usr/local/include/". More specifically: "/usr/local/include/glib-2.0/glib.h". But according to the error, it's not trying to find it through a specific parent directory like the previous pango file.
So if I were to approach this error in the same way as the previous error, then I'd need a symlink directly to the file "glib.h" itself inside of "/usr/local/include/". That wasn't as acceptable of a solution to me this time, so now I'm trying to inform the involved parties about the paths not being complete: tesseract because they wrote the references (and because of the above quote), and Homebrew because it provides the build environment for me.
My question is: what would be the most appropriate fix for this?
Perhaps not using Homebrew? That is, does tesseract's "make training-install" work fine on OSX by some other approach than building with Homebrew?
Perhaps asking for Homebrew to code some better linking or better setting of build environment variables? And which link paths or which variables would those be?
Any ideas on that?
What gets me is that pango is obviously found during configuration because the "make training-install" option wouldn't be available, but the tesseract code can't find pango itself. That doesn't necessarily mean it's an issue with tesseract code because Homebrew might not be setting up the build environment variables acceptably. But I don't know anything, so I don't know.
I should mention that building and installing tesseract 3.03 with Homebrew using the command with "make install" in a formula works fine without any issues. It's just the "make training-install" that needs these new dependencies leading to these errors.
For now, I'll try to figure out where at Homebrew to compose a message for this.