Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wasm run command in build script freezes #1400

Open
CJBuchel opened this issue Jun 27, 2024 · 0 comments
Open

Wasm run command in build script freezes #1400

CJBuchel opened this issue Jun 27, 2024 · 0 comments

Comments

@CJBuchel
Copy link

🐛 Bug description

I'm unsure if this is officially supported or not, I see that the documentation is scarce for build scripts.
I was hoping to try use the wasm-pack crate as a build dependency and use it in the build script for some local automation.

I tried using the build options and commands to run the wasm build command like so.

let options = BuildOptions {
    path: Some(std::env::current_dir()?),
    scope: None,
    disable_dts: true,
    target: wasm_pack::command::build::Target::NoModules,
    debug: true,
    dev: true,
    out_dir: get_workspace_path()?.join("tms-client").join("web").join("pkg").to_string_lossy().to_string(),
    out_name: Some("rust_lib_my_app".to_string()),
    extra_options: vec![],
    ..Default::default()
  };

  let command = wasm_pack::command::Command::Build(options);
  wasm_pack::command::run_wasm_pack(command)?;

  Ok(())

But I came into an issue where the command would seemingly execute, but freeze waiting for the file lock on the build directory

     Running `CARGO=/home/cj/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo CARGO_CFG_OVERFLOW_CHECKS='' CARGO_CFG_PANIC=unwind CARGO_CFG_RELOCATION_MODEL=pic CARGO_CFG_TARGET_ABI='' CARGO_CFG_TARGET_ARCH=x86_64 CARGO_CFG_TARGET_ENDIAN=little CARGO_CFG_TARGET_ENV=gnu CARGO_CFG_TARGET_FAMILY=unix CARGO_CFG_TARGET_FEATURE=fxsr,sse,sse2 CARGO_CFG_TARGET_HAS_ATOMIC=16,32,64,8,ptr CARGO_CFG_TARGET_HAS_ATOMIC_EQUAL_ALIGNMENT=16,32,64,8,ptr CARGO_CFG_TARGET_HAS_ATOMIC_LOAD_STORE=16,32,64,8,ptr CARGO_CFG_TARGET_OS=linux CARGO_CFG_TARGET_POINTER_WIDTH=64 CARGO_CFG_TARGET_THREAD_LOCAL='' CARGO_CFG_TARGET_VENDOR=unknown CARGO_CFG_UB_CHECKS='' CARGO_CFG_UNIX='' CARGO_ENCODED_RUSTFLAGS='' CARGO_MANIFEST_DIR=/home/cj/Documents/code/TMS/tms-infra CARGO_PKG_AUTHORS='' CARGO_PKG_DESCRIPTION='' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE='' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=tms-infra CARGO_PKG_README='' CARGO_PKG_REPOSITORY='' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.1.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' DEBUG=true HOST=x86_64-unknown-linux-gnu LD_LIBRARY_PATH='/home/cj/Documents/code/TMS/target/debug/deps:/home/cj/Documents/code/TMS/target/debug:/home/cj/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib:/home/cj/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib:/home/cj/Documents/code/TMS/target/debug/build/bzip2-sys-683c5c1a62d34001/out/lib:/home/cj/Documents/code/TMS/target/debug/build/ring-b1483ee963101adc/out:/home/cj/Documents/code/TMS/target/debug/build/zstd-sys-cdfe71eec8a6e140/out' NUM_JOBS=20 OPT_LEVEL=0 OUT_DIR=/home/cj/Documents/code/TMS/target/debug/build/tms-infra-9c4e3f84f30cf6ab/out PROFILE=debug RUSTC=/home/cj/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc RUSTDOC=/home/cj/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustdoc TARGET=x86_64-unknown-linux-gnu /home/cj/Documents/code/TMS/target/debug/build/tms-infra-ad9ac73092db3bd4/build-script-build`
[tms-infra 0.1.0] cargo:rerun-if-changed=src
[tms-infra 0.1.0] Done!
[tms-infra 0.1.0] [INFO]: 🎯  Checking for the Wasm target...
[tms-infra 0.1.0] [INFO]: 🌀  Compiling to Wasm...
[tms-infra 0.1.0]     Blocking waiting for file lock on build directory
    Building [=======================> ] 312/314: tms-infra(build)    

And it seems to get stuck waiting for the file lock forever.

🤔 Expected Behavior

Build script generates the wasm outputs

👟 Steps to reproduce

  1. Create project with build script
  2. Add wasm-pack as build-dependency
  3. Use wasm-pack to compile the rust code

🌍 Your environment

Include the relevant details of your environment.
wasm-pack version: 0.12.1
rustc version: 1.79.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant