envoyproxy / envoy-filter-example

Example of consuming Envoy and adding a custom filter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build fails repeatedly, with different errors

catper opened this issue · comments

I'm following the README but compilation initially fails with the following message:

mac-se-catper:envoy-filter-example catper$ bazel build //:envoy --verbose_failures
INFO: Analyzed target //:envoy (540 packages loaded, 19946 targets configured).
INFO: Found 1 target...
INFO: From Executing genrule @com_lightstep_tracer_cpp//:generate_version_h:
CMake Warning at CMakeLists.txt:51 (message):
  WITH_GRPC is not set; building without dynamic loading support.


-- The C compiler identification is AppleClang 10.0.1.10010046
-- The CXX compiler identification is AppleClang 10.0.1.10010046
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /var/folders/0g/_kqmbj9x4v7d5rqfj67cq73m1x__yj/T/tmp.jftkhykW
-- Cache values
BUILD_SHARED_LIBS:BOOL=ON
BUILD_STATIC_LIBS:BOOL=ON
CMAKE_BUILD_TYPE:STRING=
CMAKE_EXECUTABLE_FORMAT:STRING=MACHO
CMAKE_INSTALL_PREFIX:PATH=/usr/local
CMAKE_OSX_ARCHITECTURES:STRING=
CMAKE_OSX_DEPLOYMENT_TARGET:STRING=
CMAKE_OSX_SYSROOT:PATH=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
DEFAULT_SSL_ROOTS_PEM:STRING=
ENABLE_LINTING:BOOL=OFF
HEADERS_ONLY:BOOL=ON
WITH_DYNAMIC_LOAD:BOOL=ON
WITH_GRPC:BOOL=OFF
INFO: From Executing genrule @io_opentracing_cpp//:generate_version_h:
-- The C compiler identification is AppleClang 10.0.1.10010046
-- The CXX compiler identification is AppleClang 10.0.1.10010046
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- clang-tidy not found.
-- Configuring done
-- Generating done
-- Build files have been written to: /var/folders/0g/_kqmbj9x4v7d5rqfj67cq73m1x__yj/T/tmp.cO6Dizd4
-- Cache values
BUILD_DYNAMIC_LOADING:BOOL=ON
BUILD_MOCKTRACER:BOOL=OFF
BUILD_SHARED_LIBS:BOOL=ON
BUILD_STATIC_LIBS:BOOL=ON
BUILD_TESTING:BOOL=OFF
CLANG_TIDY_EXE:FILEPATH=CLANG_TIDY_EXE-NOTFOUND
CMAKE_BUILD_TYPE:STRING=
CMAKE_EXECUTABLE_FORMAT:STRING=MACHO
CMAKE_INSTALL_PREFIX:PATH=/usr/local
CMAKE_OSX_ARCHITECTURES:STRING=
CMAKE_OSX_DEPLOYMENT_TARGET:STRING=
CMAKE_OSX_SYSROOT:PATH=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
ENABLE_LINTING:BOOL=ON
ERROR: /private/var/tmp/_bazel_catper/02761ffba8886e583e02dddfa163ae93/external/com_google_protobuf/BUILD:117:1: C++ compilation of rule '@com_google_protobuf//:protobuf_lite' failed (Exit 1) cc_wrapper.sh failed: error executing command
  (cd /private/var/tmp/_bazel_catper/02761ffba8886e583e02dddfa163ae93/sandbox/darwin-sandbox/209/execroot/envoy_filter_example && \
  exec env - \
    PATH=/bin:/usr/bin:/usr/local/bin \
    PWD=/proc/self/cwd \
  external/local_config_cc/cc_wrapper.sh -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -fcolor-diagnostics -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections -fdata-sections '-std=c++0x' -MD -MF bazel-out/host/bin/external/com_google_protobuf/_objs/protobuf_lite/coded_stream.d '-frandom-seed=bazel-out/host/bin/external/com_google_protobuf/_objs/protobuf_lite/coded_stream.o' -iquote external/com_google_protobuf -iquote bazel-out/host/bin/external/com_google_protobuf -isystem external/com_google_protobuf/src -isystem bazel-out/host/bin/external/com_google_protobuf/src -g0 -g0 -DHAVE_PTHREAD -DHAVE_ZLIB -Woverloaded-virtual -Wno-sign-compare -Wno-unused-function -Wno-write-strings -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c external/com_google_protobuf/src/google/protobuf/io/coded_stream.cc -o bazel-out/host/bin/external/com_google_protobuf/_objs/protobuf_lite/coded_stream.o)
Execution platform: @local_config_platform//:host

Use --sandbox_debug to see verbose messages from the sandbox
external/com_google_protobuf/src/google/protobuf/io/coded_stream.cc:915:15: error: cannot initialize a parameter of type 'google::protobuf::uint8 *' (aka 'unsigned char *') with an rvalue of type 'google::protobuf::uint8 **' (aka 'unsigned char **')
  EnsureSpace(&ptr);
              ^~~~
