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

Build failed with Could not apply patches when system does not offer patch binary #128

Open
darkyzhou opened this issue Sep 14, 2023 · 1 comment

Comments

@darkyzhou
Copy link

I got following errors when building my project with the library:

 > [builder 2/4] RUN cargo chef cook --release --recipe-path recipe.json:
174.2 Caused by:
174.2   process didn't exit successfully: `/app/target/release/build/libquickjs-sys-2900b94a2755abf1/build-script-build` (exit status: 101)
174.2   --- stderr
174.2   Applying patches...
174.2   Applying "stack-overflow-signed.patch"...
174.2   thread 'main' panicked at 'Could not apply patches: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/libquickjs-sys-0.9.0/build.rs:133:14
174.2   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
174.2 warning: build failed, waiting for other jobs to finish...
174.6 thread 'main' panicked at 'Exited with status code: 101', /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-chef-0.1.61/src/recipe.rs:189:27
174.6 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

And it turns out that build.rs relies on patch binary to patch the source codes of QuickJS, and the build image I am using(debian-slim) does not offer patch binary by default. So I have to install it first before compiling.

I suggest manually checking for the presence of the binary before actually calling it in the build.rs.

@koitsu
Copy link

koitsu commented Feb 17, 2024

Got bit by this today when trying to build mdbook-katex. Is there a reason you have to dynamically apply a diff during software build, rather than just having it pre-applied? Makes no sense to me why this is even being done to begin with.

error: failed to run custom build command for `libquickjs-sys v0.9.0`

Caused by:
  process didn't exit successfully: `/tmp/cargo-installjeiq4Y/release/build/libquickjs-sys-4694cd90dd302129/build-script-build` (exit status: 101)
  --- stderr
  Applying patches...
  Applying "js-tobigint64-overflow.patch"...
  thread 'main' panicked at /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/libquickjs-sys-0.9.0/build.rs:133:14:
  Could not apply patches: Os { code: 2, kind: NotFound, message: "No such file or directory" }
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to compile `mdbook-katex v0.5.10`, intermediate artifacts can be found at `/tmp/cargo-installjeiq4Y`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
     Summary Successfully installed mdbook, mdbook-admonish, mdbook-catppuccin, mdbook-embed! Failed to install mdbook-katex (see error(s) above).

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

2 participants