Skip to content

Wasm bundle for sys crate with FFI exports is empty #63629

@lopopolo

Description

@lopopolo

I'm trying to compile mruby-sys to wasm. mruby-sys builds a C static library using the cc crate. cc generates two wasm files, one of which I can't read with 0000004: error: bad magic value error. The other looks like valid wasm and I can read it with wasm2wat.

crate mruby-sys exports:

  • all FFI bindings to extern "C" functions
  • several Rust functions that are annotated with #[inline].

The resulting wasm bundle for mruby-sys is empty:

(module
  (type (;0;) (func))
  (func $__wasm_call_ctors (type 0))
  (table (;0;) 1 1 anyfunc)
  (memory (;0;) 17)
  (global (;0;) (mut i32) (i32.const 1048576))
  (global (;1;) i32 (i32.const 1048610))
  (global (;2;) i32 (i32.const 1048610))
  (global (;3;) i32 (i32.const 1048576))
  (export "memory" (memory 0))
  (export "__heap_base" (global 1))
  (export "__data_end" (global 2))
  (export "__rustc_debug_gdb_scripts_section__" (global 3))
  (data (;0;) (i32.const 1048576) "\01gdb_load_rust_pretty_printers.py\00"))

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-FFIArea: Foreign function interface (FFI)C-bugCategory: This is a bug.O-wasmTarget: WASM (WebAssembly), http://webassembly.org/T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions