如何将Node.js N-API模块编译为wasm?

时间:2019-05-04 03:05:53

标签: javascript node.js webassembly n-api

我正在尝试将N-API模块编译为wasm,但是我被此错误所困扰

emcc \
    --bind \
    ${OPTIMIZE} \
    -s ALLOW_MEMORY_GROWTH=1 \
    -s MODULARIZE=1 \
    -s 'EXPORT_NAME="camaro"' \
    -I node_modules/node-addon-api \
    -I node_modules/node-addon-api/src \
    -I node_modules/json/single_include/nlohmann \
    -I node_modules/pugixml/src \
    -o ./camaro.js \
    --std=c++11 *.o \
    -x c++ \
    camaro.cpp

错误

error: undefined symbol: napi_close_escapable_handle_scope
warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
error: undefined symbol: napi_create_array
error: undefined symbol: napi_create_double
error: undefined symbol: napi_create_error
error: undefined symbol: napi_create_object
error: undefined symbol: napi_create_reference
error: undefined symbol: napi_create_string_utf8
error: undefined symbol: napi_create_type_error
error: undefined symbol: napi_delete_reference
error: undefined symbol: napi_escape_handle
error: undefined symbol: napi_fatal_error
error: undefined symbol: napi_get_and_clear_last_exception
error: undefined symbol: napi_get_boolean
error: undefined symbol: napi_get_last_error_info
error: undefined symbol: napi_get_named_property
error: undefined symbol: napi_get_reference_value
error: undefined symbol: napi_get_value_string_utf8
error: undefined symbol: napi_is_exception_pending
error: undefined symbol: napi_open_escapable_handle_scope
error: undefined symbol: napi_set_element
error: undefined symbol: napi_set_property

如何包含这些方法?我已经包含了这些

-I node_modules/node-addon-api \
-I node_modules/node-addon-api/src \

0 个答案:

没有答案