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

org_brotli: previously declared as a variable length array #23570

Closed
sergey-safarov opened this issue Oct 19, 2022 · 8 comments · Fixed by #23668
Closed

org_brotli: previously declared as a variable length array #23570

sergey-safarov opened this issue Oct 19, 2022 · 8 comments · Fixed by #23668
Assignees

Comments

@sergey-safarov
Copy link

Fedora 37

ERROR: /root/.cache/bazel/_bazel_root/221703495c2e97a5482194eda3ea2f8b/external/org_brotli/BUILD:121:11: Compiling c/enc/encode.c failed: (Exit 1): process-wrapper failed: error executing command 
  (cd /root/.cache/bazel/_bazel_root/221703495c2e97a5482194eda3ea2f8b/sandbox/processwrapper-sandbox/2085/execroot/envoy && \
  exec env - \
    BAZEL_LINKLIBS=-l%:libstdc++.a \
    BAZEL_LINKOPTS=-lm \
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
    PWD=/proc/self/cwd \
    TMPDIR=/tmp \
  /root/.cache/bazel/_bazel_root/install/8e95a048c207b512398439efd48d7df6/process-wrapper '--timeout=0' '--kill_delay=15' /usr/bin/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 -fdata-sections -MD -MF bazel-out/aarch64-opt/bin/external/org_brotli/_objs/brotlienc/encode.d '-frandom-seed=bazel-out/aarch64-opt/bin/external/org_brotli/_objs/brotlienc/encode.o' -gsplit-dwarf -g -iquote external/org_brotli -iquote bazel-out/aarch64-opt/bin/external/org_brotli -Ibazel-out/aarch64-opt/bin/external/org_brotli/_virtual_includes/brotli_inc '-DABSL_MIN_LOG_LEVEL=4' -fPIC -Wno-deprecated-declarations -Wno-array-bounds -fexceptions --pedantic-errors -Wall -Wconversion -Werror -Wextra -Wlong-long -Wmissing-declarations -Wmissing-prototypes -Wno-strict-aliasing -Wshadow -Wsign-compare -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c external/org_brotli/c/enc/encode.c -o bazel-out/aarch64-opt/bin/external/org_brotli/_objs/brotlienc/encode.o)
external/org_brotli/c/enc/encode.c:1473:20: error: argument 5 of type 'const uint8_t *' {aka 'const unsigned char *'} declared as a pointer [-Werror=vla-parameter]
 1473 |     const uint8_t* input_buffer, size_t* encoded_size,
      |     ~~~~~~~~~~~~~~~^~~~~~~~~~~~
In file included from external/org_brotli/c/enc/encode.c:9:
bazel-out/aarch64-opt/bin/external/org_brotli/_virtual_includes/brotli_inc/brotli/encode.h:314:19: note: previously declared as a variable length array 'const uint8_t[input_size]' {aka 'const unsigned char[input_size]'}
  314 |     const uint8_t input_buffer[BROTLI_ARRAY_PARAM(input_size)],
      |     ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
external/org_brotli/c/enc/encode.c:1474:14: error: argument 7 of type 'uint8_t *' {aka 'unsigned char *'} declared as a pointer [-Werror=vla-parameter]
 1474 |     uint8_t* encoded_buffer) {
      |     ~~~~~~~~~^~~~~~~~~~~~~~
bazel-out/aarch64-opt/bin/external/org_brotli/_virtual_includes/brotli_inc/brotli/encode.h:316:13: note: previously declared as a variable length array 'uint8_t[*encoded_size]' {aka 'unsigned char[*encoded_size]'}
  316 |     uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(*encoded_size)]);
      |     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
Target //source/exe:envoy-static failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 93.758s, Critical Path: 35.30s
INFO: 15 processes: 4 internal, 11 processwrapper-sandbox.
FAILED: Build did NOT complete successfully

compiler

bash-5.1# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/aarch64-redhat-linux/12/lto-wrapper
Target: aarch64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --enable-libstdcxx-backtrace --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-12.2.1-20220819/obj-aarch64-redhat-linux/isl-install --enable-gnu-indirect-function --build=aarch64-redhat-linux --with-build-config=bootstrap-lto --enable-link-serialization=1
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.1 20220819 (Red Hat 12.2.1-2) (GCC) 
@sergey-safarov sergey-safarov added the triage Issue requires triage label Oct 19, 2022
@wbpcode wbpcode removed the triage Issue requires triage label Oct 21, 2022
@wbpcode
Copy link
Member

