envoyproxy / envoy

Cloud-native high-performance edge/middle/service proxy
https://www.envoyproxy.io
Apache License 2.0
24.8k stars 4.77k forks source link

Build failure with gcc 12: argument 4 of type 'uint8_t *' {aka 'unsigned char *'} declared as a pointer #23646

Closed zonque closed 1 year ago

zonque commented 1 year ago

Trying to build on Fedora 36 with gcc 12.2.1 yields the following build error:

ERROR: /home/daniel/.cache/bazel/_bazel_daniel/fd88e858bb086983b413894fda08323b/external/org_brotli/BUILD:113:11: Compiling c/dec/decode.c failed: (Exit 1): gcc failed: error executing command (from target @org_brotli//:brotlidec) /usr/lib64/ccache/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections ... (remaining 36 arguments skipped)
external/org_brotli/c/dec/decode.c:2036:41: error: argument 2 of type 'const uint8_t *' {aka 'const unsigned char *'} declared as a pointer [-Werror=vla-parameter]
 2036 |     size_t encoded_size, const uint8_t* encoded_buffer, size_t* decoded_size,
      |                          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
In file included from external/org_brotli/c/dec/decode.c:7:
bazel-out/k8-opt/bin/external/org_brotli/_virtual_includes/brotli_inc/brotli/decode.h:204:19: note: previously declared as a variable length array 'const uint8_t[encoded_size]' {aka 'const unsigned char[encoded_size]'}
  204 |     const uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(encoded_size)],
      |     ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
external/org_brotli/c/dec/decode.c:2037:14: error: argument 4 of type 'uint8_t *' {aka 'unsigned char *'} declared as a pointer [-Werror=vla-parameter]
 2037 |     uint8_t* decoded_buffer) {
      |     ~~~~~~~~~^~~~~~~~~~~~~~
bazel-out/k8-opt/bin/external/org_brotli/_virtual_includes/brotli_inc/brotli/decode.h:206:13: note: previously declared as a variable length array 'uint8_t[*decoded_size]' {aka 'unsigned char[*decoded_size]'}
  206 |     uint8_t decoded_buffer[BROTLI_ARRAY_PARAM(*decoded_size)]);
      |     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
keith commented 1 year ago

https://github.com/envoyproxy/envoy/issues/23570

Webster-Yang commented 1 year ago

How to solve it?

uname -a Linux tv3--c9d4bf90 5.15.0-52-generic #58-Ubuntu SMP Thu Oct 13 08:03:55 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

g++ --version g++ (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0 Copyright (C) 2021 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 PA

bazel version Build label: 6.0.0-pre.20220421.3 Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar Build time: Tue May 3 16:41:11 2022 (1651596071) Build timestamp: 1651596071 Build timestamp as int: 1651596071

ERROR: external/org_brotli/c/dec/decode.c:2036:41: error: argument 2 of type 'const uint8_t ' {aka 'const unsigned char '} declared as a pointer [-Werror=vla-parameter] 2036 | size_t encoded_size, const uint8_t encoded_buffer, size_t decoded_size, | ~~~^~~~~~ In file included from external/org_brotli/c/dec/decode.c:7: bazel-out/k8-dbg/bin/external/org_brotli/_virtual_includes/brotli_inc/brotli/decode.h:204:19: note: previously declared as a variable length array 'const uint8_t[decoded_size]' {aka 'const unsigned char[decoded_size]'} 204 | const uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(encoded_size)], | ~~~~^~~~~~~~~~ external/org_brotli/c/dec/decode.c:2037:14: error: argument 4 of type 'uint8_t ' {aka 'unsigned char '} declared as a pointer [-Werror=vla-parameter] 2037 | uint8_t decoded_buffer) { | ~~~^~~~ In file included from external/org_brotli/c/dec/decode.c:7: bazel-out/k8-dbg/bin/external/org_brotli/_virtual_includes/brotli_inc/brotli/decode.h:206:13: note: previously declared as a variable length array 'uint8_t[encoded_size]' {aka 'unsigned char[encoded_size]'} 206 | uint8_t decoded_buffer[BROTLI_ARRAY_PARAM(decoded_size)]);

@zonque @keith

Webster-Yang commented 1 year ago

bazel build --jobs=12 --test_filter="skip-all-test" --copt="-DENVOY_IGNORE_GLIBCXX_USE_CXX11_ABI_ERROR=1" --cxxopt="-DENVOY_IGNORE_GLIBCXX_USE_CXX11_ABI_ERROR=1" --define=ENVOY_IGNORE_GLIBCXX_USE_CXX11_ABI_ERROR=1 --cxxopt='-std=c++17' --//bazel:http3=False --subcommands --verbose_failures --sandbox_debug --cxxopt="-Wno-type-limits" --copt="-Wno-array-bounds" --copt="-Wno-vla-parameter" --copt="-Werror=range-loop-construct" -c dbg //source/exe:envoy-static

1671110591.210527617: src/main/tools/linux-sandbox-pid1.cc:481: child started with PID 2 external/grpc_httpjson_transcoding/src/path_matcher_node.cc: In member function 'void google::grpc::transcoding::PathMatcherNode::LookupPath(std::vector::const_iterator, std::vector::const_iterator, google::grpc::transcoding::HttpMethod, google::grpc::transcoding::PathMatcherLookupResult) const': external/grpc_httpjson_transcoding/src/path_matcher_node.cc:171:27: error: loop variable 'child_key' of type 'const string&' {aka 'const std::__cxx11::basic_string&'} binds to a temporary constructed from type 'const char const' [-Werror=range-loop-construct] 171 | for (const std::string& child_key : | ^~~~~ external/grpc_httpjson_transcoding/src/path_matcher_node.cc:171:27: note: use non-reference type 'const string' {aka 'const std::__cxx11::basic_string'} to make the copy explicit or 'const char* const&' to prevent copying cc1plus: some warnings being treated as errors 1671110592.270675362: src/main/tools/linux-sandbox-pid1.cc:498: wait returned pid=2, status=0x100 1671110592.270779674: src/main/tools/linux-sandbox-pid1.cc:516: child exited normally with code 1 1671110592.271164805: src/main/tools/linux-sandbox.cc:233: child exited normally with code 1 Target //source/exe:envoy-static failed to build INFO: Elapsed time: 2558.791s, Critical Path: 54.19s INFO: 3010 processes: 24 internal, 2986 linux-sandbox. FAILED: Build did NOT complete successfully envoy_buld3.sh: 21: [[: not found next build 1 build done

@zonque @keith

zonque commented 1 year ago

Please don't tag me in these. I just reported build issues, I can't help you fix them.