/usr/local/include/google/protobuf/io/coded_stream.h:688:54: note: passing argument to parameter 'ptr' here
  PROTOBUF_MUST_USE_RESULT uint8* EnsureSpace(uint8* ptr) {
                                                     ^
external/com_google_protobuf/src/google/protobuf/io/coded_stream.cc:923:15: error: cannot initialize a parameter of type 'google::protobuf::uint8 *' (aka 'unsigned char *') with an rvalue of type 'google::protobuf::uint8 **' (aka 'unsigned char **')
  EnsureSpace(&ptr);
              ^~~~
/usr/local/include/google/protobuf/io/coded_stream.h:688:54: note: passing argument to parameter 'ptr' here
  PROTOBUF_MUST_USE_RESULT uint8* EnsureSpace(uint8* ptr) {
                                                     ^
2 errors generated.
Target //:envoy failed to build
INFO: Elapsed time: 7.244s, Critical Path: 5.55s
INFO: 15 processes: 15 darwin-sandbox.
FAILED: Build did NOT complete successfully

If I then, just to see what happens, try executing the build again, I get another error message:

mac-se-catper:envoy-filter-example catper$ bazel build //:envoy --verbose_failures
INFO: Analyzed target //:envoy (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /private/var/tmp/_bazel_catper/02761ffba8886e583e02dddfa163ae93/external/com_google_protobuf/BUILD:117:1: C++ compilation of rule '@com_google_protobuf//:protobuf_lite' failed (Exit 1) cc_wrapper.sh failed: error executing command
  (cd /private/var/tmp/_bazel_catper/02761ffba8886e583e02dddfa163ae93/sandbox/darwin-sandbox/230/execroot/envoy_filter_example && \
  exec env - \
    PATH=/bin:/usr/bin:/usr/local/bin \
    PWD=/proc/self/cwd \
  external/local_config_cc/cc_wrapper.sh -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -fcolor-diagnostics -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections -fdata-sections '-std=c++0x' -MD -MF bazel-out/host/bin/external/com_google_protobuf/_objs/protobuf_lite/arena.d '-frandom-seed=bazel-out/host/bin/external/com_google_protobuf/_objs/protobuf_lite/arena.o' -iquote external/com_google_protobuf -iquote bazel-out/host/bin/external/com_google_protobuf -isystem external/com_google_protobuf/src -isystem bazel-out/host/bin/external/com_google_protobuf/src -g0 -g0 -DHAVE_PTHREAD -DHAVE_ZLIB -Woverloaded-virtual -Wno-sign-compare -Wno-unused-function -Wno-write-strings -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c external/com_google_protobuf/src/google/protobuf/arena.cc -o bazel-out/host/bin/external/com_google_protobuf/_objs/protobuf_lite/arena.o)
Execution platform: @local_config_platform//:host

Use --sandbox_debug to see verbose messages from the sandbox
external/com_google_protobuf/src/google/protobuf/arena.cc:147:1: warning: attribute declaration must precede definition [-Wignored-attributes]
PROTOBUF_FUNC_ALIGN(32)
^
/usr/local/include/google/protobuf/port_def.inc:207:51: note: expanded from macro 'PROTOBUF_FUNC_ALIGN'
#define PROTOBUF_FUNC_ALIGN(bytes) __attribute__((aligned(bytes)))
                                                  ^
/usr/local/include/google/protobuf/arena_impl.h:110:9: note: previous definition is here
  void* AllocateAligned(size_t n) {
        ^
external/com_google_protobuf/src/google/protobuf/arena.cc:148:18: error: redefinition of 'AllocateAligned'
void* ArenaImpl::AllocateAligned(size_t n) {
                 ^
/usr/local/include/google/protobuf/arena_impl.h:110:9: note: previous definition is here
  void* AllocateAligned(size_t n) {
        ^
external/com_google_protobuf/src/google/protobuf/arena.cc:192:47: error: redefinition of 'GetSerialArenaFast'
inline PROTOBUF_ALWAYS_INLINE bool ArenaImpl::GetSerialArenaFast(
                                              ^
/usr/local/include/google/protobuf/arena_impl.h:331:31: note: previous definition is here
  PROTOBUF_ALWAYS_INLINE bool GetSerialArenaFast(SerialArena** arena) {
                              ^
1 warning and 2 errors generated.
Target //:envoy failed to build
ERROR: /private/var/tmp/_bazel_catper/02761ffba8886e583e02dddfa163ae93/external/envoy_api/envoy/annotations/BUILD:5:1 C++ compilation of rule '@com_google_protobuf//:protobuf_lite' failed (Exit 1) cc_wrapper.sh failed: error executing command
  (cd /private/var/tmp/_bazel_catper/02761ffba8886e583e02dddfa163ae93/sandbox/darwin-sandbox/230/execroot/envoy_filter_example && \
  exec env - \
    PATH=/bin:/usr/bin:/usr/local/bin \
    PWD=/proc/self/cwd \
  external/local_config_cc/cc_wrapper.sh -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -fcolor-diagnostics -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections -fdata-sections '-std=c++0x' -MD -MF bazel-out/host/bin/external/com_google_protobuf/_objs/protobuf_lite/arena.d '-frandom-seed=bazel-out/host/bin/external/com_google_protobuf/_objs/protobuf_lite/arena.o' -iquote external/com_google_protobuf -iquote bazel-out/host/bin/external/com_google_protobuf -isystem external/com_google_protobuf/src -isystem bazel-out/host/bin/external/com_google_protobuf/src -g0 -g0 -DHAVE_PTHREAD -DHAVE_ZLIB -Woverloaded-virtual -Wno-sign-compare -Wno-unused-function -Wno-write-strings -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c external/com_google_protobuf/src/google/protobuf/arena.cc -o bazel-out/host/bin/external/com_google_protobuf/_objs/protobuf_lite/arena.o)
Execution platform: @local_config_platform//:host

Use --sandbox_debug to see verbose messages from the sandbox
INFO: Elapsed time: 1.682s, Critical Path: 1.39s
INFO: 6 processes: 6 darwin-sandbox.
FAILED: Build did NOT complete successfully
mac-se-catper:envoy-filter-example catper$

I haven't changed anything from cloning the project, I'm just trying to compile the provided example. FWIW I am able to build Envoy in "stand-alone mode", i.e. if I clone and build envoy outside of the context of trying to incorporate a new filter, I have no issues.

If anyone has an idea as to what's going on here please let me know. Thanks!

this is apparently down to a conflict with protoc, uninstalling protobuf resolves the issue