proxy-wasm / proxy-wasm-cpp-host

WebAssembly for Proxies (C++ host implementation)
Apache License 2.0
84 stars 69 forks source link

[WIP] repo: Shift `cargo-raze` -> `crate_universe` #390

Closed phlax closed 3 months ago

phlax commented 7 months ago

@martijneken @PiotrSikora ive had a go at this but hit a bit of a wall

if i dont update bazel >= 7 then i get

ERROR: /home/worker/.cache/bazel/_bazel_worker/04780f9507b63ffdcfd2ed5ffb5c93b3/external/rules_rust/rust/platform/BUILD.bazel:6:24: no such target '@platforms//os:fuchsia': target 'fuchsia' not declared in package 'os' defined by /home/worker/.cache/bazel/_bazel_worker/04780f9507b63ffdcfd2ed5ffb5c93b3/external/platforms/os/BUILD (Tip: use `query "@platforms//os:*"` to see all the targets in that package) and referenced by '@rules_rust//rust/platform:aarch64-fuchsia'

updating to 7+ i get a stack of errors like

external/proxy_wasm_cpp_sdk/proxy_wasm_api.h:61:33: error: no type named 'string_view' in namespace 'std'                                                                         
inline WasmResult logTrace(std::string_view logMessage) { 

i tried forcing it to use c++17 with

build --action_env=BAZEL_CXXOPTS="-std=c++17"
build --action_env=BAZEL_COPTS="-std=c++17"

i get

clang-14: error: unsupported option '--no-entry'                                                                                                                                  
clang-14: error: unsupported option '--js-library=external/proxy_wasm_cpp_sdk/proxy_wasm_intrinsics.js'                                                                           
clang-14: error: unknown argument: '-sSTANDALONE_WASM'                                                                                                                            clang-14: error: unknown argument: '-sEXPORTED_FUNCTIONS=_malloc' 

vendoring the crate deps works - but trying to compile anything with them fails as above

martijneken commented 7 months ago

Sorry, I missed this comment until now!

target 'fuchsia' not declared in package 'os'

Why are rust builds targeting fuchsia here? Have you tried using supported_platform_triples to limit the target set? As is, I see a large target_compatible_with list in the generated BUILD files, many of which we likely don't need.

no type named 'string_view' in namespace 'std'

FWIW that looks like the namespace pollution issue fixed in #365.

phlax commented 7 months ago

Have you tried using supported_platform_triples

i didnt - that looks like what we need - what triples should be supported ?

FWIW that looks like the namespace pollution issue fixed in https://github.com/proxy-wasm/proxy-wasm-cpp-host/pull/365.

i think this PR had that fix merged - not sure if some additional fix is required there

phlax commented 7 months ago

i tried setting supported_platform_triples in crates_vendor but that didnt seem to make any difference

i also tried setting generate_target_compatible_with = False which changed the vendored files afaict but it still fails on the same issue

im thinking that the most recent versions of rules_rust just require latest bazel but not sure

martijneken commented 7 months ago

Different idea: since the issue is a missing platform, you should be able to upgrade Bazel platform rules in WORKSPACE: https://github.com/bazelbuild/platforms/releases/tag/0.0.9

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "platforms",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.9/platforms-0.0.9.tar.gz",
        "https://github.com/bazelbuild/platforms/releases/download/0.0.9/platforms-0.0.9.tar.gz",
    ],
    sha256 = "5eda539c841265031c2f82d8ae7a3a6490bd62176e0c038fc469eabf91f6149b",
)
phlax commented 6 months ago

ive been a bit distracted with releases, ill circle back to this as soon as i have some time available

martijneken commented 3 months ago

Done in https://github.com/proxy-wasm/proxy-wasm-cpp-host/pull/399 -- thanks very much for starting this!