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

Unable to build on windows #88

Open
zacreid opened this issue Sep 22, 2022 · 7 comments · May be fixed by #136
Open

Unable to build on windows #88

zacreid opened this issue Sep 22, 2022 · 7 comments · May be fixed by #136

Comments

@zacreid
Copy link

zacreid commented Sep 22, 2022

Hi all,
Keep getting this error when trying to build for windows, I've been unable to figure out what files I'm missing. Any help is appreciated.

Compiling rquickjs-sys v0.1.7
error: failed to run custom build command for `rquickjs-sys v0.1.7`

Caused by:
  process didn't exit successfully: `C:\Users\Zac Reid\Documents\GitHub\surrealdb-test\target\debug\build\rquickjs-sys-136287e45d48a699\build-script-build` (exit code: 101)
  --- stdout
  cargo:rerun-if-changed=build.rs
  cargo:rerun-if-env-changed=CARGO_FEATURE_EXPORTS
  cargo:rerun-if-env-changed=CARGO_FEATURE_BINDGEN
  cargo:rerun-if-env-changed=CARGO_FEATURE_UPDATE_BINDINGS
  cargo:rerun-if-env-changed=CARGO_FEATURE_DUMP_BYTECODE
  cargo:rerun-if-env-changed=CARGO_FEATURE_DUMP_GC
  cargo:rerun-if-env-changed=CARGO_FEATURE_DUMP_GC_FREE
  cargo:rerun-if-env-changed=CARGO_FEATURE_DUMP_FREE
  cargo:rerun-if-env-changed=CARGO_FEATURE_DUMP_LEAKS
  cargo:rerun-if-env-changed=CARGO_FEATURE_DUMP_MEM
  cargo:rerun-if-env-changed=CARGO_FEATURE_DUMP_OBJECTS
  cargo:rerun-if-env-changed=CARGO_FEATURE_DUMP_ATOMS
  cargo:rerun-if-env-changed=CARGO_FEATURE_DUMP_SHAPES
  cargo:rerun-if-env-changed=CARGO_FEATURE_DUMP_MODULE_RESOLVE
  cargo:rerun-if-env-changed=CARGO_FEATURE_DUMP_PROMISE
  cargo:rerun-if-env-changed=CARGO_FEATURE_DUMP_READ_OBJECT

  --- stderr
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: NotFound, message: "program not found" }', C:\Users\Zac Reid\.cargo\registry\src\github.com-1ecc6299db9ec823\rquickjs-sys-0.1.7\build.rs:136:10
  stack backtrace:
     0: std::panicking::begin_panic_handler
               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library\std\src\panicking.rs:584
     1: core::panicking::panic_fmt
               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library\core\src\panicking.rs:142
     2: core::result::unwrap_failed
               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library\core\src\result.rs:1805
     3: enum$<core::result::Result<std::process::Child,std::io::error::Error> >::unwrap<std::process::Child,std::io::error::Error>
               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f\library\core\src\result.rs:1098
     4: build_script_build::patch<ref$<std::path::Path>,std::path::PathBuf>
               at .\build.rs:131
     5: build_script_build::main
               at .\build.rs:98
     6: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f\library\core\src\ops\function.rs:248
@powpingdone
Copy link
Contributor

You need to install patch. #87 clarifies this.

@Cody-Duncan
Copy link

Cody-Duncan commented Oct 11, 2022

I'd like to request that this dependency be called out in the README.md, along with a recommended source for installing patch.

Rationale: As a windows user this is an unfamiliar cli tool, so it took me some digging just to understand that patch was an executable.

If you want to be more cavalier, it should be possible to remove the dependency on patch by patching in the build script.
It looks like cargo patch command uses the patch crate to read .patch files and then applies the patch manually.
https://github.com/itmettkeDE/cargo-patch/blob/master/src/main.rs

@Cody-Duncan
Copy link

Cody-Duncan commented Oct 11, 2022

P.S. If patch fails execution, the build script doesn't catch it.
This is the build log when the patch installation was broken

  Appliyng patch patches\check_stack_overflow.patch
  Appliyng patch patches\infinity_handling.patch
  Appliyng patch patches\atomic_new_class_id.patch
  Appliyng patch patches\basic_msvc_compat.patch

In my case, I forgot to move a dependent dll into the directory with patch.exe. Running patch --help identified the problem.

patch.exe - System error:
The program can't start because msys-2.0.dll is missing from your computer.
Try reinstalling the program to fix this problem.

The build script went on to build the c files un-patched. Suspect it may not be checking whether patch succeeded or not.

...
libregexp.c(430): error C2143: syntax error: missing ')' before '('
libregexp.c(430): error C2091: function returns function
libregexp.c(430): error C2059: syntax error: 'constant'
libregexp.c(430): error C2059: syntax error: ')'
libregexp.c(430): error C2146: syntax error: missing ')' before identifier 're_parse_error'
libregexp.c(430): error C2061: syntax error: identifier 're_parse_error'
libregexp.c(430): error C2059: syntax error: ';'
libregexp.c(430): error C2059: syntax error: '<parameter-list>'
...

@GalaxyS7
Copy link

Don't forget for Rust to be able to execute patch.exe from anywhere you have to add the path to your "path" environment variable.

Btw: Git comes with a patch.exe in C:\Program Files\Git\usr\bin. I simply added this path to my "path" variable and it worked.

@joeyame
Copy link

joeyame commented Nov 5, 2022

This is an issue on Manjaro Linux too. Can cargo not search for and install this dependency? I've never had issues using any libraries until I decided to utilize a project that depends on this one.

@danielSanchezQ
Copy link

I am having troubles as well. With mingw. Missing a reference:

rquickjs-sys-e831da8d902e6506/out/quickjs.c:53894: undefined reference to `clock_gettime'

Tried adding the -lrt flag, but didn't worked:

[build]
rustflags = ["-C", "link-args=-lrt"]

@ehsanonline
Copy link

you can download patch from here http://gnuwin32.sourceforge.net/downlinks/patch-bin-zip.php

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

Successfully merging a pull request may close this issue.

7 participants