Skip to content

Add wasm32-unknown-unknown support #1769

Merged
gwenn merged 2 commits into
rusqlite:masterfrom
Spxg:w/make
Dec 14, 2025
Merged

Add wasm32-unknown-unknown support #1769
gwenn merged 2 commits into
rusqlite:masterfrom
Spxg:w/make

Conversation

@Spxg

@Spxg Spxg commented Dec 7, 2025

Copy link
Copy Markdown
Contributor

The main diff is to replace libsqlite3-sys with sqlite-wasm-rs on the wasm platform, while keeping everything else unchanged.

Previous PR: #1643

resolves #488
resolves #827
resolves #1010

@gwenn

gwenn commented Dec 7, 2025

Copy link
Copy Markdown
Collaborator

Something like:
https://github.com/rust-random/getrandom/blob/8861a62a25cafad5a0cc5bc1f16715865b9d4456/tests/mod.rs#L4-L5

#[cfg(all(feature = "wasm_js", target_arch = "wasm32", target_os = "unknown"))]
use wasm_bindgen_test::wasm_bindgen_test as test;

doesn't work (instead of rusqlite-test-helper) ?

@Spxg

Spxg commented Dec 7, 2025

Copy link
Copy Markdown
Contributor Author

doesn't work (instead of rusqlite-test-helper) ?

it requires adding this line of configuration to every test mod, which may not be the most convenient approach.

@Spxg Spxg marked this pull request as ready for review December 7, 2025 12:28
@gwenn

gwenn commented Dec 7, 2025

Copy link
Copy Markdown
Collaborator
% rg -F 'mod test' | wc -l
      41

vs

% rg -F '#[test]' | wc -l
     275

We don't have to think about wasm each time we add a test function (only when we add a test module)...

@Spxg

Spxg commented Dec 7, 2025

Copy link
Copy Markdown
Contributor Author

We don't have to think about wasm each time we add a test function (only when we add a test module)...

done

Comment thread src/lib.rs Outdated
Comment thread src/limits.rs Outdated
Comment thread Cargo.toml
@Spxg Spxg requested a review from gwenn December 7, 2025 17:16
@Spxg

Spxg commented Dec 8, 2025

Copy link
Copy Markdown
Contributor Author

hmm, continuous-integration/appveyor/pr failure doesn't seem related to this PR

@gwenn

gwenn commented Dec 8, 2025

Copy link
Copy Markdown
Collaborator

hmm, continuous-integration/appveyor/pr failure doesn't seem related to this PR

Yep, you can ignore it.
(I will try to merge your PR this week)

Comment thread src/lib.rs Outdated
@Spxg

Spxg commented Dec 9, 2025

Copy link
Copy Markdown
Contributor Author
#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
#[deprecated(since = "0.33.0", note = "use trace_v2 instead")]
pub fn trace(&mut self, trace_fn: Option<fn(&str)>) {}

#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
#[deprecated(since = "0.33.0", note = "use trace_v2 instead")]
pub fn profile(&mut self, profile_fn: Option<fn(&str, Duration)> {}

sqlite_wasm_rs no longer bindgen sqlite3_trace and sqlite3_profile, so I configured them.

@gwenn gwenn merged commit 6bb49e1 into rusqlite:master Dec 14, 2025
14 of 15 checks passed
@gwenn

gwenn commented Dec 14, 2025

Copy link
Copy Markdown
Collaborator

Almost 5 years later
Thanks.

@Spxg Spxg deleted the w/make branch December 17, 2025 05:27
hloo added a commit to ycashfoundation/rusqlite that referenced this pull request Apr 19, 2026
Follows cherry-pick of upstream PR rusqlite#1769 (wasm32-unknown-unknown
support). Two adjustments on top of that PR for a minimal-diff 0.37-based
fork:

- sqlite-wasm-rs bumped down to 0.4.0 (with the `precompiled` feature)
  because 0.5.x demands newer js-sys/hashbrown than the consuming
  librustzcash-ycash workspace can accept without a larger rebase.
  0.4.0 is compatible with the wasm-bindgen 0.2.100 pin.

- Reverted libsqlite3-sys cc/syn bumps the upstream PR pulled in
  (1.2.27 -> 1.1.6, syn 2.0.87 -> 2.0.72). Those bumps are only for
  the PR's own CI/bindings regen, not needed for the wasm backend,
  and they conflict with librustzcash-ycash's locked toolchain deps.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't build for wasm target wasm build fails import sqlite3_* functions

2 participants