diff --git a/scripts/build-snarkyjs-node.sh b/scripts/build-snarkyjs-node.sh index 32ea21f2b51..126e2911acc 100755 --- a/scripts/build-snarkyjs-node.sh +++ b/scripts/build-snarkyjs-node.sh @@ -5,8 +5,11 @@ pushd "$SNARKY_JS_PATH" [ -d node_modules ] || npm i popd +export DUNE_USE_DEFAULT_LINKER="y" + dune b src/lib/crypto/kimchi_bindings/js/node_js \ -&& dune b src/lib/snarky_js_bindings/snarky_js_node.bc.js src/lib/snarky_js_bindings/snarkyjs/src/snarky/gen/js-layout.ts || exit 1 +&& dune b src/lib/snarky_js_bindings/snarky_js_node.bc.js \ +&& dune b src/lib/snarky_js_bindings/snarkyjs/src/snarky/gen/js-layout.ts || exit 1 BINDINGS_PATH="$SNARKY_JS_PATH"/dist/server/node_bindings/ mkdir -p "$BINDINGS_PATH" diff --git a/src/dune.linker.inc b/src/dune.linker.inc index fbece65520b..ae253449a69 100644 --- a/src/dune.linker.inc +++ b/src/dune.linker.inc @@ -9,5 +9,8 @@ (rule (target dune-linker) - (enabled_if (= %{bin-available:lld} false)) + (enabled_if + (or + (= %{bin-available:lld} false) + (= %{env:DUNE_USE_DEFAULT_LINKER=n} n))) (action (with-stdout-to dune-linker (echo " ")))) diff --git a/src/lib/crypto/kimchi_bindings/dune b/src/lib/crypto/kimchi_bindings/dune deleted file mode 100644 index a1879e3696a..00000000000 --- a/src/lib/crypto/kimchi_bindings/dune +++ /dev/null @@ -1,2 +0,0 @@ -(data_only_dirs wasm) - diff --git a/src/lib/crypto/kimchi_bindings/js/chrome/dune b/src/lib/crypto/kimchi_bindings/js/chrome/dune index 8d27248c5ed..cd1cede57bd 100644 --- a/src/lib/crypto/kimchi_bindings/js/chrome/dune +++ b/src/lib/crypto/kimchi_bindings/js/chrome/dune @@ -15,7 +15,8 @@ flags.sexp snippets/) (deps - (source_tree ../../wasm) + ../../wasm/Cargo.toml + (source_tree ../../wasm/src) (source_tree ../../wasm/.cargo/config) (source_tree ../../../../../external/wasm-bindgen-rayon) (source_tree ../../../proof-systems) ) diff --git a/src/lib/crypto/kimchi_bindings/js/node_js/dune b/src/lib/crypto/kimchi_bindings/js/node_js/dune index 77de6b66168..56a385a6526 100644 --- a/src/lib/crypto/kimchi_bindings/js/node_js/dune +++ b/src/lib/crypto/kimchi_bindings/js/node_js/dune @@ -14,7 +14,8 @@ plonk_wasm.js flags.sexp) (deps - (source_tree ../../wasm) + ../../wasm/Cargo.toml + (source_tree ../../wasm/src) (source_tree ../../wasm/.cargo/config) (source_tree ../../../../../external/wasm-bindgen-rayon) (source_tree ../../../proof-systems) ) diff --git a/src/lib/crypto/kimchi_bindings/stubs/Cargo.toml b/src/lib/crypto/kimchi_bindings/stubs/Cargo.toml index 72a7328a5c8..495a7e5344d 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/Cargo.toml +++ b/src/lib/crypto/kimchi_bindings/stubs/Cargo.toml @@ -9,7 +9,7 @@ edition = "2021" [lib] name = "wires_15_stubs" -crate-type = ["lib", "staticlib"] +crate-type = ["lib", "staticlib", "cdylib"] [dependencies] array-init = "2.0.0" diff --git a/src/lib/crypto/kimchi_bindings/stubs/dune b/src/lib/crypto/kimchi_bindings/stubs/dune index fce500b8adf..b77403f2aeb 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/dune +++ b/src/lib/crypto/kimchi_bindings/stubs/dune @@ -15,7 +15,7 @@ (rule (enabled_if (= %{env:MARLIN_PLONK_STUBS=n} n)) - (targets libwires_15_stubs.a) + (targets libwires_15_stubs.a dllwires_15_stubs.so) (deps Cargo.toml (source_tree src) @@ -27,7 +27,8 @@ RUSTFLAGS "-C target-feature=+bmi2,+adx" (run cargo build --release)) - (run cp %{read:cargo-target-path}/release/libwires_15_stubs.a .)))) + (run cp %{read:cargo-target-path}/release/libwires_15_stubs.a .) + (run cp %{read:cargo-target-path}/release/libwires_15_stubs.so dllwires_15_stubs.so)))) ;; copy from $MARLIN_PLONK_STUBS if this exists (copy_files diff --git a/src/lib/crypto/kimchi_bindings/wasm/dune b/src/lib/crypto/kimchi_bindings/wasm/dune new file mode 100644 index 00000000000..1e073fbe82f --- /dev/null +++ b/src/lib/crypto/kimchi_bindings/wasm/dune @@ -0,0 +1,3 @@ +(data_only_dirs src) + +(dirs :standard \ target) diff --git a/src/lib/dummy_values/gen_values/dune b/src/lib/dummy_values/gen_values/dune index 14daa452718..c5adc2be733 100644 --- a/src/lib/dummy_values/gen_values/dune +++ b/src/lib/dummy_values/gen_values/dune @@ -1,5 +1,6 @@ (executable (name gen_values) + (link_flags (-linkall)) (libraries ;; opam libraries async_unix diff --git a/src/lib/pickles/plonk_checks/gen_scalars/dune b/src/lib/pickles/plonk_checks/gen_scalars/dune index 62a8fdcfe8f..ffa7a1ae6d0 100644 --- a/src/lib/pickles/plonk_checks/gen_scalars/dune +++ b/src/lib/pickles/plonk_checks/gen_scalars/dune @@ -1,5 +1,7 @@ (executable (name gen_scalars) + (modes native) + (link_flags (-linkall)) (libraries ;; opam libraries core_kernel diff --git a/src/lib/snarky_js_bindings/dune b/src/lib/snarky_js_bindings/dune index f923fc6cfb7..cba973fd553 100644 --- a/src/lib/snarky_js_bindings/dune +++ b/src/lib/snarky_js_bindings/dune @@ -1,7 +1,11 @@ +(env + (_ (js_of_ocaml (compilation_mode whole_program)))) + (executable (name snarky_js_node) (modules snarky_js_node) (modes js) + (link_flags (-noautolink)) (js_of_ocaml (flags +toplevel.js +dynlink.js)) (libraries snarky_js_bindings_lib node_backend) @@ -18,6 +22,7 @@ (name snarky_js_chrome) (modules snarky_js_chrome) (modes js) + (link_flags (-noautolink)) (js_of_ocaml (flags +toplevel.js +dynlink.js)) (libraries snarky_js_bindings_lib chrome_backend) @@ -33,6 +38,7 @@ (executable (name snarky_js_types) (modules snarky_js_types) + (link_flags (-linkall)) (modes native) (libraries mina_base fields_derivers_zkapps yojson) (instrumentation