DanBloomberg / leptonica

Leptonica is an open source library containing software that is broadly useful for image processing and image analysis applications. The official github repository for Leptonica is: danbloomberg/leptonica. See leptonica.org for more documentation.
Other
1.8k stars 393 forks source link

Failed to Build Both Leptonica 1.74.1 & Leptonica 1.74.2 #261

Closed ibr123 closed 7 years ago

ibr123 commented 7 years ago

Hi,

I wanted to install and compile leptonica 1.74.1 and then tesseract 4.00.00alpha on a server following this website but it failed giving me this error: env_error what is weird that its not the first time i installed leptonica 1.74.1 , i installed leptonica 1.74.1 on a virtual box (OS was Ubuntu 14.04) twice and worked in both cases, also i installed it on a VM (OS was also Ubuntu 14.04) and worked as well, but now I'm trying to install it on AWS server (with OS Ubuntu 14.04) and this time i got the error, in all four cases i followed the steps and installed the dependencies that was mention in the website that i have mentioned above, but only failed in the last trial, i even tried to install Leptonica 1.74.2 on the AWS server yet the same problem occurred.

keep in mind, that due to some changes in the tesseract, i keep first version that worked at the first time for the tesseract and for the Leptonica 1.74.1 as a backup, i tried also to copy them and compile them but failed at Leptonica 1.47.1

in all cases i used same OS which is Ubuntu 14.04, and same dependencies that are mentioned in the website above, and Leptonica 1.74.1 but error came at last trial. Any ideas to solve this issue?

Thanks


UPDATE: in case there is more specification i should have added, please ask me to

DanBloomberg commented 7 years ago

I have no idea what the problem is.

The line it is complaining about is legal C. The message looks to me as if your C preprocessor is defective.

xsacha commented 7 years ago

Looks like FALSE is being misused somewhere in the code but GCC is showing you the define instead.

Example: test.h #define FALSE 0 test2.h #include "test.h" typedef bool FALSE;

Output test.h:1:15: error: expected unqualified-id before numeric constant

stweil commented 7 years ago

@xsacha, that's a very important hint, thank you. @ibr123, what happens if you change the line in src/environ.h to //#define FALSE 0?

ibr123 commented 7 years ago

@stweil if i deleted that line it will affect the file adaptmap.c because its been used there 4 times and will give an error, 'FALSE' undeclared, i don't know how else i can change it. this is the error i got env_error2

@xsacha i installed leptonica1.74.1 and compiled it on another machine and worked fine, on a VM actually, the OS on the AWS server which fails at compiling is Ubuntu 14.04 and the OS on the VM is Ubuntu 14.04.3, i don't think these two versions can differ enough to cause this trouble in the compilation, could they?

xsacha commented 7 years ago

Since you have a working system and a non-working system, you can get the build log from both and compare (or paste links here)

ibr123 commented 7 years ago

@xsacha i didn't know that there is a log for build, would you please tell me where i can find it? Thanks

xsacha commented 7 years ago

The config.log would be useful to see the differences

stweil commented 7 years ago

@ibr123, the error occurred when compiling jpegio.c, so just remove the definition for FALSE and skip the errors caused by that in all other files, for example by using make -k.

DanBloomberg commented 7 years ago

It seems to me that there shouldn't be anything in the environment that would interfere with the compilation of a library. That is, the library should be able to specify the definition of all terms that are used (except for the names reserved by the C compiler and the included C library functions).

