#4 OS X install problem


Thanks for making Tesseract available. On my Mac
running Tiger, configure executed fine, but make didn't:

Anand-Patils-Computer:~/Desktop/tesseract-1.02 anand$
sudo make
make all-recursive
Making all in ccstruct
source='blobbox.cpp' object='blobbox.o' libtool=no \ depfile='.deps/blobbox.Po' tmpdepfile='.deps/blobbox.TPo' \ depmode=gcc3 /bin/sh ../config/depcomp \ g++ -DHAVE_CONFIG_H -I. -I. -I.. -I../ccutil
-I../cutil -I../image -I../viewer -I/opt/local/include
-DNDEBUG -O3 -Wall -c -o blobbox.o `test -f
'blobbox.cpp' || echo './'`blobbox.cpp
In file included from ../ccutil/host.h:73,
from ../ccutil/clst.h:24,
from ../ccutil/varable.h:24,
from blobbox.h:23,
from blobbox.cpp:21:
../ccutil/platform.h:7:26: error: linux/limits.h: No
such file or directory
make[3]: *** [blobbox.o] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Anand-Patils-Computer:~/Desktop/tesseract-1.02 anand$

Anand Patil


  • Nobody/Anonymous

    Logged In: NO

    change ccutil/platform.h:7:26 to reference limits.h instead of linux.limits.h and it should get past that error.

  • Nobody/Anonymous

    Logged In: NO

    From: Devon Sean McCullough <SourceForge@jovi.net>

    Tesseract segfaults under MacOS, hard to debug when GDB sees "start.s" but no source,
    likewise EMACS error message parser fails to find source files, sounds like Makefile
    or config trouble to me or perhaps g++/gcc combo confuses them?
    Remember to patch Makefile to use the -g switch.

    Patch to build (and segfault) Tesseract 1.02 in MacOS 10.4.8 PPC

    $ basename `pwd`; find . -iname '*~' | sed 's/^\.\///' | while read -r f; do echo -e '\f'; diff -u "$f" `echo "$f" | sed 's/\.~0~$//'`; done

    --- ccutil/platform.h.~0~ 2006-06-16 18:17:05.000000000 -0400
    +++ ccutil/platform.h 2006-12-30 13:50:39.000000000 -0500
    @@ -2,6 +2,14 @@
    #define DLLSYM
    #ifdef __MSW32__
    #define SIGNED
    +#elif defined(__APPLE__)
    +#ifdef DEFINE_MAC_OR_DOS
    +#define MAC_OR_DOS (loses on MacOS X)
    +#define __UNIX__
    +#include <limits.h>
    +#define MAX_PATH PATH_MAX
    +#define SIGNED signed
    #define __UNIX__
    #include <linux/limits.h>

    --- cutil/listio.cpp.~0~ 2006-06-16 18:17:07.000000000 -0400
    +++ cutil/listio.cpp 2006-12-30 13:58:25.000000000 -0500
    @@ -30,7 +30,13 @@

    #include <stdio.h>
    #include <string.h>
    -#include <malloc.h>
    +#if MAC_OR_DOS || defined (__APPLE__)
    +#include <stdlib.h> /* Mac file */
    +#include <malloc.h> /* Unix file */
    #include "listio.h"


    --- cutil/util.cpp.~0~ 2006-06-16 18:17:07.000000000 -0400
    +++ cutil/util.cpp 2006-12-30 13:58:02.000000000 -0500
    @@ -42,7 +42,7 @@
    #include "util.h"
    #include "callcpp.h"

    -#if MAC_OR_DOS
    +#if MAC_OR_DOS || defined (__APPLE__)
    #include <stdlib.h> /* Mac file */
    #include <malloc.h> /* Unix file */

    --- cutil/variables.cpp.~0~ 2006-06-16 19:19:53.000000000 -0400
    +++ cutil/variables.cpp 2006-12-30 13:58:17.000000000 -0500
    @@ -26,7 +26,12 @@
    I n c l u d e s
    #include <stdio.h>
    -#include <malloc.h>
    +#if MAC_OR_DOS || defined (__APPLE__)
    +#include <stdlib.h> /* Mac file */
    +#include <malloc.h> /* Unix file */

    #include "variables.h"
    #include "callcpp.h"

    --- Makefile.~0~ 2006-12-30 11:29:45.000000000 -0500
    +++ Makefile 2006-12-30 14:24:38.000000000 -0500
    @@ -67,8 +67,8 @@
    AMTAR = ${SHELL} /Users/devon/Desktop/tesseract-1.02/config/missing --run tar
    AWK = awk
    -CC = gcc
    -CXX = g++
    +CC = gcc -g
    +CXX = g++ -g
    DEPDIR = .deps

  • Fred Leason

    Fred Leason - 2007-01-17

    Logged In: YES
    Originator: NO

    I made suggested patches to Makefile(s) (CC = gcc -g AND CXX = g++ -g) changed reference to /linux/limits.h and strong armed all references to malloc.h to read stdlib.h. Everything compiled in make. I moved the tessdata directory to the ccmain directory and tried executing the following:

    >./tesseract ../phototest.tif ../../tess.txt batch
    Segmentation fault

    So apparently, the -g does not solve the segmentation fault on Mac OS X. Are there any other suggestions?

  • Fred Leason

    Fred Leason - 2007-01-18

    Logged In: YES
    Originator: NO

    Apparently, I should read more carefully. The "-g" just puts hooks into program for GDB. Here is output from GDB:

    >gdb tesseract
    GNU gdb 6.3.50-20050815 (Apple version gdb-477) (Sun Apr 30 20:06:22 GMT 2006)
    Copyright 2004 Free Software Foundation, Inc.
    GDB is free software, covered by the GNU General Public License, and you are
    welcome to change it and/or distribute copies of it under certain conditions.
    Type "show copying" to see the conditions.
    There is absolutely no warranty for GDB. Type "show warranty" for details.
    This GDB was configured as "powerpc-apple-darwin"...Reading symbols for shared libraries ..... done

    (gdb) run ../phototest.tif ../../tess.txt
    Starting program: <me>/Desktop/tesseract-1.02/ccmain/tesseract ../phototest.tif ../../tess.txt
    Reading symbols for shared libraries ....+ done

    Program received signal EXC_BAD_ACCESS, Could not access memory.
    Reason: KERN_INVALID_ADDRESS at address: 0x009c6000
    reverse32 (ptr=0x9c6000) at callcpp.cpp:251
    251 tmp = *cptr;

    The executable is 9MB. Without the -g it was 1.8M. Here are my machine specs:

    Machine Name: iMac
    Machine Model: PowerMac6,1
    CPU Type: PowerPC G4 (3.3)
    Number Of CPUs: 1
    CPU Speed: 1 GHz
    L2 Cache (per CPU): 256 KB
    Memory: 1 GB
    Bus Speed: 133 MHz
    Boot ROM Version: 4.5.9f1
    System Version: Mac OS X 10.4.8 (8L127)
    Kernel Version: Darwin 8.8.0

    Maybe this helps.

  • Nobody/Anonymous

    Logged In: NO

    I don't know if you got an answer yet, but the dbg output is effectively saying the call to reverse32 failed when it attempted to dereference (a probably NULL) pointer cptr.

    I quickly looked at the code and reverse32 is fine, but accepts cptr as a parameter (with its type altered VIA ptr.)

    To further debug, a back trace of the stack is needed. I typically do not use dbg, but it looks like you just type backtrace (you can abbreviate with ba) but may need to type stack ba.

    There is also a ‘full’ option that should print local variables, that may come in handy.

  • Fred Leason

    Fred Leason - 2007-02-22

    Logged In: YES
    Originator: NO

    I'm afraid that back tracing the stack is beyond my technical comfort zone. Hopefully in a year or so, someone with skills (such as yourself) will port and test for OSX. Thanks for trying to help.

  • Ray Smith

    Ray Smith - 2007-05-17
    • status: open --> closed

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks