Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to build: requires compiler support for the ISO C++ 2011 standard #114

Closed
hobbs opened this issue Feb 23, 2018 · 7 comments
Closed

Comments

@hobbs
Copy link

hobbs commented Feb 23, 2018

Summary

I'm looking to use this with Tesseract 4.0 to take advantage of the new LSTM engine. I'm using the PPA recommended by the tesseract project: https://launchpad.net/~alex-p/+archive/ubuntu/tesseract-ocr

When I run go get -t github.com/otiai10/gosseract I get the following output:

# github.com/otiai10/gosseract
In file included from /usr/include/c++/5/cinttypes:35:0,
                 from /usr/include/tesseract/host.h:30,
                 from /usr/include/tesseract/serialis.h:26,
                 from /usr/include/tesseract/baseapi.h:32,
                 from tessbridge.cpp:5:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support \
  ^
In file included from /usr/include/tesseract/apitypes.h:23:0,
                 from /usr/include/tesseract/baseapi.h:27,
                 from tessbridge.cpp:5:
/usr/include/tesseract/publictypes.h:33:1: error: ‘constexpr’ does not name a type
 constexpr int kPointsPerInch = 72;
 ^
/usr/include/tesseract/publictypes.h:33:1: note: C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11
/usr/include/tesseract/publictypes.h:38:1: error: ‘constexpr’ does not name a type
 constexpr int kMinCredibleResolution = 70;
 ^
/usr/include/tesseract/publictypes.h:38:1: note: C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11
/usr/include/tesseract/publictypes.h:40:1: error: ‘constexpr’ does not name a type
 constexpr int kMaxCredibleResolution = 2400;
 ^
/usr/include/tesseract/publictypes.h:40:1: note: C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11
/usr/include/tesseract/publictypes.h:45:1: error: ‘constexpr’ does not name a type
 constexpr int kResolutionEstimationFactor = 10;
 ^
/usr/include/tesseract/publictypes.h:45:1: note: C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11
In file included from /usr/include/tesseract/serialis.h:26:0,
                 from /usr/include/tesseract/baseapi.h:32,
                 from tessbridge.cpp:5:
/usr/include/tesseract/host.h:35:9: error: ‘uint8_t’ does not name a type
 typedef uint8_t uinT8;
         ^
/usr/include/tesseract/host.h:37:9: error: ‘uint16_t’ does not name a type
 typedef uint16_t uinT16;
         ^
/usr/include/tesseract/host.h:39:9: error: ‘uint32_t’ does not name a type
 typedef uint32_t uinT32;
         ^
/usr/include/tesseract/host.h:41:9: error: ‘uint64_t’ does not name a type
 typedef uint64_t uinT64;
         ^

I tried adding // #cgo CFLAGS: -std=c++11 and variations of that to the client.go based on the hints in the error messages.

Reproducibility

Reproducility Frequency

  • 100%
  1. Add tesseract 4.0 ppa to sources (using Ubuntu 16.04)
  2. apt-get install tesseract-ocr libtesseract-dev
  3. go get -t github.com/otiai10/gosseract

Environment

uname -a
Linux zach-neon 4.13.0-36-generic #40~16.04.1-Ubuntu SMP Fri Feb 16 23:25:58 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/zach/src/go"
GORACE=""
GOROOT="/usr/lib/go-1.9"
GOTOOLDIR="/usr/lib/go-1.9/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build175518254=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
tesseract --version
tesseract 4.00.00alpha
 leptonica-1.75.3
  libgif 5.1.4 : libjpeg 8d (libjpeg-turbo 1.4.2) : libpng 1.2.54 : libtiff 4.0.6 : zlib 1.2.8 : libwebp 0.4.4

 Found AVX2
 Found AVX
 Found SSE
@otiai10
Copy link
Owner

otiai10 commented Feb 23, 2018

root@91eea1d506fd:/# go get -t -v github.com/otiai10/gosseract
github.com/otiai10/gosseract
# github.com/otiai10/gosseract
In file included from /usr/include/c++/5/cinttypes:35:0,
                 from /usr/include/tesseract/host.h:30,
                 from /usr/include/tesseract/serialis.h:26,
                 from /usr/include/tesseract/baseapi.h:32,
                 from root/go/src/github.com/otiai10/gosseract/tessbridge.cpp:5:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support \
  ^
