Skip to content

Segfault running wasm-pack build #68

Open
@joseph-rissler

Description

@joseph-rissler

Describe the Bug

I'm working through to Game of Life tutorial at https://rustwasm.github.io/docs/book/game-of-life/hello-world.html

Running wasm-pack build results in a segfault after the Compiling wasm-bindgen v0.2.84 status line. Shell prompt returns, but compiling completes in the background, muddying shell prompt. No files are added to the pkg/ directory.

Steps to Reproduce

  1. Clone template with cargo generate
  2. cd into generated directory.
  3. Run wasm-pack build

Expected Behavior

wasm-pack build should complete without error and produce files in pkg/ directory, as described in the tutorial link above.

Actual Behavior

Segfault, apparently during "compiling wasm-bindgen". No files are added to pkg/ directory.

Running wasm-pack build a second time shows the segfault after "Installing wasm-bindgen"

Additional Context

cargo 1.67.0 (8ecd4f20a 2023-01-10) on Archlinux, kernel 6.2.2-zen1-1-zen

A .wasm file is generated in target/wasm32-unknown-unknown/release/, but I'm guessing it is meant to be copied to pkg/ during the failed portion of the build.

terminal buffer:

🤷   Project Name: wasm-game-of-life
🔧   Destination: /home/user/Rust/wasm-game-of-life ...
🔧   project-name: wasm-game-of-life ...
🔧   Generating template ...
[ 1/12]   Done: .appveyor.yml                                                           
[ 2/12]   Done: .gitignore                                                              
[ 3/12]   Done: .travis.yml                                                             
[ 4/12]   Done: Cargo.toml                                                              
[ 5/12]   Done: LICENSE_APACHE                                                          
[ 6/12]   Done: LICENSE_MIT                                                             
[ 7/12]   Done: README.md                                                               
[ 8/12]   Done: src/lib.rs                                                              
[ 9/12]   Done: src/utils.rs                                                            
[10/12]   Done: src                                                                     
[11/12]   Done: tests/web.rs                                                            
[12/12]   Done: tests                                                                   
🔧   Moving generated files into: `/home/user/Rust/wasm-game-of-life`...
💡   Initializing a fresh Git repository
✨   Done! New project created /home/user/Rust/wasm-game-of-life
[user@host Rust]$ cd wasm-game-of-life/
[user@host wasm-game-of-life]$ wasm-pack build
[INFO]: Checking for the Wasm target...
[INFO]: Compiling to Wasm...
   Compiling proc-macro2 v1.0.51
   Compiling unicode-ident v1.0.7
   Compiling quote v1.0.23
   Compiling syn v1.0.109
   Compiling wasm-bindgen-shared v0.2.84
   Compiling log v0.4.17
   Compiling cfg-if v1.0.0
   Compiling bumpalo v3.12.0
   Compiling once_cell v1.17.1
   Compiling wasm-bindgen v0.2.84
Segmentation fault (core dumped)=>       ] 21/28: syn
[user@host wasm-game-of-life]$    Compiling wasm-bindgen-backend v0.2.84
   Compiling wasm-bindgen-macro-support v0.2.84
   Compiling wasm-bindgen-macro v0.2.84
   Compiling console_error_panic_hook v0.1.7
   Compiling wasm-game-of-life v0.1.0 (/home/user/Rust/wasm-game-of-life)
warning: function `set_panic_hook` is never used
 --> src/utils.rs:1:8
  |
1 | pub fn set_panic_hook() {
  |        ^^^^^^^^^^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: `wasm-game-of-life` (lib) generated 1 warning
    Finished release [optimized] target(s) in 8.30s

[user@host wasm-game-of-life]$ wasm-pack build
[INFO]: Checking for the Wasm target...
[INFO]: Compiling to Wasm...
warning: function `set_panic_hook` is never used
 --> src/utils.rs:1:8
  |
1 | pub fn set_panic_hook() {
  |        ^^^^^^^^^^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: `wasm-game-of-life` (lib) generated 1 warning
    Finished release [optimized] target(s) in 0.02s
[INFO]: Installing wasm-bindgen...
Segmentation fault (core dumped)
[user@host wasm-game-of-life]$ ls pkg/
README.md
[user@host wasm-game-of-life]$ ls target/wasm32-unknown-unknown/release/
build  examples     libwasm_game_of_life.d     wasm_game_of_life.d
deps   incremental  libwasm_game_of_life.rlib  wasm_game_of_life.wasm```

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions