-
Notifications
You must be signed in to change notification settings - Fork 256
Description
I am working on adding WASM based integration tests to the AWS Rust SDK. We have some already, but they just cargo check to test for successful compilation and I would like to actually run the code to prevent runtime breaking issues like smithy-lang/smithy-rs#4459 in the future. I've been following this guide to get a component I can run with wasmtime run --invoke. The (in-progress) code for these tests is available here.
When running cargo component build --target wasm32-wasip2 I get the error below:
error: linking with `wasm-component-ld` failed: exit status: 1
|
= note: "wasm-component-ld" "-flavor" "wasm" "--export" "wasm:tests/tests#run" "--export" "cabi_realloc" "--export" "cabi_realloc_wit_bindgen_0_19_2" "-z" "stack-size=1048576" "--stack-first" "--allow-undefined" "--no-demangle" "<137 object files omitted>" "/Volumes/workplace/smithy-rs/target/wasm32-wasip2/debug/deps/{libwit_bindgen_rt-f88c1524663592db.rlib,libaws_smithy_http_client-518298fe70e84e66.rlib,libaws_smithy_protocol_test-e5bd253189c96d81.rlib,libcbor_diag-cc2d74e86df0b4e2.rlib,libbs58-8d286834141bef98.rlib,libdata_encoding-57251e4820425dbf.rlib,libnom-f94737e50b73b92b.rlib,libseparator-93a9887f01a7e624.rlib,libnum_rational-c16836d06ea7c709.rlib,libnum_bigint-73781cc61892c5bf.rlib,libchrono-c8dd42ab30a0de76.rlib,libciborium-60245e3c1d1093f2.rlib,libciborium_ll-e26087ecffafaf48.rlib,libhalf-06d08c0ddba63ece.rlib,libciborium_io-33c857e9a1f698a3.rlib,libthiserror-aa365df82029422b.rlib,libpretty_assertions-4c00e1b85b2d120c.rlib,libdiff-606527fe4aedfc29.rlib,libyansi-6e6a3b7721695253.rlib,libassert_json_diff-9c327c8fea9cf145.rlib,libserde_json-64342c709d2d5710.rlib,libmemchr-df926dc799f61549.rlib,libroxmltree-e31bdab7a98bf203.rlib,libindexmap-53750d029e72c7ec.rlib,libserde-75a2f14ec55f59a6.rlib,libaws_smithy_wasm-613d060e9c1366e9.rlib,libwasi-568f11922a286d23.rlib,libwit_bindgen-8bc74b1123c519dd.rlib,libbitflags-a24924bc5c1ea686.rlib,libaws_sdk_s3-b8422a5c7b5aef6c.rlib,liblru-5d9d25533d149e6a.rlib,libhashbrown-70a5f477147e2321.rlib,libfoldhash-b9f92c93677ce069.rlib,libequivalent-c8fafa9a024099b2.rlib,liballocator_api2-0f9aefd005fe8a6b.rlib,libaws_smithy_checksums-34b84cab90789cff.rlib,libcrc_fast-81bbf39c1aae9c5d.rlib,libcrc-74160c29036b0e1f.rlib,libcrc_catalog-3b0e8e447fee555e.rlib,libmd5-a72ca85f738c8d78.rlib,libsha1-505ef613ebcaedf9.rlib,libaws_config-c7185207280b94e1.rlib,liburl-19ac17f01081526e.rlib,libidna-4a7d937b22c3ef81.rlib,libutf8_iter-d05edd32593e5a23.rlib,libidna_adapter-f80eacc5ceb59484.rlib,libicu_properties-aca58cf54277f8b8.rlib,libicu_properties_data-f44ec8f7960d5d2a.rlib,libicu_normalizer-94d300b1748d2752.rlib,libsmallvec-e46d82fbe3bc053b.rlib,libicu_normalizer_data-cd1ab57074a55bfd.rlib,libicu_collections-bc218dacc0bbcde7.rlib,libpotential_utf-6fcf982cbc9ed486.rlib,libicu_provider-5d5b915323ddebb0.rlib,libicu_locale_core-1e108fd358d844b5.rlib,libtinystr-df5377bfdf92d1c6.rlib,liblitemap-01d967e0852598f4.rlib,libwriteable-01ed5c1acc69fb3c.rlib,libzerovec-ef98a9fdb6fc07ff.rlib,libzerotrie-922cf731cd18a3a3.rlib,libyoke-0237ed8768849a78.rlib,libstable_deref_trait-374a0b39defdd423.rlib,libzerofrom-87aa9a0137128d21.rlib,libaws_sdk_sts-ace2361100cd5bff.rlib,libaws_smithy_query-42c8bbf9d85a40dc.rlib,liburlencoding-c8b583d1c2a56abb.rlib,libaws_smithy_xml-d31a51610b207a11.rlib,libxmlparser-ad5895c9f87ed407.rlib,libregex_lite-d091ebb2970d10d1.rlib,libaws_runtime-e196f586ab9de3cd.rlib,libuuid-46e05fdedcbd2976.rlib,libaws_sigv4-31d11424abe6fe40.rlib,libform_urlencoded-4c6c23013b0887b4.rlib,libhex-054fb4040915fc1b.rlib,libaws_smithy_http-6ce266d1ab4e92b0.rlib,libpercent_encoding-98787689451b4be8.rlib,libaws_smithy_eventstream-ea583061ec1dd0b5.rlib,libcrc32fast-c85de07808fc69bf.rlib,libsha2-7af506aeb24f028a.rlib,libcfg_if-834bfd97d6f5a649.rlib,libhmac-86f71ac824e90e6f.rlib,libdigest-d3096299a9e7da53.rlib,libsubtle-e31a47b8aeb219a3.rlib,libblock_buffer-10a0a43d004d4ec8.rlib,libcrypto_common-3dc178ff466ab078.rlib,libgeneric_array-76e8f83caefb9001.rlib,libtypenum-2f0826b5aa9cb855.rlib,libaws_smithy_json-c77dcb823c1f0e5d.rlib,libaws_smithy_runtime-1802c71cf2435141.rlib,libfastrand-c2dad2263a7a2a8e.rlib,libaws_smithy_observability-2145e504f4e34311.rlib,libaws_types-b82c96123fbf5603.rlib,libaws_credential_types-abcf2b476d5f6416.rlib,libaws_smithy_runtime_api-5afada4a26448773.rlib,libaws_smithy_async-c06d5d0ebe070398.rlib,libtokio-b94fb3627306179e.rlib,libfutures_util-99b25ee6ea10792f.rlib,libfutures_task-c7d1ea3b2b741e16.rlib,libtracing-c30e21afbaf98721.rlib,libtracing_core-12212630fe6b9870.rlib,libonce_cell-fe921ef340838e30.rlib,libzeroize-b67e583ebcc96ec2.rlib,libaws_smithy_types-46f6247160cad2a6.rlib,libryu-6958756544f58061.rlib,libpin_utils-8283b4851bfd349d.rlib,libtime-82d984b59300bf53.rlib,libtime_core-b957b180291da6f3.rlib,libnum_conv-918a2fe4b14ebab7.rlib,libderanged-f516955e25cafa02.rlib,libpowerfmt-73b2760e12b24c48.rlib,libnum_integer-8c0d319f0870623e.rlib,libnum_traits-bcaa02826f1420c8.rlib,libbytes_utils-2368a0f6f0205be9.rlib,libeither-77bd0a2075493cef.rlib,libhttp_body-b007e2ab8c3a5df5.rlib,libhttp-d7e6f9fbd8abf4ea.rlib,libhttp_body_util-00200bd31609a266.rlib,libfutures_core-5b4c35fc167c0374.rlib,libhttp_body-1ac06b9fae93aa28.rlib,libhttp-24dfc0ccc0dbe46e.rlib,libitoa-dfbc94dbbfedecaa.rlib,libfnv-ddc4445f2c424be8.rlib,libpin_project_lite-065bb57cbd8b7289.rlib,libbytes-de10a6f56f280733.rlib,libbase64_simd-c5c9786974dcf94b.rlib,liboutref-052a11fdea90dc6c.rlib,libvsimd-f5be7da7629eb6fd.rlib}.rlib" "<sysroot>/lib/rustlib/wasm32-wasip2/lib/{libstd-*,libpanic_abort-*,libwasi-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,libcfg_if-*,liblibc-*}.rlib" "-l" "c" "<sysroot>/lib/rustlib/wasm32-wasip2/lib/{liballoc-*,librustc_std_workspace_core-*,libcore-*,libcompiler_builtins-*}.rlib" "-l" "wit_bindgen_cabi_realloc" "-L" "/Volumes/workplace/smithy-rs/target/wasm32-wasip2/debug/build/wit-bindgen-rt-636f7af93f0609c6/out" "-L" "/Volumes/workplace/smithy-rs/target/wasm32-wasip2/debug/build/wit-bindgen-218e2970d68de953/out" "-L" "/Volumes/workplace/smithy-rs/target/wasm32-wasip2/debug/build/wit-bindgen-rt-3fb038645fe11246/out" "-L" "/Users/lnj/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wit-bindgen-0.19.2/src" "-L" "<sysroot>/lib/rustlib/wasm32-wasip2/lib/self-contained" "-o" "/Volumes/workplace/smithy-rs/target/wasm32-wasip2/debug/deps/wasm_tests.wasm" "--gc-sections" "--no-entry" "-O0"
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: error: failed to encode component
Caused by:
0: failed to decode world from module
1: module was not valid
2: failed to resolve import `env::cabi_realloc_wit_bindgen_0_44_0`
3: module requires an import interface named `env`
Running cargo component build without the --target (which I think defaults to wasip1?) produces the following error:
error: failed to validate component output
Caused by:
too many locals: locals exceed maximum (at offset 0x1349ce)
To reproduce the errors you can run the following:
git clone -b landonxjames/wasm-tests --single-branch https://github.com/smithy-lang/smithy-rs.git
cd smithy-rs/aws/sdk/integration-tests/wasm-tests
cargo component build --target wasm32-wasip2
cargo component buildI am using these versions of various tools which all seem up to date:
cargo-component-component 0.21.1
wasmtime 39.0.1 (016380487 2025-11-24)
wit-bindgen = "0.50.0"
wit-bindgen-rt = { version = "0.44.0", features = ["bitflags"] }
Not much of an idea what is going on. My best guess is that the aws-smithy-wasm crate is on a fairly ancient version of the wasi crate, 0.12.1, and maybe that isn't playing nicely with newer versions of the wit crates? I'll try upgrading it, but wanted to get the issue up in case there was a known problem I was hitting.
Wasn't sure if this was the right part of the ecosystem to cut the issue to, but since the missing import was wit_bindgen related it seemed like a reasonable place to start.