Skip to content

v42.0.1: Precompiled cwasm for aarch64-linux-android has forced concurrency support (unable to disable) #12691

@shuidi9527-source

Description

@shuidi9527-source

Test Case

A minimal Rust WASM module (no thread/atomic code or dependencies) targeting wasm32-wasip1:

// src/lib.rs
#[no_mangle]
pub extern "C" fn add(a: i32, b: i32) -> i32 {
    a + b
}

Compile to WASM: cargo build --target wasm32-wasip1 --releaseOutput: target/wasm32-wasip1/release/test.wasm

Steps to Reproduce

    1. Compile WASM to aarch64-linux-android cwasm using Wasmtime v42.0.1 CLI:
wasmtime compile \
  --target aarch64-linux-android \
  -o test.cwasm \
  ./target/wasm32-wasip1/release/test.wasm
    1. Deserialize test.cwasm using Wasmtime C++ API (v42.0.1 Android static library)
#include <wasmtime.hh>
#include <vector>
#include <fstream>

int main() {
    std::ifstream file("test.cwasm", std::ios::binary | std::ios::ate);
    std::streamsize size = file.tellg();
    file.seekg(0, std::ios::beg);
    std::vector<uint8_t> cwasm_bytes(size);
    file.read((char*)cwasm_bytes.data(), size);

    wasmtime::Config config;
    config.wasm_threads(false);
    config.wasm_bulk_memory(true);
    wasmtime::Engine engine(config);

    auto module_res = wasmtime::Module::deserialize(engine, cwasm_bytes);
    if (!module_res) {
        std::cerr << "Error: " << module_res.err().message() << std::endl;
        return 1;
    }
    return 0;
}
    1. Compile C++ with NDK 26.x for Android aarch64 and run on device.
  • Etc...

Expected Results

Deserialization succeeds with no errors.

Actual Results

  • Deserialization fails with error:
    Module was compiled with concurrency support but it is not enabled for the host
  • Program crashes:
    libc++abi: terminating due to uncaught exception of type std::runtime_error

Versions and Environment

  • Wasmtime version or commit: v42.0.1 (buggy), v41.0.0 (partial bug), v40.0.0 (working)
  • Operating system (compile cwasm): macOS aarch64
  • Operating system (run cwasm): Android 13 (API 33) aarch64
  • Architecture: aarch64-linux-android (cwasm target), wasm32-wasip1 (Wasm source)

Extra Info

v40.0.0: works correctly (no concurrency flag)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIncorrect behavior in the current implementation that needs fixing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions