proxy-wasm-cpp-sdk
proxy-wasm-cpp-sdk copied to clipboard
StringView is not declared in proxy_wasm_intrinsics.h.
building this example: https://github.com/envoyproxy/envoy-wasm/tree/master/examples/wasm proxy-wasm-cpp-sdk revision: 68920464571265b237e002bfd23f91d0f9328975
docker run -v $PWD:/work -w /work wasmsdk:v2 /build_wasm.sh
Adding directories to PATH:
PATH += /root/emsdk
PATH += /root/emsdk/upstream/emscripten
PATH += /root/emsdk/node/12.18.1_64bit/bin
Setting environment variables:
EMSDK = /root/emsdk
EM_CONFIG = /root/emsdk/.emscripten
EM_CACHE = /root/emsdk/upstream/emscripten/cache
EMSDK_NODE = /root/emsdk/node/12.18.1_64bit/bin/node
em++ -s STANDALONE_WASM=1 -s EMIT_EMSCRIPTEN_METADATA=1 -s EXPORTED_FUNCTIONS=['_malloc'] --std=c++17 -O3 -flto -s WASM_OBJECT_FILES=0 --llvm-lto 1 -DPROXY_WASM_PROTOBUF_LITE=1 -I/sdk -I/usr/local/include --js-library /sdk/proxy_wasm_intrinsics.js myproject.cc /sdk/proxy_wasm_intrinsics_lite.pb.cc /sdk/struct_lite.pb.cc /sdk/proxy_wasm_intrinsics.cc /sdk/libprotobuf-lite.a -o myproject.wasm
myproject.cc:11:44: error: unknown type name 'StringView'
explicit ExampleRootContext(uint32_t id, StringView root_id) : RootContext(id, root_id) {}
^
In file included from myproject.cc:2:
In file included from /root/emsdk/upstream/emscripten/system/include/libcxx/string:505:
In file included from /root/emsdk/upstream/emscripten/system/include/libcxx/string_view:176:
In file included from /root/emsdk/upstream/emscripten/system/include/libcxx/__string:57:
In file included from /root/emsdk/upstream/emscripten/system/include/libcxx/algorithm:644:
...
declaring something like
#define StringView std::string_view
Solves the issue.
docs have the same issue
docs/wasm_filter.md
370:void addRequestHeader(std::string_view key, StringView value)
381:void replaceRequestHeader(std::string_view key, StringView value)
440:void addResponseHeader(std::string_view key, StringView value)
451:void replaceResponseHeader(std::string_view key, StringView value)
510:void addRequestTrailer(std::string_view key, StringView value)
521:void replaceRequestTrailer(std::string_view key, StringView value)
578:void addResponseTrailer(std::string_view key, StringView value)
589:void replaceResponseTrailer(std::string_view key, StringView value)
1158:std::vector<std::pair<std::string_view, StringView>> pairs()
#38 removed it.