Skip to content

Add wasm32-unknown-unknown support #1769

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

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

Conversation

@Spxg
Copy link
Contributor

@Spxg Spxg commented Dec 7, 2025

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
Copy link
Collaborator

gwenn commented Dec 7, 2025

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
Copy link
Contributor Author

Spxg commented Dec 7, 2025

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
@Spxg Spxg force-pushed the w/make branch 3 times, most recently from 923655f to bf08aab Compare December 7, 2025 12:48
@gwenn
Copy link
Collaborator

gwenn commented Dec 7, 2025

% 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
Copy link
Contributor Author

Spxg commented Dec 7, 2025

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

done

@Spxg Spxg requested a review from gwenn December 7, 2025 17:16
@Spxg
Copy link
Contributor Author

Spxg commented Dec 8, 2025

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

@gwenn
Copy link
Collaborator

gwenn commented Dec 8, 2025

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)

@Spxg Spxg force-pushed the w/make branch 3 times, most recently from 3062561 to 8e499dd Compare December 9, 2025 05:57
@Spxg
Copy link
Contributor Author

Spxg commented Dec 9, 2025

#[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
Copy link
Collaborator

gwenn commented Dec 14, 2025

Almost 5 years later
Thanks.

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