From 496e710b019069a774954e9a71569943b78c1fed Mon Sep 17 00:00:00 2001 From: Carlo Piovesan Date: Wed, 13 Nov 2024 01:47:47 +0100 Subject: [PATCH 01/10] Move extension-ci-tools to after wasm fixes --- extension-ci-tools | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension-ci-tools b/extension-ci-tools index 27facd3..5bdbe4d 160000 --- a/extension-ci-tools +++ b/extension-ci-tools @@ -1 +1 @@ -Subproject commit 27facd3b63aa4c7c23e80e726851db132f1db264 +Subproject commit 5bdbe4d606d78dbd749f9578ba8ca639feece023 From cce5effe22a559d50df586ae9b5c703a8bc1c11f Mon Sep 17 00:00:00 2001 From: Carlo Piovesan Date: Wed, 13 Nov 2024 01:46:12 +0100 Subject: [PATCH 02/10] Add example workaround to change create-type in Wasm --- Cargo.toml | 7 ++++++- src/wasm_lib.rs | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 src/wasm_lib.rs diff --git a/Cargo.toml b/Cargo.toml index ffb2655..57df258 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,12 @@ edition = "2021" [lib] crate-type = ["cdylib"] +[[example]] +name = "rusty-quack" +path = "src/wasm_lib.rs" +crate-type = ["staticlib"] + [dependencies] duckdb = { version = "1.1.1", features = ["vtab-loadable"] } duckdb-loadable-macros = "0.1.3" -libduckdb-sys = { version = "1.1.1", features = ["loadable-extension"] } \ No newline at end of file +libduckdb-sys = { version = "1.1.1", features = ["loadable-extension"] } diff --git a/src/wasm_lib.rs b/src/wasm_lib.rs new file mode 100644 index 0000000..2700c77 --- /dev/null +++ b/src/wasm_lib.rs @@ -0,0 +1,3 @@ +#![allow(special_module_name)] + +mod lib; From 12335d7491c471609734dbbb7695eb4402cd79c5 Mon Sep 17 00:00:00 2001 From: Carlo Piovesan Date: Wed, 13 Nov 2024 01:49:06 +0100 Subject: [PATCH 03/10] Enable Wasm in workflow --- .github/workflows/MainDistributionPipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/MainDistributionPipeline.yml b/.github/workflows/MainDistributionPipeline.yml index bcb3e5d..2c9d2d1 100644 --- a/.github/workflows/MainDistributionPipeline.yml +++ b/.github/workflows/MainDistributionPipeline.yml @@ -20,4 +20,4 @@ jobs: ci_tools_version: main extension_name: rusty_quack extra_toolchains: rust;python3 - exclude_archs: 'wasm_mvp;wasm_eh;wasm_threads;windows_amd64_rtools' \ No newline at end of file + exclude_archs: 'windows_amd64_rtools' From 94e3047fbf86f05396adfdf656e51bb93e04a230 Mon Sep 17 00:00:00 2001 From: Carlo Piovesan Date: Wed, 13 Nov 2024 01:56:27 +0100 Subject: [PATCH 04/10] Add env version of Makefile --- Makefile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e8fa908..63cd79e 100644 --- a/Makefile +++ b/Makefile @@ -22,4 +22,13 @@ test_debug: test_extension_debug test_release: test_extension_release clean: clean_build clean_rust -clean_all: clean_configure clean \ No newline at end of file +clean_all: clean_configure clean + +wasm_mvp: export DUCKDB_PLATFORM = wasm_mvp +wasm_mvp: configure release + +wasm_eh: export DUCKDB_PLATFORM = wasm_eh +wasm_eh: configure release + +wasm_threads: export DUCKDB_PLATFORM = wasm_coi +wasm_threads: configure release From 071b31dd652dd185aa91b4021fc0731f9f4317a0 Mon Sep 17 00:00:00 2001 From: Carlo Piovesan Date: Wed, 13 Nov 2024 01:59:29 +0100 Subject: [PATCH 05/10] Name example after crate --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 57df258..6792d64 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" crate-type = ["cdylib"] [[example]] -name = "rusty-quack" +name = "rusty_quack" path = "src/wasm_lib.rs" crate-type = ["staticlib"] From 72133a50cddd205aaab0ba2b2bb7ff274d619112 Mon Sep 17 00:00:00 2001 From: Carlo Piovesan Date: Wed, 13 Nov 2024 02:04:42 +0100 Subject: [PATCH 06/10] Fix paths --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 63cd79e..15ac3a9 100644 --- a/Makefile +++ b/Makefile @@ -26,9 +26,12 @@ clean_all: clean_configure clean wasm_mvp: export DUCKDB_PLATFORM = wasm_mvp wasm_mvp: configure release + cp -r build/release build/wasm_mvp wasm_eh: export DUCKDB_PLATFORM = wasm_eh wasm_eh: configure release + cp -r build/release build/wasm_eh wasm_threads: export DUCKDB_PLATFORM = wasm_coi wasm_threads: configure release + cp -r build/release build/wasm_threads From 5e81c30887a98f247fdca07d214089eae8112e0f Mon Sep 17 00:00:00 2001 From: Carlo Piovesan Date: Wed, 13 Nov 2024 10:38:53 +0100 Subject: [PATCH 07/10] Add comments on crate-type switch --- Cargo.toml | 4 ++++ src/wasm_lib.rs | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 6792d64..19ed968 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,10 @@ edition = "2021" crate-type = ["cdylib"] [[example]] +# crate-type can't be (at the moment) be overriden for specific targets +# src/wasm_lib.rs forwards to src/lib.rs so that we can change from cdylib +# (that is needed while compiling natively) to staticlib (needed since the +# actual linking will be done via emcc name = "rusty_quack" path = "src/wasm_lib.rs" crate-type = ["staticlib"] diff --git a/src/wasm_lib.rs b/src/wasm_lib.rs index 2700c77..3f9a73e 100644 --- a/src/wasm_lib.rs +++ b/src/wasm_lib.rs @@ -1,3 +1,14 @@ #![allow(special_module_name)] mod lib; + +// To build the Wasm target, a `staticlib` crate-type is required +// +// This is different than the default needed in native, and there is +// currently no way to select crate-type depending on target. +// +// This file sole purpose is remapping the content of lib as an +// example, do not change the content of the file. +// +// To build the Wasm target explicitly, use: +// cargo build --example $PACKAGE_NAME From 16712be9a17c8d9762e42da4c58fbe5f61aa9083 Mon Sep 17 00:00:00 2001 From: Carlo Piovesan Date: Wed, 13 Nov 2024 12:57:20 +0100 Subject: [PATCH 08/10] Remove unnecessary code --- Makefile | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/Makefile b/Makefile index 15ac3a9..3c0ac05 100644 --- a/Makefile +++ b/Makefile @@ -23,15 +23,3 @@ test_release: test_extension_release clean: clean_build clean_rust clean_all: clean_configure clean - -wasm_mvp: export DUCKDB_PLATFORM = wasm_mvp -wasm_mvp: configure release - cp -r build/release build/wasm_mvp - -wasm_eh: export DUCKDB_PLATFORM = wasm_eh -wasm_eh: configure release - cp -r build/release build/wasm_eh - -wasm_threads: export DUCKDB_PLATFORM = wasm_coi -wasm_threads: configure release - cp -r build/release build/wasm_threads From 33942051db05ff451629dda744c0d22b104600bd Mon Sep 17 00:00:00 2001 From: Carlo Piovesan Date: Wed, 13 Nov 2024 14:56:50 +0100 Subject: [PATCH 09/10] Bump again extension-ci-tools --- extension-ci-tools | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension-ci-tools b/extension-ci-tools index 5bdbe4d..d3a5766 160000 --- a/extension-ci-tools +++ b/extension-ci-tools @@ -1 +1 @@ -Subproject commit 5bdbe4d606d78dbd749f9578ba8ca639feece023 +Subproject commit d3a57666450bbf38e72711fddd7beffd85635998 From e5cf3e95d4715b8d219a8011823b4d0fc61ac153 Mon Sep 17 00:00:00 2001 From: Carlo Piovesan Date: Wed, 13 Nov 2024 15:03:01 +0100 Subject: [PATCH 10/10] Skip threaded wasm for now --- .github/workflows/MainDistributionPipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/MainDistributionPipeline.yml b/.github/workflows/MainDistributionPipeline.yml index 2c9d2d1..2a4cb79 100644 --- a/.github/workflows/MainDistributionPipeline.yml +++ b/.github/workflows/MainDistributionPipeline.yml @@ -20,4 +20,4 @@ jobs: ci_tools_version: main extension_name: rusty_quack extra_toolchains: rust;python3 - exclude_archs: 'windows_amd64_rtools' + exclude_archs: 'wasm_threads;windows_amd64_rtools'