Rust WASM Engine Compilation
The core query transpilation engine is built in Rust (orcha-rust-engine) and compiled to WebAssembly (WASM). This binary parses queries, resolves calculated virtual columns, and converts them to native database dialects.
Overview
If you modify the Rust files under orcha-rust-engine/src/, or perform a clean build on a fresh environment, you must compile the WASM binary using wasm-pack and place the build output into lib/wasm-engine/.
Prerequisites
1. Install Rust and Cargo via rustup:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
2. Install wasm-pack:
cargo install wasm-pack
Compiling with wasm-pack
Navigate to the Rust engine crate directory and trigger the Node.js target build:
cd orcha-rust-engine wasm-pack build --target nodejs
This generates WebAssembly binaries, JS loader shims, and TypeScript definitions inside orcha-rust-engine/pkg/.
Deploying the Binary to Next.js
Copy the compiled WASM package into lib/wasm-engine/:
mkdir -p lib/wasm-engine cp orcha-rust-engine/pkg/orcha_semantic_engine_bg.wasm lib/wasm-engine/ cp orcha-rust-engine/pkg/orcha_semantic_engine.js lib/wasm-engine/ cp orcha-rust-engine/pkg/orcha_semantic_engine.d.ts lib/wasm-engine/
Troubleshooting Windows GNU Linker Errors
If MinGW throws unable to find library -lgcc_eh, switch to the official Microsoft Visual C++ build tools:
rustup default stable-x86_64-pc-windows-msvc cd orcha-rust-engine cargo clean wasm-pack build --target nodejs