proxy-wasm/proxy-wasm-cpp-host

GCC fails to build v8

martijneken opened this issue · 4 comments

I'm having trouble building the project with v8 with GCC.

In Envoy the v8 patch contains "-Wno-nonnull". Maybe we should add this here:
https://github.com/envoyproxy/envoy/blob/main/bazel/v8.patch#L49

$ bazelisk build -s :v8_lib
...
  /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 '-std=c++0x' -MD -MF bazel-out/k8-opt-exec-2B5CBBC6-ST-86db783ee1ee/bin/external/v8/_objs/v8_libshared_noicu/synthetic-module-tq-csa.d '-frandom-seed=bazel-out/k8-opt-exec-2B5CBBC6-ST-86db783ee1ee/bin/external/v8/_objs/v8_libshared_noicu/synthetic-module-tq-csa.o' '-DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64' -DV8_DEPRECATION_WARNINGS -DV8_IMMINENT_DEPRECATION_WARNINGS -DV8_ENABLE_LAZY_SOURCE_POSITIONS -DV8_ENABLE_WEBASSEMBLY -DGOOGLE3 -DENABLE_DEBUGGER_SUPPORT -DV8_ADVANCED_BIGINT_ALGORITHMS -DV8_CONCURRENT_MARKING -DV8_TARGET_ARCH_X64 -DV8_HAVE_TARGET_OS -DV8_TARGET_OS_LINUX -iquote external/v8 -iquote bazel-out/k8-opt-exec-2B5CBBC6-ST-86db783ee1ee/bin/external/v8 -iquote external/com_googlesource_chromium_base_trace_event_common -iquote bazel-out/k8-opt-exec-2B5CBBC6-ST-86db783ee1ee/bin/external/com_googlesource_chromium_base_trace_event_common -Ibazel-out/k8-opt-exec-2B5CBBC6-ST-86db783ee1ee/bin/external/com_googlesource_chromium_base_trace_event_common/_virtual_includes/trace_event_common -Ibazel-out/k8-opt-exec-2B5CBBC6-ST-86db783ee1ee/bin/external/v8/_virtual_includes/noicu/generated_torque_headers -isystem external/v8/include -isystem bazel-out/k8-opt-exec-2B5CBBC6-ST-86db783ee1ee/bin/external/v8/include -g0 -g0 -fPIC -fno-strict-aliasing -Werror -Wextra -Wno-unknown-warning-option -Wno-bitwise-instead-of-logical -Wno-builtin-assume-aligned-alignment -Wno-unused-parameter -Wno-implicit-int-float-conversion -Wno-deprecated-copy -Wno-non-virtual-dtor -isystem . -Wno-extra -Wno-array-bounds -Wno-class-memaccess -Wno-comments -Wno-deprecated-declarations -Wno-implicit-fallthrough -Wno-int-in-bool-context -Wno-maybe-uninitialized -Wno-mismatched-new-delete -Wno-redundant-move -Wno-return-type -Wno-stringop-overflow '-std=gnu++17' -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c bazel-out/k8-opt-exec-2B5CBBC6-ST-86db783ee1ee/bin/external/v8/noicu/torque-generated/src/objects/synthetic-module-tq-csa.cc -o bazel-out/k8-opt-exec-2B5CBBC6-ST-86db783ee1ee/bin/external/v8/_objs/v8_libshared_noicu/synthetic-module-tq-csa.o)
# Configuration: c4abdb35b98e9ffbcfcdac532f2e1eb77ad12a3890e528620d10638ef9604c2e
# Execution platform: @local_config_platform//:host
ERROR: /usr/local/google/home/mstevenson/.cache/bazel/_bazel_mstevenson/35e00757f2b858287fbaf6f5989ae0e8/external/v8/BUILD.bazel:3562:11: Compiling src/objects/js-temporal-objects.cc failed: (Exit 1): gcc failed: error executing command /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 ... (remaining 69 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
In file included from /usr/include/c++/12/bits/hashtable_policy.h:35,
                 from /usr/include/c++/12/bits/hashtable.h:35,
                 from /usr/include/c++/12/unordered_map:46,
                 from /usr/include/c++/12/functional:61,
                 from external/v8/src/execution/isolate.h:10,
                 from external/v8/src/objects/js-temporal-objects.h:8,
                 from external/v8/src/objects/js-temporal-objects.cc:5:
In static member function 'static _Tp* std::__copy_move<_IsMove, true, std::random_access_iterator_tag>::__copy_m(const _Tp*, const _Tp*, _Tp*) [with _Tp = v8::internal::{anonymous}::Unit; bool _IsMove = false]',
    inlined from '_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = false; _II = const v8::internal::{anonymous}::Unit*; _OI = v8::internal::{anonymous}::Unit*]' at /usr/include/c++/12/bits/stl_algobase.h:495:30,
    inlined from '_OI std::__copy_move_a1(_II, _II, _OI) [with bool _IsMove = false; _II = const v8::internal::{anonymous}::Unit*; _OI = v8::internal::{anonymous}::Unit*]' at /usr/include/c++/12/bits/stl_algobase.h:522:42,
    inlined from '_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = false; _II = const v8::internal::{anonymous}::Unit*; _OI = v8::internal::{anonymous}::Unit*]' at /usr/include/c++/12/bits/stl_algobase.h:529:31,
    inlined from '_OI std::copy(_II, _II, _OI) [with _II = const v8::internal::{anonymous}::Unit*; _OI = v8::internal::{anonymous}::Unit*]' at /usr/include/c++/12/bits/stl_algobase.h:620:7,
    inlined from 'void std::vector<_Tp, _Alloc>::_M_assign_aux(_ForwardIterator, _ForwardIterator, std::forward_iterator_tag) [with _ForwardIterator = const v8::internal::{anonymous}::Unit*; _Tp = v8::internal::{anonymous}::Unit; _Alloc = std::allocator<v8::internal::{anonymous}::Unit>]' at /usr/include/c++/12/bits/vector.tcc:330:19:
/usr/include/c++/12/bits/stl_algobase.h:431:30: error: argument 1 null where non-null expected [-Werror=nonnull]
  431 |             __builtin_memmove(__result, __first, sizeof(_Tp) * _Num);
      |             ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/12/bits/stl_algobase.h:431:30: note: in a call to built-in function 'void* __builtin_memmove(void*, const void*, long unsigned int)'

"-Wno-nonnull" solved my issue, will send an update to bazel/defs.bzl

Target @proxy_wasm_cpp_host//:v8_lib up-to-date:
  bazel-bin/external/proxy_wasm_cpp_host/libv8_lib.a
  bazel-bin/external/proxy_wasm_cpp_host/libv8_lib.so
INFO: Elapsed time: 4753.886s, Critical Path: 179.89s
INFO: 2519 processes: 1 internal, 2518 linux-sandbox.
INFO: Build completed successfully, 2519 total actions

Thanks! It's a shame that they didn't send those fixes here.

Perhaps it's worth adding GCC build with V8 to the CI.

Perhaps it's worth adding GCC build with V8 to the CI.

Absolutely, great idea! Can you tell me more about the CI setup?

  • where do I add this?
  • how do I subscribe to failures?

Should include a proxy_wasm_plugin_cpp target: proxy-wasm/proxy-wasm-cpp-sdk#149 (and maybe wasm_rust_binary but proxy_wasm_rust_sdk is not a dependency here)

I think we would add it to .github/workflows/test.yml and add to the Branch protection rules for the master branch.