So for example, FALSE shouldn't be allowed to be typedef'd to a bool when leptonica (which is a C library that doesn't even have the bool keyword) is being compiled.

Which indicates that there is some C++ library header file that is being included by the compiler, that is causing the problem.

mgrint2 commented 7 years ago

I am trying to install leptonica on Centos and was getting the error below configlog is attached.

[root@delhi40 leptonica-1.74.1]# ./configure checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking how to print strings... printf checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... configure: error: in /root/install-tesseract-redhat-centos-master/leptonica-1.74.1': configure: error: cannot run C compiled programs. If you meant to cross compile, use--host'. See `config.log' for more details [root@delhi40 leptonica-1.74.1]# more config.log This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake.

It was created by leptonica configure 1.74.1, which was generated by GNU Autoconf 2.69. Invocation command line was

$ ./configure

---------

Platform.

---------

hostname = delhi40.bol.net.in uname -m = x86_64 uname -r = 3.10.0-123.el7.x86_64 uname -s = Linux uname -v = #1 SMP Mon Jun 30 12:09:22 UTC 2014

/usr/bin/uname -p = x86_64 /bin/uname -X = unknown

/bin/arch = x86_64 /usr/bin/arch -k = unknown /usr/convex/getsysinfo = unknown /usr/bin/hostinfo = unknown /bin/machine = unknown /usr/bin/oslevel = unknown /bin/universe = unknown

PATH: /usr/lib64/qt-3.3/bin PATH: /root/perl5/bin PATH: /usr/local/sbin PATH: /usr/local/bin PATH: /usr/sbin PATH: /usr/bin PATH: /root/bin

-----------

Core tests.

-----------

configure:2350: checking build system type configure:2364: result: x86_64-unknown-linux-gnu configure:2384: checking host system type configure:2397: result: x86_64-unknown-linux-gnu configure:2438: checking how to print strings configure:2465: result: printf configure:2534: checking for gcc configure:2550: found /usr/bin/gcc configure:2561: result: gcc configure:2790: checking for C compiler version configure:2799: gcc --version >&5 gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-16) Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:2810: $? = 0 configure:2799: gcc -v >&5 Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/lto-wrapper Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.c om/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_at exit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-langua ges=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/B UILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat- linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux Thread model: posix gcc version 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) configure:2810: $? = 0 configure:2799: gcc -V >&5 gcc: error: unrecognized command line option '-V' gcc: fatal error: no input files compilation terminated. configure:2810: $? = 4 configure:2799: gcc -qversion >&5 gcc: error: unrecognized command line option '-qversion' gcc: fatal error: no input files compilation terminated. configure:2810: $? = 4 configure:2830: checking whether the C compiler works configure:2852: gcc conftest.c >&5 configure:2856: $? = 0 configure:2904: result: yes configure:2907: checking for C compiler default output file name configure:2909: result: a.out configure:2915: checking for suffix of executables configure:2922: gcc -o conftest conftest.c >&5 configure:2926: $? = 0 configure:2948: result: configure:2970: checking whether we are cross compiling configure:2978: gcc -o conftest conftest.c >&5 In file included from conftest.c:9:0: /usr/include/stdio.h:33:21: fatal error: stddef.h: No such file or directory

include

                 ^

