Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve wasm32-wasi support #1332

Merged
merged 1 commit into from Nov 25, 2023
Merged

Improve wasm32-wasi support #1332

merged 1 commit into from Nov 25, 2023

Commits on May 25, 2023

  1. Improve wasm32-wasi support

    [Starting from 3.41.0 SQLite has wasm32-wasi support out of the
    box.][0]
    
    - Set `-DSQLITE_THREADSAFE=0`. Fixes:
    
    ```
    $ wasmtime target/wasm32-wasi/release/examples/persons.wasm
    Error: failed to run main module `target/wasm32-wasi/release/examples/persons.wasm`
    
    Caused by:
        0: failed to instantiate "target/wasm32-wasi/release/examples/persons.wasm"
        1: unknown import: `env::pthread_mutexattr_init` has not been defined
    ```
    
    - Drop `-DSQLITE_OS_OTHER`. Fixes:
    
    ```
    $ wasmtime target/wasm32-wasi/release/examples/persons.wasm
    Error: failed to run main module `target/wasm32-wasi/release/examples/persons.wasm`
    
    Caused by:
        0: failed to instantiate "target/wasm32-wasi/release/examples/persons.wasm"
        1: unknown import: `env::sqlite3_os_init` has not been defined
    ```
    
    - [Add wasi specific build flags][1]
    - Add basic example
    - Also, add instructions how to run it against wasm32-wasi.
    
    Using of file databases is also working, though `--mapdir` arg
    should be provided to `wasmtime run`.
    
    [0]: https://wasmlabs.dev/articles/sqlite-wasi-support/
    [1]: https://github.com/vmware-labs/webassembly-language-runtimes/blob/main/libs/sqlite/wasi-patches/wlr-build.sh#L11
    etehtsea committed May 25, 2023
    Configuration menu
    Copy the full SHA
    5534eb9 View commit details
    Browse the repository at this point in the history