diff --git a/linux/build b/linux/build index 4c932a4f..c5c8b2ef 100755 --- a/linux/build +++ b/linux/build @@ -77,7 +77,7 @@ then fi if [[ $out == *"capi.h: No such file or directory"* ]] then - echo "Error: please install tesseract development library (tesseract-ocr-dev for Debian/Ubuntu)"; + echo "Error: please install tesseract development library (libtesseract-dev for Debian/Ubuntu)"; exit 3 fi if [[ $out == *"allheaders.h: No such file or directory"* ]] diff --git a/linux/builddebug b/linux/builddebug index fcdc32e1..758c2d79 100755 --- a/linux/builddebug +++ b/linux/builddebug @@ -1,11 +1,11 @@ #!/bin/bash -BLD_FLAGS="-g -std=gnu99 -Wno-write-strings -Wno-unused-result -DGPAC_CONFIG_LINUX -D_FILE_OFFSET_BITS=64 -DVERSION_FILE_PRESENT -DENABLE_OCR -DFT2_BUILD_LIBRARY -DGPAC_DISABLE_VTT -DGPAC_DISABLE_OD_DUMP" +BLD_FLAGS="-g -std=gnu99 -Wno-write-strings -DGPAC_CONFIG_LINUX -D_FILE_OFFSET_BITS=64 -DVERSION_FILE_PRESENT -DENABLE_OCR -DFT2_BUILD_LIBRARY -DGPAC_DISABLE_VTT -DGPAC_DISABLE_OD_DUMP" bit_os=$(getconf LONG_BIT) if [ "$bit_os"=="64" ] then - BLD_FLAGS="$BLD_FLAGS -DGPAC_64_BITS" + BLD_FLAGS="$BLD_FLAGS -DGPAC_64_BITS" fi -BLD_INCLUDE="-I../src -I /usr/local/include/leptonica/ -I /usr/local/include/tesseract/ -I /usr/include/leptonica/ -I /usr/include/tesseract/ -I../src/lib_ccx/ -I../src/gpacmp4/ -I../src/libpng/ -I../src/zlib/ -I../src/zvbi -I../src/lib_hash -I../src/protobuf-c -I../src/utf8proc -I../src/freetype/include" +BLD_INCLUDE="-I../src -I /usr/include/leptonica/ -I /usr/include/tesseract/ -I../src/lib_ccx/ -I../src/gpacmp4/ -I../src/libpng/ -I../src/zlib/ -I../src/zvbi -I../src/lib_hash -I../src/protobuf-c -I../src/utf8proc -I../src/freetype/include" SRC_LIBPNG="$(find ../src/libpng/ -name '*.c')" SRC_ZLIB="$(find ../src/zlib/ -name '*.c')" SRC_ZVBI="$(find ../src/zvbi/ -name '*.c')" @@ -58,11 +58,42 @@ SRC_FREETYPE="../src/freetype/autofit/autofit.c API_WRAPPERS="$(find ../src/wrappers/ -name '*.c')" BLD_SOURCES="../src/ccextractor.c $SRC_CCX $SRC_GPAC $SRC_ZLIB $SRC_ZVBI $SRC_LIBPNG $SRC_HASH $SRC_PROTOBUF $SRC_UTF8PROC $API_WRAPPERS $SRC_FREETYPE" BLD_LINKER="-lm -zmuldefs -l tesseract -l lept" -#BLD_DEBUG="-g -O1 -fsanitize=address -fno-omit-frame-pointer" -BLD_DEBUG="" echo "Running pre-build script..." ./pre-build.sh echo "Trying to compile..." -gcc $BLD_DEBUG $BLD_FLAGS $BLD_INCLUDE -o ccextractor $BLD_SOURCES $BLD_LINKER +out=$((LC_ALL=C gcc $BLD_FLAGS $BLD_INCLUDE -o ccextractor $BLD_SOURCES $BLD_LINKER)2>&1) +res=$? +if [[ $out == *"gcc: command not found"* ]] +then + echo "Error: please install gcc"; + exit 1 +fi +if [[ $out == *"curl.h: No such file or directory"* ]] +then + echo "Error: please install curl development library (libcurl4-gnutls-dev for Debian/Ubuntu)"; + exit 2 +fi +if [[ $out == *"capi.h: No such file or directory"* ]] +then + echo "Error: please install tesseract development library (libtesseract-dev for Debian/Ubuntu)"; + exit 3 +fi +if [[ $out == *"allheaders.h: No such file or directory"* ]] +then + echo "Error: please install leptonica development library (libleptonica-dev for Debian/Ubuntu)"; + exit 4 +fi +if [[ $res -ne 0 ]] # Unknown error +then + echo "Compiled with errors" + >&2 echo "$out" + exit 5 +fi +if [[ "$out" != "" ]] ; then + echo "$out" + echo "Compilation successful, compiler message shown in previous lines" +else + echo "Compilation successful, no compiler messages." +fi