unit-wasm icon indicating copy to clipboard operation
unit-wasm copied to clipboard

Add support for FreeBSD.

Open osokin opened this issue 1 year ago • 2 comments

With this patch it's possible to run `CC=clang13 gmake examples' and get wasm files. However,

CC=clang13 gmake all

requires a bit more work.

osokin avatar Nov 03 '23 21:11 osokin

Hi Sergey,

Thanks, let me take a look because I thought I did have it building under FreeBSD...

ac000 avatar Nov 03 '23 22:11 ac000

Hmm, does

$ gmake CC=clang13 rust

work for you?

I get an error about not finding stddef.h, which I can hack around with

diff --git a/src/rust/unit-wasm-sys/build.rs b/src/rust/unit-wasm-sys/build.rs
index 1f41afa..0e65f58 100644
--- a/src/rust/unit-wasm-sys/build.rs
+++ b/src/rust/unit-wasm-sys/build.rs
@@ -39,6 +39,7 @@ fn generate_bindings() {
         .default_enum_style(bindgen::EnumVariation::Rust {
             non_exhaustive: false,
         })
+       .clang_arg("-I/usr/local/share/wasi-sysroot/include")
         .generate()
         .expect("Unable to generate bindings");
 

But then I get a bunch of other errors starting with

   Compiling unit-wasm-sys v0.3.0 (/usr/home/andrew/src/unit-wasm/src/rust/unit-wasm-sys)
error[E0463]: can't find crate for `std`
  |
  = note: the `wasm32-wasi` target may not be installed
  = help: consider downloading the target with `rustup target add wasm32-wasi`

Perhaps some other package needs to be installed to provide the wasm32-wasi target?

Although

$ rustc --print target-list | grep wasm
wasm32-unknown-emscripten
wasm32-unknown-unknown
wasm32-wasi
wasm64-unknown-unknown

So maybe my FreeBSD install is just messed up as I'm sure this used to work...

ac000 avatar Nov 04 '23 01:11 ac000