jean-pierreBoth / hnswlib-rs

Rust implementation of the HNSW algorithm (Malkov-Yashunin)
Other
159 stars 21 forks source link

Request to support wasm32 target #20

Open komal-sai-yral opened 4 months ago

komal-sai-yral commented 4 months ago

Few dependencies are blocking the build to wasm32-unknown-unknown target

mmap-rs and cpu-time

I also tried removing them with depending code (as I don't need the IO feature currently), but getting some other issues like below :

Caused by: Failed while trying to install all canisters.
Caused by: Failed to install wasm module to canister 'elna_db_backend'.
Caused by: Failed during wasm installation call
Caused by: The replica returned a rejection error: reject code CanisterError, reject message Error from Canister bkyz2-fmaaa-aaaaa-qaaaq-cai: Canister's Wasm module is not valid: Wasm module has an invalid import section. Module imports function '__wbg_crypto_566d7465cdbb6b7a' from '__wbindgen_placeholder__' that is not exported by the runtime..
This is likely an error with the compiler/CDK toolchain being used to build the canister. Please report the error to IC devs on the forum: https://forum.dfinity.org and include which language/CDK was used to create the canister., error code None

Relevant error from above - Module imports function '__wbg_crypto_566d7465cdbb6b7a' from '__wbindgen_placeholder__' that is not exported by the runtime..

Please consider adding wasm32-unknown-unknown support

jean-pierreBoth commented 4 months ago

I am afraid this will require some work: need to make mmap dependant on arch via the crate https://crates.io/crates/wasmtime-runtime and or add a feature for mmap. I will give it a try ... not just now

komal-sai-yral commented 4 months ago

Sure, thanks a lot