Building blas on wasm32?

Is there a way to get https://crates.io/crates/blas to build on wasm32-unknown-emscripten?

As you can see in the docs, this crate is only a wrapper for a Fortran code called through FFI. Do you have a way to compile this Fortran code into your target?

blas has an option to use crate openblas-src

crate openblas-src has a feature called ‘static’ which statically links it

as far as I know, emscripten works on *.o files

It seems, combining these three facts, in theory, this should be possible.

I couldn’t get it to work myself, and thus I’m hoping someone else got it to work and has a working config

Emscripten does not work on the usual *.o file. It saves LLVM bitcode in files it calls *.o, and then convert them to asm.js/Wasm at ‘link’ time. In order to compile Fortran (and thus Blas) to wasm with emscripten, you would need a fortran compiler that can emit LLVM bitcode. And there are no fully functioning fortran compiler targeting LLVM. There is https://github.com/flang-compiler/flang, but I don’t know how well it works, and you would need to compile it yourself and link it to a version of LLVM with support for wasm.