proxy-wasm/proxy-wasm-cpp-host

Update to Bazel 7

Opened this issue · 0 comments

While working on #384 I tried to update to Bazel 7, but I ran into a few build errors (below). This issue tracks fixing them.

Build errors seem to generally relate to toolchains + transitions:

  1. --cxxopt gets lost in C++ wasm transition (in proxy-wasm-cpp-sdk)
  • leads to build error no type named 'string_view' in namespace 'std'
  • one workaround is --action_env=BAZEL_CXXOPTS="-std=c++17"
  • or add copts = ["-std=c++17"] to all Bazel C++ targets (removes .bazelrc requirement)
  1. Emscripten linker gets lost in C++ wasm transition (in proxy-wasm-cpp-sdk)
$ bazelisk build --verbose_failures --define engine=null --config=clang test/test_data:http_logging.wasm
INFO: Analyzed target //test/test_data:http_logging.wasm (0 packages loaded, 0 targets configured).
ERROR: /usr/local/google/home/mstevenson/git/proxy-wasm-cpp-host/test/test_data/BUILD:88:21: Linking test/test_data/proxy_wasm_http_logging failed: (Exit 1): clang failed: error executing CppLink command (from target //test/test_data:proxy_wasm_http_logging) 
  (cd /usr/local/google/home/mstevenson/.cache/bazel/_bazel_mstevenson/35e00757f2b858287fbaf6f5989ae0e8/sandbox/linux-sandbox/87/execroot/proxy_wasm_cpp_host && \
  exec env - \
    BAZEL_COMPILER=clang \
    BAZEL_CXXOPTS='-std=c++17' \
    CC=clang \
    CXX=clang++ \
    PWD=/proc/self/cwd \
    ZERO_AR_DATE=1 \
  /usr/lib/llvm-16/bin/clang @bazel-out/wasm-fastbuild-ST-27e13bb277c1/bin/test/test_data/proxy_wasm_http_logging-2.params)
# Configuration: 3f4fa744449c87a213b9b9765df0a7d5283d4371acdefe4a9785b7bd181e7ab7
# Execution platform: @@internal_platforms_do_not_use//host:host

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
clang: error: unsupported option '--no-entry'
clang: error: unsupported option '--js-library=external/proxy_wasm_cpp_sdk/proxy_wasm_intrinsics.js'
clang: error: unknown argument: '-sSTANDALONE_WASM'
clang: error: unknown argument: '-sEXPORTED_FUNCTIONS=_malloc'
  1. Rust wasm complains -- may be fixed with rules_rust update?
$ bazelisk build --verbose_failures --define engine=null --config=clang test/test_data:random.wasm
ERROR: /usr/local/google/home/mstevenson/git/proxy-wasm-cpp-host/test/test_data/BUILD:77:17: in (an implicit dependency) attribute of wasi_rust_binary_rule rule //test/test_data:random.wasm: in $whitelist_function_transition attribute of wasi_rust_binary_rule rule //test/test_data:random.wasm: package group '@@bazel_tools//tools/whitelists/function_transition_whitelist:function_transition_whitelist' is misplaced here (they are only allowed in the visibility attribute). Since this rule was created by the macro 'wasm_rust_binary', the error might have been caused by the macro implementation
ERROR: /usr/local/google/home/mstevenson/git/proxy-wasm-cpp-host/test/test_data/BUILD:77:17: Analysis of target '//test/test_data:random.wasm' failed
ERROR: Analysis of target '//test/test_data:random.wasm' failed; build aborted