Skip to content

cargo-leptos build error when specifying custom profile in --bin-cargo-args #485

Open
@komal-sai-yral

Description

@komal-sai-yral

Context : I want 3 profiles for bin

  • debug for local development which is normal
  • preview-release for preview links
  • prod-release for prod
// Cargo.toml

[profile.prod-release]
inherits = "release"
debug = 1
lto = true
opt-level = 's'
split-debuginfo = "packed"
strip = true

[profile.preview-release]
inherits = "release"

[profile.wasm-release] ---> for lib
inherits = "release"
opt-level = 'z'
lto = true
codegen-units = 1

// ssr/Cargo.toml
lib-profile-release = "wasm-release"

Why preview-release and prod-release?

  • because I want sentry source context in prod but not in preview since I don't want the added compile times

there is only 1 bin-profile-release so I can't use that

The cmd I am using:

cargo leptos build --lib-features release-lib --bin-features release-bin --bin-cargo-args="--profile=preview-release " --lib-cargo-args="--release"

Error (its looking for debug path since we haven't passed --release to cargo leptos. passing both --release and --profile will error the cmd):

Error: at `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-leptos-0.2.28/src/compile/front.rs:48:30`
[646](https://github.com/dolr-ai/hot-or-not-web-leptos-ssr/actions/runs/14579987456/job/40894368170#step:16:647)
[647](https://github.com/dolr-ai/hot-or-not-web-leptos-ssr/actions/runs/14579987456/job/40894368170#step:16:648)Caused by:
[648](https://github.com/dolr-ai/hot-or-not-web-leptos-ssr/actions/runs/14579987456/job/40894368170#step:16:649)    0: at `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-leptos-0.2.28/src/compile/front.rs:125:10`
[649](https://github.com/dolr-ai/hot-or-not-web-leptos-ssr/actions/runs/14579987456/job/40894368170#step:16:650)    1: failed reading 'target/front/wasm32-unknown-unknown/debug/hot_or_not_web_leptos_ssr.wasm'
[650](https://github.com/dolr-ai/hot-or-not-web-leptos-ssr/actions/runs/14579987456/job/40894368170#step:16:651)    2: No such file or directory (os error 2)

Also tried:

cargo leptos build --lib-features release-lib --bin-features release-bin --bin-cargo-args="--profile=preview-release"
ssr/Cargo.toml 
lib-profile-dev = "wasm-release" (to override above error)

Error (now the bin side fails trying to find at debug path):

       Cargo finished cargo build --package=hot-or-not-web-leptos-ssr --bin=hot-or-not-web-leptos-ssr --target=x86_64-unknown-linux-musl --no-default-features --features=release-bin --profile=preview-release
[1283](https://github.com/dolr-ai/hot-or-not-web-leptos-ssr/actions/runs/14581106212/job/40897805996#step:16:1284)Error: at `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-leptos-0.2.28/src/compile/server.rs:40:22`
[1284](https://github.com/dolr-ai/hot-or-not-web-leptos-ssr/actions/runs/14581106212/job/40897805996#step:16:1285)
[1285](https://github.com/dolr-ai/hot-or-not-web-leptos-ssr/actions/runs/14581106212/job/40897805996#step:16:1286)Caused by:
[1286](https://github.com/dolr-ai/hot-or-not-web-leptos-ssr/actions/runs/14581106212/job/40897805996#step:16:1287)    0: at `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-leptos-0.2.28/src/service/site.rs:117:44`
[1287](https://github.com/dolr-ai/hot-or-not-web-leptos-ssr/actions/runs/14581106212/job/40897805996#step:16:1288)    1: Could not read "target/x86_64-unknown-linux-musl/debug/hot-or-not-web-leptos-ssr" at `/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-leptos-0.2.28/src/ext/fs.rs:44:10`
[1288](https://github.com/dolr-ai/hot-or-not-web-leptos-ssr/actions/runs/14581106212/job/40897805996#step:16:1289)    2: No such file or directory (os error 2)
[1289](https://github.com/dolr-ai/hot-or-not-web-leptos-ssr/actions/runs/14581106212/job/40897805996#step:16:1290)Error: Process completed with exit code 1.

References :

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions