Skip to content

StringView is not declared in proxy_wasm_intrinsics.h. #47

@xeioex

Description

@xeioex

building this example: https://github.com/envoyproxy/envoy-wasm/tree/master/examples/wasm
proxy-wasm-cpp-sdk revision: 6892046

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions