Skip to content

Error building building example WASM filter  #161

Closed
@bravenut

Description

@bravenut

Hi,

when I follow the steps outlined in the README for the example on how to compile a C++ WASM filter, on running

docker run -v $PWD:/work -w /work wasmsdk:v2 /build_wasm.sh

The process exits with unsuccessfully because of some linker error. The full output of above docker run execution is:

Setting up EMSDK environment (suppress these messages with EMSDK_QUIET=1)
Adding directories to PATH:
PATH += /root/emsdk
PATH += /root/emsdk/upstream/emscripten
PATH += /root/emsdk/node/16.20.0_64bit/bin

Setting environment variables:
PATH = /root/emsdk:/root/emsdk/upstream/emscripten:/root/emsdk/node/16.20.0_64bit/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
EMSDK = /root/emsdk
EMSDK_NODE = /root/emsdk/node/16.20.0_64bit/bin/node
em++ --no-entry -s EXPORTED_FUNCTIONS=['_malloc'] --std=c++17 -O3 -flto -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
cache:INFO: generating system asset: sysroot/lib/wasm32-emscripten/lto/crt1_reactor.o... (this will be cached in "/root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/lto/crt1_reactor.o" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/lto/libGL.a... (this will be cached in "/root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/lto/libGL.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/lto/libal.a... (this will be cached in "/root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/lto/libal.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/lto/libhtml5.a... (this will be cached in "/root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/lto/libhtml5.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/lto/libstandalonewasm.a... (this will be cached in "/root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/lto/libstandalonewasm.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/lto/libstubs.a... (this will be cached in "/root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/lto/libstubs.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/lto/libnoexit.a... (this will be cached in "/root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/lto/libnoexit.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/lto/libc.a... (this will be cached in "/root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/lto/libc.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/lto/libdlmalloc.a... (this will be cached in "/root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/lto/libdlmalloc.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/lto/libcompiler_rt.a... (this will be cached in "/root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/lto/libcompiler_rt.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/lto/libc++-noexcept.a... (this will be cached in "/root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/lto/libc++-noexcept.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/lto/libc++abi-noexcept.a... (this will be cached in "/root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/lto/libc++abi-noexcept.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/lto/libsockets.a... (this will be cached in "/root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/lto/libsockets.a" for subsequent builds)
cache:INFO:  - ok
wasm-ld: warning: Linking two modules of different data layouts: '/sdk/libprotobuf-lite.a(common.o at 148324)' is 'e-m:e-p:32:32-i64:64-n32:64-S128' whereas 'ld-temp.o' is 'e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-f128:64-n32:64-S128-ni:1:10:20'


wasm-ld: warning: Linking two modules of different data layouts: '/sdk/libprotobuf-lite.a(int128.o at 215264)' is 'e-m:e-p:32:32-i64:64-n32:64-S128' whereas 'ld-temp.o' is 'e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-f128:64-n32:64-S128-ni:1:10:20'


wasm-ld: warning: Linking two modules of different data layouts: '/sdk/libprotobuf-lite.a(status.o at 255880)' is 'e-m:e-p:32:32-i64:64-n32:64-S128' whereas 'ld-temp.o' is 'e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-f128:64-n32:64-S128-ni:1:10:20'


wasm-ld: warning: Linking two modules of different data layouts: '/sdk/libprotobuf-lite.a(stringpiece.o at 288944)' is 'e-m:e-p:32:32-i64:64-n32:64-S128' whereas 'ld-temp.o' is 'e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-f128:64-n32:64-S128-ni:1:10:20'


wasm-ld: warning: Linking two modules of different data layouts: '/sdk/libprotobuf-lite.a(arena.o at 536568)' is 'e-m:e-p:32:32-i64:64-n32:64-S128' whereas 'ld-temp.o' is 'e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-f128:64-n32:64-S128-ni:1:10:20'


wasm-ld: warning: Linking two modules of different data layouts: '/sdk/libprotobuf-lite.a(generated_enum_util.o at 1047244)' is 'e-m:e-p:32:32-i64:64-n32:64-S128' whereas 'ld-temp.o' is 'e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-f128:64-n32:64-S128-ni:1:10:20'


wasm-ld: warning: Linking two modules of different data layouts: '/sdk/libprotobuf-lite.a(extension_set.o at 569832)' is 'e-m:e-p:32:32-i64:64-n32:64-S128' whereas 'ld-temp.o' is 'e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-f128:64-n32:64-S128-ni:1:10:20'


wasm-ld: warning: Linking two modules of different data layouts: '/sdk/libprotobuf-lite.a(generated_message_util.o at 1058004)' is 'e-m:e-p:32:32-i64:64-n32:64-S128' whereas 'ld-temp.o' is 'e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-f128:64-n32:64-S128-ni:1:10:20'


wasm-ld: warning: Linking two modules of different data layouts: '/sdk/libprotobuf-lite.a(strutil.o at 341272)' is 'e-m:e-p:32:32-i64:64-n32:64-S128' whereas 'ld-temp.o' is 'e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-f128:64-n32:64-S128-ni:1:10:20'


wasm-ld: warning: Linking two modules of different data layouts: '/sdk/libprotobuf-lite.a(message_lite.o at 1793592)' is 'e-m:e-p:32:32-i64:64-n32:64-S128' whereas 'ld-temp.o' is 'e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-f128:64-n32:64-S128-ni:1:10:20'


wasm-ld: warning: Linking two modules of different data layouts: '/sdk/libprotobuf-lite.a(implicit_weak_message.o at 1772184)' is 'e-m:e-p:32:32-i64:64-n32:64-S128' whereas 'ld-temp.o' is 'e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-f128:64-n32:64-S128-ni:1:10:20'


wasm-ld: warning: Linking two modules of different data layouts: '/sdk/libprotobuf-lite.a(repeated_field.o at 1973296)' is 'e-m:e-p:32:32-i64:64-n32:64-S128' whereas 'ld-temp.o' is 'e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-f128:64-n32:64-S128-ni:1:10:20'


wasm-ld: warning: Linking two modules of different data layouts: '/sdk/libprotobuf-lite.a(stringprintf.o at 312408)' is 'e-m:e-p:32:32-i64:64-n32:64-S128' whereas 'ld-temp.o' is 'e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-f128:64-n32:64-S128-ni:1:10:20'


wasm-ld: warning: Linking two modules of different data layouts: '/sdk/libprotobuf-lite.a(structurally_valid.o at 324240)' is 'e-m:e-p:32:32-i64:64-n32:64-S128' whereas 'ld-temp.o' is 'e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-f128:64-n32:64-S128-ni:1:10:20'


wasm-ld: warning: Linking two modules of different data layouts: '/sdk/libprotobuf-lite.a(wire_format_lite.o at 2351556)' is 'e-m:e-p:32:32-i64:64-n32:64-S128' whereas 'ld-temp.o' is 'e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-f128:64-n32:64-S128-ni:1:10:20'


wasm-ld: warning: Linking two modules of different data layouts: '/sdk/libprotobuf-lite.a(coded_stream.o at 2437540)' is 'e-m:e-p:32:32-i64:64-n32:64-S128' whereas 'ld-temp.o' is 'e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-f128:64-n32:64-S128-ni:1:10:20'


wasm-ld: warning: Linking two modules of different data layouts: '/sdk/libprotobuf-lite.a(strtod.o at 2498396)' is 'e-m:e-p:32:32-i64:64-n32:64-S128' whereas 'ld-temp.o' is 'e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-f128:64-n32:64-S128-ni:1:10:20'


wasm-ld: warning: Linking two modules of different data layouts: '/sdk/libprotobuf-lite.a(zero_copy_stream.o at 2512840)' is 'e-m:e-p:32:32-i64:64-n32:64-S128' whereas 'ld-temp.o' is 'e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-f128:64-n32:64-S128-ni:1:10:20'


wasm-ld: warning: Linking two modules of different data layouts: '/sdk/libprotobuf-lite.a(zero_copy_stream_impl.o at 2519904)' is 'e-m:e-p:32:32-i64:64-n32:64-S128' whereas 'ld-temp.o' is 'e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-f128:64-n32:64-S128-ni:1:10:20'


wasm-ld: warning: Linking two modules of different data layouts: '/sdk/libprotobuf-lite.a(zero_copy_stream_impl_lite.o at 2562216)' is 'e-m:e-p:32:32-i64:64-n32:64-S128' whereas 'ld-temp.o' is 'e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-f128:64-n32:64-S128-ni:1:10:20'

error: undefined symbol: _ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1ERKS5_ (referenced by top-level compiled C/C++ code)
warning: Link with `-s LLD_REPORT_UNDEFINED` to get more information on undefined symbols
warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
warning: __ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1ERKS5_ may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
Error: Aborting compilation due to previous errors
em++: error: '/root/emsdk/node/16.20.0_64bit/bin/node /root/emsdk/upstream/emscripten/src/compiler.js /tmp/tmp9fxi9a7g.json' failed (returned 1)
/sdk/Makefile.base_lite:8: recipe for target 'myproject.wasm' failed
make: *** [myproject.wasm] Error 1

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