compilation terminated. configure:2982: $? = 1 configure:2989: ./conftest ./configure: line 2991: ./conftest: No such file or directory configure:2993: $? = 127 configure:3000: error: in /root/install-tesseract-redhat-centos-master/leptonica-1.74.1': configure:3002: error: cannot run C compiled programs. If you meant to cross compile, use--host'. See `config.log' for more details

----------------

Cache variables.

----------------

ac_cv_build=x86_64-unknown-linux-gnu ac_cv_env_CC_set= ac_cv_env_CC_value= ac_cv_env_CFLAGS_set= ac_cv_env_CFLAGS_value= ac_cv_env_CPPFLAGS_set= ac_cv_env_CPPFLAGS_value= ac_cv_env_CPP_set= ac_cv_env_CPP_value= ac_cv_env_LDFLAGS_set= ac_cv_env_LDFLAGS_value= ac_cv_env_LIBS_set= ac_cv_env_LIBS_value= ac_cv_env_build_alias_set= ac_cv_env_build_alias_value= ac_cv_env_host_alias_set= ac_cv_env_host_alias_value= ac_cv_env_target_alias_set= ac_cv_env_target_alias_value= ac_cv_host=x86_64-unknown-linux-gnu ac_cv_prog_ac_ct_CC=gcc

-----------------

Output variables.

-----------------

ACLOCAL='' AMDEPBACKSLASH='' AMDEP_FALSE='' AMDEP_TRUE='' AMTAR='' AM_BACKSLASH='' AM_DEFAULT_V='' AM_DEFAULT_VERBOSITY='' AM_V='' APPLE_UNIVERSAL_BUILD='' AR='' AUTOCONF='' AUTOHEADER='' AUTOMAKE='' AWK='' CC='gcc' CCDEPMODE='' CFLAGS='' CPP='' CPPFLAGS='' CYGPATH_W='' DEFS='' DEPDIR='' DLLTOOL='' DSYMUTIL='' DUMPBIN='' ECHO_C='' ECHO_N='-n' ECHO_T='' EGREP='' ENABLE_PROGRAMS_FALSE='' ENABLE_PROGRAMS_TRUE='' ENDIANNESS='' EXEEXT='' FGREP='' GDI_LIBS='' GIFLIB_LIBS='' GREP='' HAVE_LIBGIF_FALSE='' HAVE_LIBGIF_TRUE='' HAVE_LIBJP2K_FALSE='' HAVE_LIBJP2K_TRUE='' HAVE_LIBWEBP_FALSE='' HAVE_LIBWEBP_TRUE='' INSTALL_DATA='' INSTALL_PROGRAM='' INSTALL_SCRIPT='' INSTALL_STRIP_PROGRAM='' JPEG_LIBS='' LD='' LDFLAGS='' LIBJP2K_LIBS='' LIBM='' LIBOBJS='' LIBPNG_LIBS='' LIBS='' LIBTIFF_LIBS='' LIBTOOL='' LIBWEBP_LIBS='' LIPO='' LN_S='' LTLIBOBJS='' MAKEINFO='' MANIFEST_TOOL='' MKDIR_P='' NM='' NMEDIT='' OBJDUMP='' OBJEXT='' OTOOL64='' OTOOL='' PACKAGE='' PACKAGE_BUGREPORT='' PACKAGE_NAME='leptonica' PACKAGE_STRING='leptonica 1.74.1' PACKAGE_TARNAME='leptonica' PACKAGE_URL='' PACKAGE_VERSION='1.74.1' PATH_SEPARATOR=':' RANLIB='' SED='' SET_MAKE='' SHELL='/bin/sh' STRIP='' VERSION='' ZLIB_LIBS='' ac_ct_AR='' ac_ct_CC='gcc' ac_ct_DUMPBIN='' amEXEEXT_FALSE='' am__EXEEXT_TRUE='' amfastdepCC_FALSE='' amfastdepCC_TRUE='' aminclude='' amisrc='' am__leading_dot='' amnodep='' amquote='' amtar='' am__untar='' bindir='${exec_prefix}/bin' build='x86_64-unknown-linux-gnu' build_alias='' build_cpu='x86_64' build_os='linux-gnu' build_vendor='unknown' datadir='${datarootdir}' datarootdir='${prefix}/share' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' dvidir='${docdir}' exec_prefix='NONE' host='x86_64-unknown-linux-gnu' host_alias='' host_cpu='x86_64' host_os='linux-gnu' host_vendor='unknown' htmldir='${docdir}' includedir='${prefix}/include' infodir='${datarootdir}/info' install_sh='' libdir='${exec_prefix}/lib' libexecdir='${exec_prefix}/libexec' localedir='${datarootdir}/locale' localstatedir='${prefix}/var' mandir='${datarootdir}/man' mkdir_p='' oldincludedir='/usr/include' pdfdir='${docdir}' prefix='NONE' program_transform_name='s,x,x,' psdir='${docdir}' sbindir='${exec_prefix}/sbin' sharedstatedir='${prefix}/com' sysconfdir='${prefix}/etc' target_alias=''

-----------

confdefs.h.

-----------

/ confdefs.h /

define PACKAGE_NAME "leptonica"

define PACKAGE_TARNAME "leptonica"

define PACKAGE_VERSION "1.74.1"

define PACKAGE_STRING "leptonica 1.74.1"

define PACKAGE_BUGREPORT ""

define PACKAGE_URL ""

configure: exit 1

Not able to compile please help i am trying for two days [

mgrint2 commented 7 years ago

Pls help @DanBloomberg as i have to install leptonica and tesseract on my machine and not able to compile both package .

DanBloomberg commented 7 years ago

@mgrint2 See my response on #262, which you opened. This issue is different.

ibr123 commented 7 years ago

Hi guys,

i tried the suggestion above about make -k, it passed the compilation of the leptonica and the tesseract, yet when i verified the installed version it was older than 1.74.1 and tesseract was 3.03 instead of 4.00 so that means the correct versions were not installed.

so i tried again but with deleting the definition of FALSE & TRUE and replaced each FALSE with 0 and each True with 1 in all .c scripts that generated "undefined" errors for both FALSE and TRUE, then i was able to "make" all files inside the src folder, but when "make" to the folder prog i got the following error env_error4

keep in mind that the dependency "libtiff4-dev" is already installed, any ideas? Thanks

DanBloomberg commented 7 years ago

It looks like you're using autotools, which if it finds a specific function in the tiff library, compiles tiffio.c (instead of tiffiostub.c) and links in the library. But now it is acting as if the library can't be found.

Try building with cmake, and see if you get the same problem.

DanBloomberg commented 7 years ago

Closing.