leptos-rs / leptos

Build fast web applications with Rust.
https://leptos.dev
MIT License
15.31k stars 599 forks source link

relese build causes SIGSEGV and SIGBUS while dev build is just fine #2590

Closed ta3pks closed 1 month ago

ta3pks commented 1 month ago

Describe the bug When running release build wasm panics fails to build giving the following output

      Cargo finished cargo build --package=build_fails --lib --target-dir=/Users/nikos/.cargo_build/front --target=wasm32-unknown-unknown --no-default-features --features=hydrate --profile=wasm-release
       Front compiling WASM
   Compiling proc-macro2 v1.0.82
   Compiling serde v1.0.201
   Compiling libc v0.2.154
   Compiling slab v0.4.9
   Compiling wasm-bindgen-shared v0.2.92
   Compiling log v0.4.21
   Compiling futures-io v0.3.30
   Compiling pin-utils v0.1.0
error: failed to run custom build command for `proc-macro2 v1.0.82`

Caused by:
  process didn't exit successfully: `/Users/nikos/.cargo_build/release/build/proc-macro2-4389c0b0b07a440b/build-script-build` (signal: 10, SIGBUS: access to undefined memory)
warning: build failed, waiting for other jobs to finish...
error: failed to run custom build command for `serde v1.0.201`

Caused by:
  process didn't exit successfully: `/Users/nikos/.cargo_build/release/build/serde-1636c9b85f2ab134/build-script-build` (signal: 11, SIGSEGV: invalid memory reference)
error: failed to run custom build command for `libc v0.2.154`

Caused by:
  process didn't exit successfully: `/Users/nikos/.cargo_build/release/build/libc-32c6dd0460c9484e/build-script-build` (signal: 10, SIGBUS: access to undefined memory)
error: failed to run custom build command for `wasm-bindgen-shared v0.2.92`

Caused by:
  process didn't exit successfully: `/Users/nikos/.cargo_build/release/build/wasm-bindgen-shared-db7003eb6414ef20/build-script-build` (signal: 11, SIGSEGV: invalid memory reference)
error: failed to run custom build command for `slab v0.4.9`

Caused by:
  process didn't exit successfully: `/Users/nikos/.cargo_build/release/build/slab-7a33c5c56d61a557/build-script-build` (signal: 10, SIGBUS: access to undefined memory)
Error: Failed to build build_fails

Leptos Dependencies

[dependencies]
axum = { version = "0.7", optional = true }
console_error_panic_hook = "0.1"
leptos = { version = "0.6" }
leptos_axum = { version = "0.6", optional = true }
leptos_meta = { version = "0.6" }
leptos_router = { version = "0.6" }
tokio = { version = "1", features = ["rt-multi-thread"], optional = true }
tower = { version = "0.4", optional = true }
tower-http = { version = "0.5", features = ["fs"], optional = true }
wasm-bindgen = "=0.2.92"
thiserror = "1"
tracing = { version = "0.1", optional = true }
http = "1"

[features]
hydrate = ["leptos/hydrate", "leptos_meta/hydrate", "leptos_router/hydrate"]
ssr = [
    "dep:axum",
    "dep:tokio",
    "dep:tower",
    "dep:tower-http",
    "dep:leptos_axum",
    "leptos/ssr",
    "leptos_meta/ssr",
    "leptos_router/ssr",
    "dep:tracing",
]

To Reproduce Steps to reproduce the behavior:

  1. cargo leptos new -g leptos-rs/start-axum -n build_fails
  2. cd build_fails
  3. cargo leptos build -r
  4. See error

Expected behavior Should build just fine

Screenshots

image
gbj commented 1 month ago

I can't reproduce this.

ta3pks commented 1 month ago

in my case it happens every single time new projects old projects doesnt matter any suggestions?

ta3pks commented 1 month ago

Okay I figured it out. I was using a different linker than the default ld linker seems it is the issue here