servo / rust-mozjs

DEPRECATED - moved to servo/mozjs instead.
Mozilla Public License 2.0
293 stars 122 forks source link

Error Building On Windows "The system cannot find the file specified" #359

Open robertlong opened 7 years ago

robertlong commented 7 years ago

Having trouble getting rust-mozjs to build on Windows 10. I'm not sure how to figure out what file can't be found.

λ cargo build --verbose
       Fresh num-traits v0.1.37
       Fresh log v0.3.7
       Fresh winapi-build v0.1.1
       Fresh libc v0.2.23
       Fresh winapi v0.2.8
       Fresh pkg-config v0.3.9
       Fresh gcc v0.3.46
       Fresh lazy_static v0.2.8
       Fresh cmake v0.1.23
       Fresh kernel32-sys v0.2.2
   Compiling heapsize v0.3.9
     Running `rustc --crate-name heapsize C:\Users\robertlong\.cargo\registry\src\github.com-1ecc6299db9ec823\heapsize-0.3.9\src\lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=a0ca106bb4f4bbb6 -C extra-filename=-a0ca106bb4f4bbb6 --out-dir C:\Users\robertlong\workspace\rust-mozjs\target\debug\deps -L dependency=C:\Users\robertlong\workspace\rust-mozjs\target\debug\deps --extern kernel32=C:\Users\robertlong\workspace\rust-mozjs\target\debug\deps\libkernel32-835ed4d4f4dc2d3e.rlib --cap-lints allow`
       Fresh libz-sys v1.0.13
   Compiling mozjs_sys v0.0.0 (https://github.com/servo/mozjs#834ce35c)
     Running `C:\Users\robertlong\workspace\rust-mozjs\target\debug\build\mozjs_sys-0ff46606e7250eff\build-script-build`
error: failed to run custom build command for `mozjs_sys v0.0.0 (https://github.com/servo/mozjs#834ce35c)`
process didn't exit successfully: `C:\Users\robertlong\workspace\rust-mozjs\target\debug\build\mozjs_sys-0ff46606e7250eff\build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 2, message: "The system cannot find the file specified." } }', src\libcore\result.rs:859
stack backtrace:
   0: std::sys_common::backtrace::_print
             at C:\projects\rust\src\libstd\sys_common\backtrace.rs:94
   1: std::panicking::default_hook::{{closure}}
             at C:\projects\rust\src\libstd\panicking.rs:354
   2: std::panicking::default_hook
             at C:\projects\rust\src\libstd\panicking.rs:371
   3: std::panicking::rust_panic_with_hook
             at C:\projects\rust\src\libstd\panicking.rs:549
   4: std::panicking::begin_panic<collections::string::String>
             at C:\projects\rust\src\libstd\panicking.rs:511
   5: std::panicking::begin_panic_fmt
             at C:\projects\rust\src\libstd\panicking.rs:495
   6: std::panicking::rust_begin_panic
             at C:\projects\rust\src\libstd\panicking.rs:471
   7: core::panicking::panic_fmt
             at C:\projects\rust\src\libcore\panicking.rs:69
   8: core::result::unwrap_failed<std::io::error::Error>
             at C:\projects\rust\src\libcore\macros.rs:29
   9: core::result::Result<std::process::ExitStatus, std::io::error::Error>::unwrap<std::process::ExitStatus,std::io::error::Error>
             at C:\projects\rust\src\libcore\result.rs:737
  10: build_script_build::main
             at ./build.rs:37
  11: panic_unwind::__rust_maybe_catch_panic
             at C:\projects\rust\src\libpanic_unwind\lib.rs:98
  12: std::rt::lang_start
             at C:\projects\rust\src\libstd\rt.rs:51
  13: main
  14: __scrt_common_main_seh
             at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:253
  15: BaseThreadInitThunk

Build failed, waiting for other jobs to finish...
error: build failed

Python 2.7 is installed and on the PATH

λ python -V
Python 2.7.11
jdm commented 7 years ago

You appear to be missing make: https://github.com/servo/mozjs/blob/master/build.rs#L37-L42

robertlong commented 7 years ago

Ahh, yeah I missed that line in the backtrace. Thanks!

I'm still having issues with make though:

C:\Users\robertlong\workspace\rust-mozjs (master)
λ cargo build
   Compiling mozjs_sys v0.0.0 (https://github.com/servo/mozjs#834ce35c)
error: failed to run custom build command for `mozjs_sys v0.0.0 (https://github.com/servo/mozjs#834ce35c)`
process didn't exit successfully: `C:\Users\robertlong\workspace\rust-mozjs\target\debug\build\mozjs_sys-0ff46606e7250eff\build-script-build` (exit code: 101)
--- stdout
[[ /c/Users/robertlong/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/834ce35/mozjs/js/src/configure -ot /c/Users/robertlong/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/834ce35/mozjs/js/src/configure.in ]] && touch /c/Users/robertlong/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/834ce35/mozjs/js/src/configure || true
[[ /c/Users/robertlong/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/834ce35/mozjs/js/src/old-configure -ot /c/Users/robertlong/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/834ce35/mozjs/js/src/old-configure.in ]] && touch /c/Users/robertlong/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/834ce35/mozjs/js/src/old-configure || true
! [[ /c/Users/robertlong/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/834ce35/mozjs/js/src/configure.in -ot /c/Users/robertlong/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/834ce35/mozjs/js/src/configure ]] && touch /c/Users/robertlong/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/834ce35/mozjs/js/src/configure || true
! [[ /c/Users/robertlong/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/834ce35/mozjs/js/src/old-configure.in -ot /c/Users/robertlong/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/834ce35/mozjs/js/src/old-configure ]] && touch /c/Users/robertlong/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/834ce35/mozjs/js/src/old-configure || true
if [[ /c/Users/robertlong/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/834ce35/mozjs/js/src/configure -nt C:\Users\robertlong\workspace\rust-mozjs\target\debug\build\mozjs_sys-2cecbe7697181d13\out/config.status ]] ; then \
          cd C:\Users\robertlong\workspace\rust-mozjs\target\debug\build\mozjs_sys-2cecbe7697181d13\out && \
          PYTHON="python" MOZ_TOOLS="" \
          CC="gcc" CPP="gcc -E" CXX="g++" AR="ar" \
          /c/Users/robertlong/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/834ce35/mozjs/js/src/configure --disable-jemalloc --disable-js-shell --disable-tests --build-backends=RecursiveMake --disable-shared-js || (cat config.log && exit 1) ; \
        fi

--- stderr
/usr/bin/sh: line 1: cd: C:Usersrobertlongworkspacerust-mozjstargetdebugbuildmozjs_sys-2cecbe7697181d13out: No such file or directory
cat: config.log: No such file or directory
make: *** [maybe-configure] Error 1
thread 'main' panicked at 'assertion failed: result.success()', C:\Users\robertlong\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\834ce35\build.rs:43
note: Run with `RUST_BACKTRACE=1` for a backtrace.

It looks like OUT_DIR might be wrong?

jdm commented 7 years ago

Plausible! We're not doing mingw builds in our automation any more, so it's plausible that it got broken at some point.

KiChjang commented 7 years ago

I'm hitting this issue as well. I thought we've since switched all our infrastructure to be using MSVC builds instead? How does mach even work in servo for MSVC builds?

DustinByfuglien commented 6 years ago

I'm give this error when try to compile libservo with rust-nightly. Is there a straightforward instruction about how to compile rust_mozjs?

Compiling mozjs_sys v0.50.0
     Running `E:\Progr\MyTestProject\CM_RUST\target\debug\build\mozjs_sys-4f17c22644d4b9d8\build-script-build`
error: failed to run custom build command for `mozjs_sys v0.50.0`
process didn't exit successfully: `E:\Progr\MyTestProject\CM_RUST\target\debug\build\mozjs_sys-4f17c22644d4b9d8\build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'Failed to run `make`: Error { repr: Os { code: 2, message: "Не удается найти указанный файл." } }', src\libcore\result.rs:916:4
jdm commented 6 years ago

@DustinByfuglien What if you run the build with RUST_BACKTRACE=1?

tasogare3710 commented 6 years ago

I succeeded in building mozjs_sys and mozjs with msvc, but needed some little environmental variable change and GunWin32's make.

The mozjs readme has the following, but ...


  1. Set the MOZTOOLS_PATH environment variable to point to the tools from the Mozilla Build Package:
C: \ mozilla - build \ msys \ bin; C: \ mozilla - build \ mozmake; C: \ mozilla - build \ yasm

I have changed this as follows.

set MOZTOOLS_PATH=C:\mozilla-build\msys\bin;C:\mozilla-build\bin\

Then install GnuWin32 and add <install_dir>\GnuWin32\bin to the environment variablePATH.

Finally, if you run cargo build according to the document, it succeeded in building.

It is necessary to execute vcvars64.bat etc. first.