Closed lum1n0us closed 3 months ago
Updating Bazel to 7.x and rules_python seems like a way to go. Thanks!
Sorry for delayed response.
The new rules_python provides a different way for pip_install()
and it beats me. Hope https://github.com/proxy-wasm/proxy-wasm-cpp-host/pull/389 can resolve it.
Early finding: I can upgrade to Bazel 6.5.0 but with Bazel 7 (turning off bzlmod) I get wasm build errors. I may proceed with 6.5.0 for now (which matches Envoy).
Build errors seem to generally relate to toolchains + transitions:
--cxxopt
gets lost in C++ wasm transition, leading to no type named 'string_view' in namespace 'std'
--action_env=BAZEL_CXXOPTS="-std=c++17"
$ 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'
$ 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
Drive-by comment, but copts = ["-std=c++17"]
should be added to all Bazel C++ targets in C++ Host, since Bazel workspaces that depend on it won't use our .bazelrc
, and instead need to force this flag themselves.
This works in Envoy right now, because it's also forcing C++17, but this should be fixed sooner, rather than later.
There is a common CI issue on macOS/x86-64 about
pkgutil. ImpImporter
triggered by 'rules_python"It turns out that
pkgutil.ImpImporter
, as a long-deprecated class, has been removed from python 3.12. A proper way of fixing is upgrade rules_python.But if using the latest rules_python 0.31, another error will be meet.
It is because
RunEnvironmentInfo
is not exposed in Bazel < 5.3. Currently, proxy-wasm-cpp-host is using Build label: 5.2.0.So I am kind of stuck here, shall I ?