Skip to content

Build wasm(libprotobuf.a failed with undefined symbol(std::__2::__basic_string_common<true>::__throw_length_error() const) #145

Open
@coolg92003

Description

@coolg92003

I Use make file Makefile.base to build below 4 files failed with below errors, any suggestions?
4 files:
HFEDHttpScreen.h
HFEDHttpScreen.cc
Below two files are build by (protoc --proto_path=${SRC_DIR} --cpp_out=${DST_DIR} ${SRC_DIR}/HFEDHttpScreenMsg.proto)
/usr/local/bin/protoc --version
libprotoc 3.9.1
HFEDHttpScreenMsg.pb.h
HFEDHttpScreenMsg.pb.cc

When trigger to build wasm file with below command
em++ --no-entry -s EXPORTED_FUNCTIONS=['_malloc'] -sLLD_REPORT_UNDEFINED -Wl,--trace-symbol=__ZNKSt3__220__vector_base_commonILb1EE20__throw_length_errorEv -std=c++17 -O3 -flto -Ic++-noexcept -I${PROXY_WASM_CPP_SDK} -I${PB_DIR} -I/usr/local/include --js-library ${PROXY_WASM_CPP_SDK}/proxy_wasm_intrinsics.js $.cc ${PROXY_WASM_CPP_SDK}/proxy_wasm_intrinsics.pb.cc ${PB_DIR}/HFEDHttpScreenMsg.pb.cc ${CPP_CONTEXT_LIB} ${PROXY_WASM_CPP_SDK}/libprotobuf.a -o $.wasm

Below error occured in libprotobuf.a(this file is from this proxy-wasm-ccp-sdk repo
em++ --no-entry -s EXPORTED_FUNCTIONS=['_malloc'] -sLLD_REPORT_UNDEFINED -Wl,--trace-symbol=__ZNKSt3__220__vector_base_commonILb1EE20__throw_length_errorEv -std=c++17 -O3 -flto -Ic++-noexcept -I/root/cfx/cfx_httpScreen/proxy-wasm-cpp-sdk -I/root/cfx/cfx_httpScreen/protobuf/cfx/pbJsonIn -I/usr/local/include --js-library /root/cfx/cfx_httpScreen/proxy-wasm-cpp-sdk/proxy_wasm_intrinsics.js HFEDHttpScreen.cc /root/cfx/cfx_httpScreen/proxy-wasm-cpp-sdk/proxy_wasm_intrinsics.pb.cc /root/cfx/cfx_httpScreen/protobuf/cfx/pbJsonIn/HFEDHttpScreenMsg.pb.cc /root/cfx/cfx_httpScreen/proxy-wasm-cpp-sdk/proxy_wasm_intrinsics.cc /root/cfx/cfx_httpScreen/proxy-wasm-cpp-sdk/libprotobuf.a -o HFEDHttpScreen.wasm
wasm-ld: warning: Linking two modules of different data layouts: '/root/cfx/cfx_httpScreen/proxy-wasm-cpp-sdk/libprotobuf.a(common.o at 588630)' 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: '/root/cfx/cfx_httpScreen/proxy-wasm-cpp-sdk/libprotobuf.a(int128.o at 655570)' 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: error: /root/cfx/cfx_httpScreen/proxy-wasm-cpp-sdk/libprotobuf.a(common.o): undefined symbol: std::__2::basic_string<char, std::__2::char_traits, std::__2::allocator>::basic_string(std::__2::basic_string<char, std::__2::char_traits, std::__2::allocator> const&)
wasm-ld: error: /root/cfx/cfx_httpScreen/proxy-wasm-cpp-sdk/libprotobuf.a(common.o): undefined symbol: std::__2::basic_string<char, std::__2::char_traits, std::__2::allocator>::basic_string(std::__2::basic_string<char, std::__2::char_traits, std::__2::allocator> const&)
wasm-ld: error: /root/cfx/cfx_httpScreen/proxy-wasm-cpp-sdk/libprotobuf.a(common.o): undefined symbol: std::__2::basic_string<char, std::__2::char_traits, std::__2::allocator>::basic_string(std::__2::basic_string<char, std::__2::char_traits, std::__2::allocator> const&)
wasm-ld: error: /root/cfx/cfx_httpScreen/proxy-wasm-cpp-sdk/libprotobuf.a(common.o): undefined symbol: std::__2::__basic_string_common::__throw_length_error() const
wasm-ld: error: /root/cfx/cfx_httpScreen/proxy-wasm-cpp-sdk/libprotobuf.a(common.o): undefined symbol: std::__2::__basic_string_common::__throw_length_error() const
wasm-ld: error: /root/cfx/cfx_httpScreen/proxy-wasm-cpp-sdk/libprotobuf.a(common.o): undefined symbol: std::__2::__basic_string_common::__throw_length_error() const
wasm-ld: error: /root/cfx/cfx_httpScreen/proxy-wasm-cpp-sdk/libprotobuf.a(common.o): undefined symbol: std::__2::__basic_string_common::__throw_length_error() const
wasm-ld: error: /root/cfx/cfx_httpScreen/proxy-wasm-cpp-sdk/libprotobuf.a(common.o): undefined symbol: std::__2::__vector_base_common::__throw_length_error() const
wasm-ld: error: /root/cfx/cfx_httpScreen/proxy-wasm-cpp-sdk/libprotobuf.a(common.o): undefined symbol: std::__2::basic_string<char, std::__2::char_traits, std::__2::allocator>::basic_string(std::__2::basic_string<char, std::__2::char_traits, std::__2::allocator> const&)
wasm-ld: error: /root/cfx/cfx_httpScreen/proxy-wasm-cpp-sdk/libprotobuf.a(common.o): undefined symbol: std::__2::basic_string<char, std::__2::char_traits, std::__2::allocator>::basic_string(std::__2::basic_string<char, std::__2::char_traits, std::__2::allocator> const&)
wasm-ld: error: /root/cfx/cfx_httpScreen/proxy-wasm-cpp-sdk/libprotobuf.a(common.o): undefined symbol: std::__2::basic_string<char, std::__2::char_traits, std::__2::allocator>::basic_string(std::__2::basic_string<char, std::__2::char_traits, std::__2::allocator> const&)
wasm-ld: error: /root/cfx/cfx_httpScreen/proxy-wasm-cpp-sdk/libprotobuf.a(common.o): undefined symbol: std::__2::__vector_base_common::__throw_length_error() const
wasm-ld: error: /root/cfx/cfx_httpScreen/proxy-wasm-cpp-sdk/libprotobuf.a(common.o): undefined symbol: std::__2::__basic_string_common::__throw_length_error() const
wasm-ld: error: /root/cfx/cfx_httpScreen/proxy-wasm-cpp-sdk/libprotobuf.a(common.o): undefined symbol: std::__2::__vector_base_common::__throw_length_error() const
wasm-ld: error: /root/cfx/cfx_httpScreen/proxy-wasm-cpp-sdk/libprotobuf.a(common.o): undefined symbol: std::__2::basic_string<char, std::__2::char_traits, std::__2::allocator>::basic_string(std::__2::basic_string<char, std::__2::char_traits, std::__2::allocator> const&)
wasm-ld: error: /root/cfx/cfx_httpScreen/proxy-wasm-cpp-sdk/libprotobuf.a(common.o): undefined symbol: std::__2::__vector_base_common::__throw_length_error() const
wasm-ld: error: /root/cfx/cfx_httpScreen/proxy-wasm-cpp-sdk/libprotobuf.a(common.o): undefined symbol: std::__2::__basic_string_common::__throw_length_error() const
wasm-ld: error: /root/cfx/cfx_httpScreen/proxy-wasm-cpp-sdk/libprotobuf.a(common.o): undefined symbol: std::__2::__basic_string_common::__throw_length_error() const
wasm-ld: error: /root/cfx/cfx_httpScreen/proxy-wasm-cpp-sdk/libprotobuf.a(common.o): undefined symbol: std::__2::__basic_string_common::__throw_length_error() const
wasm-ld: error: /root/cfx/cfx_httpScreen/proxy-wasm-cpp-sdk/libprotobuf.a(common.o): undefined symbol: std::__2::__basic_string_common::__throw_length_error() const
wasm-ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)

em++: error: '/root/cfx/cfx_httpScreen/emsdk/upstream/bin/wasm-ld -o HFEDHttpScreen.wasm --trace-symbol=__ZNKSt3__220__vector_base_commonILb1EE20__throw_length_errorEv /tmp/emscripten_temp_5k8_itu8/HFEDHttpScreen_0.o /tmp/emscripten_temp_5k8_itu8/proxy_wasm_intrinsics.pb_1.o /tmp/emscripten_temp_5k8_itu8/HFEDHttpScreenMsg.pb_2.o /tmp/emscripten_temp_5k8_itu8/proxy_wasm_intrinsics_3.o /root/cfx/cfx_httpScreen/proxy-wasm-cpp-sdk/libprotobuf.a -L/root/cfx/cfx_httpScreen/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/lto /root/cfx/cfx_httpScreen/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/lto/crt1_reactor.o -lGL -lal -lhtml5 -lstandalonewasm -lstubs -lnoexit -lc -ldlmalloc -lcompiler_rt -lc++-noexcept -lc++abi-noexcept -lsockets -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --allow-undefined-file=/tmp/tmp16b0u6w5.undefined --strip-debug --export-if-defined=malloc --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_js --export-if-defined=__stop_em_js --export=stackSave --export=stackRestore --export=stackAlloc --export=__errno_location --export=malloc --export=__cxa_is_pointer_type --export-table -z stack-size=5242880 --initial-memory=16777216 --entry=_initialize --max-memory=16777216 --global-base=1024' failed (returned 1)
make: *** [Makefile.base_hs:14: HFEDHttpScreen.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