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

Made building under Windows easier #133

Closed
wants to merge 4 commits into from

Conversation

asajeffrey
Copy link
Member

@asajeffrey asajeffrey commented Apr 24, 2018

Added some documentation on building under Windows, and allowed MOZTOOLS_PATH to contain multiple entries.


This change is Reviewable

README.md Outdated
"c:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
```

3. Set the `MOZTOOLS` environement variable to point to the tools from the Mozilla Build Package:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: MOZTOOLS_PATH and environment

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. Fixed.

Alan Jeffrey added 2 commits April 24, 2018 13:55
@KiChjang
Copy link

KiChjang commented Apr 25, 2018

Here's what I get following the instructions in this PR and building on your bindgen-in-build-rs branch:

--- stderr
configure: warning: Unknown version of the Microsoft (R) Manifest Tool.
Reticulating splines...
Finished reading 33 moz.build files in 0.33s
Processed into 130 build config descriptors in 0.16s
RecursiveMake backend executed in 0.72s
  114 total backend files; 114 created; 0 updated; 0 unchanged; 0 deleted; 4 -> 28 Makefile
Total wall time: 1.64s; CPU time: 1.64s; Efficiency: 100%; Untracked: 0.43s
Creating config.status
Microsoft (R) C/C++ Optimizing Compiler Version 19.12.25834 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

self-hosting-cpp-input.cpp
   Creating library mozjs-50a1.lib and object mozjs-50a1.exp
thread 'main' panicked at 'Unable to find libclang: "the `libclang` shared library at C:\\msys64\\mingw64\\bin\\clang.dll could not be opened: The specified module could not be found. (os error 126)"', src\libcore\result.rs:906:4
stack backtrace:
   0: std::sys_common::backtrace::_print
             at C:\projects\rust\src\libstd\sys_common\backtrace.rs:91
   1: std::panicking::default_hook::{{closure}}
             at C:\projects\rust\src\libstd\panicking.rs:380
   2: std::panicking::default_hook
             at C:\projects\rust\src\libstd\panicking.rs:397
   3: std::panicking::rust_panic_with_hook
             at C:\projects\rust\src\libstd\panicking.rs:577
   4: std::panicking::begin_panic<alloc::string::String>
             at C:\projects\rust\src\libstd\panicking.rs:538
   5: std::panicking::begin_panic_fmt
             at C:\projects\rust\src\libstd\panicking.rs:522
   6: std::panicking::rust_begin_panic
             at C:\projects\rust\src\libstd\panicking.rs:498
   7: core::panicking::panic_fmt
             at C:\projects\rust\src\libcore\panicking.rs:71
   8: core::result::unwrap_failed<alloc::string::String>
             at C:\projects\rust\src\libcore\macros.rs:23
   9: core::result::Result<(), alloc::string::String>::expect<(),alloc::string::String>
             at C:\projects\rust\src\libcore\result.rs:799
  10: core::ops::function::FnOnce::call_once<fn() -> alloc::arc::Arc<clang_sys::SharedLibrary>,()>
             at C:\projects\rust\src\libcore\ops\function.rs:223
  11: lazy_static::lazy::{{impl}}::get::{{closure}}<alloc::arc::Arc<clang_sys::SharedLibrary>,fn() -> alloc::arc::Arc<clang_sys::SharedLibrary>>
             at C:\Users\kungf\.cargo\registry\src\github.com-1ecc6299db9ec823\lazy_static-1.0.0\src\lazy.rs:24
  12: std::sync::once::{{impl}}::call_once::{{closure}}<closure>
             at C:\projects\rust\src\libstd\sync\once.rs:228
  13: std::sync::once::Once::call_inner
             at C:\projects\rust\src\libstd\sync\once.rs:341
  14: std::sync::once::Once::call_once<closure>
             at C:\projects\rust\src\libstd\sync\once.rs:228
  15: bindgen::ensure_libclang_is_loaded::{{impl}}::deref
             at .\<__lazy_static_internal macros>:9
  16: bindgen::ensure_libclang_is_loaded
             at C:\Users\kungf\.cargo\registry\src\github.com-1ecc6299db9ec823\bindgen-0.36.0\src\lib.rs:1491
  17: bindgen::Bindings::generate
             at C:\Users\kungf\.cargo\registry\src\github.com-1ecc6299db9ec823\bindgen-0.36.0\src\lib.rs:1506
  18: bindgen::Builder::generate
             at C:\Users\kungf\.cargo\registry\src\github.com-1ecc6299db9ec823\bindgen-0.36.0\src\lib.rs:1072
  19: build_script_build::build_jsapi_bindings
             at .\build.rs:135
  20: build_script_build::main
             at .\build.rs:14
  21: panic_unwind::__rust_maybe_catch_panic
             at C:\projects\rust\src\libpanic_unwind\lib.rs:101
  22: std::rt::lang_start
             at C:\projects\rust\src\libstd\rt.rs:51
  23: main
  24: __scrt_common_main_seh
             at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:283
  25: BaseThreadInitThunk

@asajeffrey
Copy link
Member Author

OK, I added a sentence about downloading LLVM. Sigh, "it works on my end".

Copy link

@KiChjang KiChjang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks all good from my end now after following your instructions!

@KiChjang
Copy link

Er... my build failed when I tried to enable debugmozjs. I'm not sure if that's a blocker for you, but here's the stderr after running cargo +nightly test --features debugmozjs:

--- stderr
configure: warning: Unknown version of the Microsoft (R) Manifest Tool.
Reticulating splines...
Finished reading 33 moz.build files in 0.06s
Processed into 130 build config descriptors in 0.14s
RecursiveMake backend executed in 0.61s
  114 total backend files; 114 created; 0 updated; 0 unchanged; 0 deleted; 4 -> 28 Makefile
Total wall time: 0.86s; CPU time: 0.86s; Efficiency: 100%; Untracked: 0.05s
Creating config.status
Microsoft (R) C/C++ Optimizing Compiler Version 19.12.25834 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

self-hosting-cpp-input.cpp
mozmake[4]: *** [d:/Workspace/mozjs/mozjs/config/rules.mk:936: Compression.obj] Error 2
mozmake[3]: *** [d:/Workspace/mozjs/mozjs/config/recurse.mk:71: mfbt/staticruntime/target] Error 2
mozmake[2]: *** [d:/Workspace/mozjs/mozjs/config/recurse.mk:33: compile] Error 2
mozmake[1]: *** [d:/Workspace/mozjs/mozjs/config/rules.mk:540: default] Error 2
mozmake: *** [makefile.cargo:136: all] Error 2
thread 'main' panicked at 'assertion failed: result.success()', build.rs:60:5
stack backtrace:
   0: std::sys::windows::backtrace::unwind_backtrace
             at C:\projects\rust\src\libstd\sys\windows\backtrace\mod.rs:65
   1: std::sys_common::backtrace::_print
             at C:\projects\rust\src\libstd\sys_common\backtrace.rs:71
   2: std::sys_common::backtrace::print
             at C:\projects\rust\src\libstd\sys_common\backtrace.rs:59
   3: std::panicking::default_hook::{{closure}}
             at C:\projects\rust\src\libstd\panicking.rs:205
   4: std::panicking::default_hook
             at C:\projects\rust\src\libstd\panicking.rs:221
   5: std::panicking::rust_panic_with_hook
             at C:\projects\rust\src\libstd\panicking.rs:457
   6: std::panicking::begin_panic<str*>
             at C:\projects\rust\src\libstd\panicking.rs:391
   7: build_script_build::build_jsapi
             at .\build.rs:60
   8: build_script_build::main
             at .\build.rs:13
   9: std::rt::lang_start::{{closure}}<()>
             at C:\projects\rust\src\libstd\rt.rs:74
  10: std::rt::lang_start_internal::{{closure}}
             at C:\projects\rust\src\libstd\rt.rs:59
  11: std::panicking::try::do_call<closure,i32>
             at C:\projects\rust\src\libstd\panicking.rs:304
  12: panic_unwind::__rust_maybe_catch_panic
             at C:\projects\rust\src\libpanic_unwind\lib.rs:105
  13: std::panicking::try
             at C:\projects\rust\src\libstd\panicking.rs:283
  14: std::panic::catch_unwind
             at C:\projects\rust\src\libstd\panic.rs:361
  15: std::rt::lang_start_internal
             at C:\projects\rust\src\libstd\rt.rs:58
  16: std::rt::lang_start<()>
             at C:\projects\rust\src\libstd\rt.rs:74
  17: main
  18: invoke_main
             at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  19: __scrt_common_main_seh
             at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:283
  20: BaseThreadInitThunk
  21: RtlUserThreadStart

@asajeffrey
Copy link
Member Author

Ah, I hadn't realized you were using this PR together with the bindgen-in-build-rs branch. Can you try again with just this PR? In particular, I don't think this PR requires LLVM, so I'd like to drop that from the README.

IRC conversation with @nox: https://mozilla.logbot.info/servo/20180426#c14671325

@KiChjang
Copy link

So, I've tried building your PR and removing the LIBCLANG_PATH environment variable, and it worked fine. However, cargo +nightly build --features debugmozjs still doesn't work for me, and the error that it gave ms is the same as the one above:

--- stderr
configure: warning: Unknown version of the Microsoft (R) Manifest Tool.
Reticulating splines...
Finished reading 33 moz.build files in 0.06s
Processed into 130 build config descriptors in 0.15s
RecursiveMake backend executed in 0.58s
  114 total backend files; 114 created; 0 updated; 0 unchanged; 0 deleted; 4 -> 28 Makefile
Total wall time: 0.84s; CPU time: 0.84s; Efficiency: 100%; Untracked: 0.05s
Creating config.status
Microsoft (R) C/C++ Optimizing Compiler Version 19.12.25834 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

self-hosting-cpp-input.cpp
mozmake[4]: *** [d:/Workspace/mozjs/mozjs/config/rules.mk:936: Compression.obj] Error 2
mozmake[3]: *** [d:/Workspace/mozjs/mozjs/config/recurse.mk:71: mfbt/staticruntime/target] Error 2
mozmake[2]: *** [d:/Workspace/mozjs/mozjs/config/recurse.mk:33: compile] Error 2
mozmake[1]: *** [d:/Workspace/mozjs/mozjs/config/rules.mk:540: default] Error 2
mozmake: *** [makefile.cargo:136: all] Error 2
thread 'main' panicked at 'assertion failed: result.success()', build.rs:52:5
stack backtrace:
   0: std::sys::windows::backtrace::unwind_backtrace
             at C:\projects\rust\src\libstd\sys\windows\backtrace\mod.rs:65
   1: std::sys_common::backtrace::_print
             at C:\projects\rust\src\libstd\sys_common\backtrace.rs:71
   2: std::sys_common::backtrace::print
             at C:\projects\rust\src\libstd\sys_common\backtrace.rs:59
   3: std::panicking::default_hook::{{closure}}
             at C:\projects\rust\src\libstd\panicking.rs:205
   4: std::panicking::default_hook
             at C:\projects\rust\src\libstd\panicking.rs:221
   5: std::panicking::rust_panic_with_hook
             at C:\projects\rust\src\libstd\panicking.rs:457
   6: std::panicking::begin_panic<str*>
             at C:\projects\rust\src\libstd\panicking.rs:391
   7: build_script_build::main
             at .\build.rs:52
   8: std::rt::lang_start::{{closure}}<()>
             at C:\projects\rust\src\libstd\rt.rs:74
   9: std::rt::lang_start_internal::{{closure}}
             at C:\projects\rust\src\libstd\rt.rs:59
  10: std::panicking::try::do_call<closure,i32>
             at C:\projects\rust\src\libstd\panicking.rs:304
  11: panic_unwind::__rust_maybe_catch_panic
             at C:\projects\rust\src\libpanic_unwind\lib.rs:105
  12: std::panicking::try
             at C:\projects\rust\src\libstd\panicking.rs:283
  13: std::panic::catch_unwind
             at C:\projects\rust\src\libstd\panic.rs:361
  14: std::rt::lang_start_internal
             at C:\projects\rust\src\libstd\rt.rs:58
  15: std::rt::lang_start<()>
             at C:\projects\rust\src\libstd\rt.rs:74
  16: main
  17: invoke_main
             at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  18: __scrt_common_main_seh
             at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:283
  19: BaseThreadInitThunk
  20: RtlUserThreadStart

@asajeffrey
Copy link
Member Author

Closing in favour of #134, since that has all the debugmozjs etc changes.

@asajeffrey asajeffrey closed this May 16, 2018
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 this pull request may close these issues.

None yet

2 participants