wbpcode commented Oct 21, 2022

may be you can build the envoy with the building image to avoid the effects of compiler/os version?

@wbpcode
Copy link
Member

wbpcode commented Oct 21, 2022

cc @keith

@keith keith self-assigned this Oct 25, 2022
keith added a commit to keith/envoy that referenced this issue Oct 25, 2022
This fixes envoyproxy#23570 and envoyproxy#23342

There haven't been many commits since the previous pinned version, here
is the full diff: google/brotli@0cd2e39...6d03dfb

Signed-off-by: Keith Smiley <keithbsmiley@gmail.com>
@keith
Copy link
Member

keith commented Oct 25, 2022

fixed upstream in google/brotli@0a3944c and google/brotli@27dd726

trying to pull in the new version in #23668

you can workaround locally in the meantime with --copt=-Wno-error=vla-parameter

@zonque
Copy link

zonque commented Oct 26, 2022

may be you can build the envoy with the building image to avoid the effects of compiler/os version?

FWIW, that's not possible in my case as I'm trying to cross-compile with an SDK.

keith added a commit that referenced this issue Oct 26, 2022
This fixes #23570 and #23342

There haven't been many commits since the previous pinned version, here
is the full diff: google/brotli@0cd2e39...6d03dfb

Signed-off-by: Keith Smiley <keithbsmiley@gmail.com>
@Webster-Yang
Copy link

How to solve it?

uname -a
Linux tv3--c9d4bf90 5.15.0-52-generic #58 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 @sergey-safarov @wbpcode

@sergey-safarov
Copy link
Author

bazel build \
  -c opt \
  --config=clang \
  envoy \
  --subcommands \
  --jobs 1 \
  --verbose_failures \
  --sandbox_debug \
  --cxxopt="-Wno-type-limits" \
  --copt="-Wno-array-bounds" \
  --copt="-Wno-vla-parameter"

@Webster-Yang
Copy link

Webster-Yang commented Dec 15, 2022

How to solve it?

uname -a
Linux tv3--c9d4bf90 5.15.0-52-generic #58 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

envoy tag :v1.23.1

   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"
-c dbg //source/exe:envoy-static

ERROR:
/source/extensions/common/matcher/trie_matcher.h:85:21: note: use reference type to prevent copying
85 | for (const auto node : values) {
| ^~~~
| &
./source/extensions/common/matcher/trie_matcher.h: In instantiation of 'typename Envoy::Matcher::MatchTree::MatchResult Envoy::Extensions::Common::Matcher::TrieMatcher::match(const DataType&) [with DataType = Envoy::Network::UdpMatchingData; typename Envoy::Matcher::MatchTree::MatchResult = Envoy::Matcher::MatchTreeEnvoy::Network::UdpMatchingData::MatchResult]':
./source/extensions/common/matcher/trie_matcher.h:67:45: required from here
./source/extensions/common/matcher/trie_matcher.h:85:21: error: loop variable 'node' creates a copy from type 'const Envoy::Extensions::Common::Matcher::TrieNodeEnvoy::Network::UdpMatchingData' [-Werror=range-loop-construct]
./source/extensions/common/matcher/trie_matcher.h:85:21: note: use reference type to prevent copying
85 | for (const auto node : values) {
| ^~~~
| &
cc1plus: all warnings being treated as errors
1671107470.983217396: src/main/tools/linux-sandbox-pid1.cc:498: wait returned pid=2, status=0x100
1671107470.983324545: src/main/tools/linux-sandbox-pid1.cc:516: child exited normally with code 1
1671107470.983721162: src/main/tools/linux-sandbox.cc:233: child exited normally with code 1
Target //source/exe:envoy-static failed to build
INFO: Elapsed time: 3765.946s, Critical Path: 101.24s
INFO: 3980 processes: 24 internal, 3956 linux-sandbox.

@zonque @keith @sergey-safarov @wbpcode

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<std::__cxx11::basic_string >::const_iterator, std::vector<std::__cxx11::basic_string >::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 @sergey-safarov @wbpcode

@zonque
Copy link

zonque commented Dec 15, 2022

I have no idea. I guess this software is not supposed to be compiled by end-users, let alone cross-compiled.

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

Successfully merging a pull request may close this issue.

5 participants