In file included from /usr/include/tesseract/apitypes.h:23:0,
                 from /usr/include/tesseract/baseapi.h:27,
                 from root/go/src/github.com/otiai10/gosseract/tessbridge.cpp:5:
/usr/include/tesseract/publictypes.h:33:1: error: 'constexpr' does not name a type
 constexpr int kPointsPerInch = 72;
 ^
/usr/include/tesseract/publictypes.h:33:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
/usr/include/tesseract/publictypes.h:38:1: error: 'constexpr' does not name a type
 constexpr int kMinCredibleResolution = 70;
 ^
/usr/include/tesseract/publictypes.h:38:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
/usr/include/tesseract/publictypes.h:40:1: error: 'constexpr' does not name a type
 constexpr int kMaxCredibleResolution = 2400;
 ^
/usr/include/tesseract/publictypes.h:40:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
/usr/include/tesseract/publictypes.h:45:1: error: 'constexpr' does not name a type
 constexpr int kResolutionEstimationFactor = 10;
 ^
/usr/include/tesseract/publictypes.h:45:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
In file included from /usr/include/tesseract/serialis.h:26:0,
                 from /usr/include/tesseract/baseapi.h:32,
                 from root/go/src/github.com/otiai10/gosseract/tessbridge.cpp:5:
/usr/include/tesseract/host.h:35:9: error: 'uint8_t' does not name a type
 typedef uint8_t uinT8;
         ^
/usr/include/tesseract/host.h:37:9: error: 'uint16_t' does not name a type
 typedef uint16_t uinT16;
         ^
/usr/include/tesseract/host.h:39:9: error: 'uint32_t' does not name a type
 typedef uint32_t uinT32;
         ^
/usr/include/tesseract/host.h:41:9: error: 'uint64_t' does not name a type
 typedef uint64_t uinT64;
         ^

@otiai10
Copy link
Owner

otiai10 commented Feb 23, 2018

- // #cgo CFLAGS: -std=c++11
+ // #cgo CXXFLAGS: -std=c++11

@otiai10
Copy link
Owner

otiai10 commented Feb 23, 2018

summary from my side so far

  • build succeeded with // #cgo CXXFLAGS: -std=c++11, not with CFLAGS
  • under 4.00.00alpha with LSTM, whitelist seems not working on tests
  • checking if the rest runtimes DO NOT GET BROKEN with this change

@otiai10
Copy link
Owner

otiai10 commented Feb 23, 2018

Reproducible Dockerfile

FROM ubuntu:16.04

RUN apt-get update -qq
RUN apt-get install -yq git golang

RUN apt-get install -y software-properties-common
RUN add-apt-repository ppa:alex-p/tesseract-ocr && apt-get update -qq

RUN apt-get install -y \
  tesseract-ocr-dev \
  libleptonica-dev

RUN apt-get install -y \
  tesseract-ocr-eng \
  tesseract-ocr-deu

RUN mkdir /gopath
ENV GOPATH=/gopath
ENV PATH=${PATH}:${GOROOT}/bin:${GOPATH}/bin

# Dependencies for tests
RUN go get github.com/otiai10/mint
RUN go get golang.org/x/net/html

# Mount source code of gosseract project
ADD . ${GOPATH}/src/github.com/otiai10/gosseract

ENTRYPOINT go test -v github.com/otiai10/gosseract

Diff in the application

#elif true should be replaced by something else :p

 // #if __FreeBSD__ >= 10
 // #cgo LDFLAGS: -L/usr/local/lib -llept -ltesseract
+// #elif true
+// #cgo CXXFLAGS: -std=c++11
+// #cgo LDFLAGS: -llept -ltesseract
 // #else
 // #cgo LDFLAGS: -llept -ltesseract
 // #endif

@otiai10
Copy link
Owner

otiai10 commented Feb 23, 2018

tesseract-ocr/tesseract#751

oh...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants