google / zetasql

ZetaSQL - Analyzer Framework for SQL
Apache License 2.0
2.28k stars 214 forks source link

build zetasql in ubuntu docker failed #144

Closed zjingwang closed 1 year ago

zjingwang commented 1 year ago

Hi, i tried to build zetasql in ubuntu docker and got the error below

error

ERROR: /zetasql/zetasql/public/BUILD:515:11: Compiling zetasql/public/json_value.cc failed: (Exit 1): gcc failed: error executing command (from target //zetasql/public:json_value) /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++17' -MD -MF ... (remaining 57 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
zetasql/public/json_value.cc: In static member function 'static absl::StatusOr<zetasql::JSONValue> zetasql::JSONValue::ParseJSONString(absl::string_view, zetasql::JSONParsingOptions)':
zetasql/public/json_value.cc:461:10: error: could not convert 'json' from 'zetasql::JSONValue' to 'absl::StatusOr<zetasql::JSONValue>'
   return json;
          ^~~~
zetasql/public/json_value.cc: In static member function 'static absl::StatusOr<zetasql::JSONValue> zetasql::JSONValue::DeserializeFromProtoBytes(absl::string_view, std::optional<int>)':
zetasql/public/json_value.cc:471:10: error: could not convert 'json' from 'zetasql::JSONValue' to 'absl::StatusOr<zetasql::JSONValue>'
   return json;
          ^~~~
At global scope:
cc1plus: warning: unrecognized command line option '-Wno-stringop-truncation'
cc1plus: warning: unrecognized command line option '-Wno-class-memaccess'
INFO: Elapsed time: 653.156s, Critical Path: 79.20s
INFO: 1036 processes: 493 internal, 543 processwrapper-sandbox.
FAILED: Build did NOT complete successfully

Dockerfile

FROM ubuntu:18.04 as build
ENV DEBIAN_FRONTEND=noninteractive

COPY ./zetasql /zetasql
COPY ./bazelisk bazelisk
COPY bazel-release.pub.gpg /tmp/bazel-release.pub.gpg

RUN chmod +x bazelisk && cp bazelisk  /usr/bin

RUN apt-get update \
  && apt-get install -y curl gnupg \
  && echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list \
  && apt-key add /tmp/bazel-release.pub.gpg \
  && apt-get update \
  && apt-get install -y \
    bazel \
    g++ \
    git \
    make \
    openjdk-8-jdk-headless \
    python \
    python3-distutils \
    tzdata \
  && apt-get autoremove -y \
  && apt-get clean -y \
  && rm -rf /var/lib/apt/lists/*