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

Adding Documentation for MSVC #13206

Closed
Coder206 opened this issue Sep 8, 2016 · 37 comments
Closed

Adding Documentation for MSVC #13206

Coder206 opened this issue Sep 8, 2016 · 37 comments

Comments

@Coder206
Copy link
Contributor

@Coder206 Coder206 commented Sep 8, 2016

In the light of #12916's completion, it's important to let the contributors know how to setup their Windows environments for Servo.

Files to modify: Anything with documentation (ie, README.md)

cc @larsbergstrom

@larsbergstrom
Copy link
Contributor

@larsbergstrom larsbergstrom commented Sep 8, 2016

Thanks! I'm trying this out right now, and here's what I've got for some initial steps. I've only tried it on one non-clean Virtual Machine so far, though...

Windows MSVC pre-setup

  • Install Git for Windows (https://git-scm.com/download/win)
    DO allow it to add git.exe to the PATH (default settings for the installer are fine)
  • Install Visual Studio 2015 Community Edition (https://www.visualstudio.com/)
    You MUST add "Visual C++" to the list of installed components. It is not on by default.
  • Install Python for Windows (https://www.python.org/downloads/release/python-2711/)
    The windows x86-64 MSI installer is fine.
    You should change the installation to install the "Add python.exe to Path" feature.
  • Install virtualenv
    In a normal Windows Shell (cmd.exe or "Command Prompt" from the start menu), do:
pip install virtualenv

If this does not work, you may need to reboot for the changed PATH settings to take effect.

Clone servo

  • Open a normal Windows shell (cmd.exe, or "Command Prompt" from the start menu)
  • Make a clone of Servo:
git clone https://github.com/servo/servo

Build servo

cd servo
mach.bat build -d
@Boddlnagg
Copy link

@Boddlnagg Boddlnagg commented Sep 9, 2016

I'm trying this right now, but it's failing to compile mozjs_sys:

error: failed to run custom build command for `mozjs_sys v0.0.0 (https://github.com/servo/mozjs#7cd66925)`
process didn't exit successfully: `D:\Code\servo\target\release\build\mozjs_sys-661d4efe7c7ca939\build-script-build` (ex
it code: 101)
--- stderr
makefile.cargo:98: *** recipe commences before first target.  Stop.
thread 'main' panicked at 'assertion failed: result.success()', D:\Code\servo\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2
d\master\build.rs:43
stack backtrace:
   0:     0x7ff7538547ea - std::rand::thread_rng::hf605c918a7eb7363
   1:     0x7ff753852f82 - std::rt::lang_start::haaae1186de9de8cb
   2:     0x7ff75385392d - std::panicking::rust_panic_with_hook::hb1322e5f2588b4db
   3:     0x7ff753841be3 - __ImageBase
   4:     0x7ff7538439c0 - __ImageBase
   5:     0x7ff7538572e1 - _rust_maybe_catch_panic
   6:     0x7ff7538529ba - std::rt::lang_start::haaae1186de9de8cb
   7:     0x7ff75385bfa8 - __scrt_common_main_seh
                        at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:253
   8:     0x7ffff0cf8363 - BaseThreadInitThunk

Edit: I've forgotten to mention that I'm doing a release build (mach.bat build -r), in case that matters.
Edit 2: Same result with mach.bat build -d

@retep998
Copy link

@retep998 retep998 commented Sep 9, 2016

Note that it is not enough to simply have python.exe in my PATH, I also had to make sure the scripts folder was in my PATH so I could run pip to install virtualenv and for mach to see virtualenv.

Also I am disappointed that there is no mach.ps.

@Boddlnagg
Copy link

@Boddlnagg Boddlnagg commented Sep 9, 2016

Selecting the "Add to PATH" option in the Python installer added both the Python installation's root directory and the scripts directory. I just needed to logoff and log in to Windows again for these changes to take effect.

@retep998
Copy link

@retep998 retep998 commented Sep 9, 2016

Finished debug [unoptimized + debuginfo] target(s) in 2395.9 secs

I guess it worked, sorta. Attempting to actually run the result...

Servo exited with return value -1073741515 which means STATUS_DLL_NOT_FOUND. I believe the missing dll is freetype.dll. Hmmm, might have actually been due to my .cargo/config which specifies a build script override for freetype so it would actually work normally, and it could be conflicting with servo's freetype.

@retep998
Copy link

@retep998 retep998 commented Sep 9, 2016

Okay, after commenting out my .cargo/config, servo now actually runs, and then is totally useless. Loading any page does get the title, but the page itself is totally blank.

Furthermore, it sits around eating up 2 CPU cores while doing absolutely nothing.

If I close servo, the process continues to run and starts eating up all my CPU cores.

@Coder206
Copy link
Contributor Author

@Coder206 Coder206 commented Sep 9, 2016

@retep998 You need to specify a URL.

@retep998
Copy link

@retep998 retep998 commented Sep 9, 2016

@Coder206 I did cmd /c mach.bat run -d http://www.purple.com. Is that not enough?

@Coder206
Copy link
Contributor Author

@Coder206 Coder206 commented Sep 9, 2016

@retep998 That should do it. I stand corrected mine is outputting like yours. Win 10 Anniversary?

@UK992
Copy link
Contributor

@UK992 UK992 commented Sep 9, 2016

@retep998 I suspect this is because of dummy font settings in gfx.

@retep998
Copy link

@retep998 retep998 commented Sep 9, 2016

OS Name:                   Microsoft Windows 10 Pro
OS Version:                10.0.10586 N/A Build 10586

AMD Radeon R9 380 with up to date drivers with full OpenGL 4.5 support.

@Coder206
Copy link
Contributor Author

@Coder206 Coder206 commented Sep 9, 2016

@retep998 Thanks, this seems to be a general Windows or perhaps just Windows 10 issue.

@Boddlnagg
Copy link

@Boddlnagg Boddlnagg commented Sep 9, 2016

By looking at makefile.cargo:98 in mosjs-sys I found the line

$(message You must either have the Native Win32 python installed in C:/python27, or set NATIVE_WIN32_PYTHON to point to the appropriate python.exe.)

which is unfortunately never shown when building, because it ends up in stdout instead of stderr, so it won't be forwarded by cargo.

Setting NATIVE_WIN32_PYTHON then actually fixed the issue 😃
Now I'm also at the point where running servo shows an empty white window with the correct title, but nothing else. I'm running Windows 10 Home.

@larsbergstrom
Copy link
Contributor

@larsbergstrom larsbergstrom commented Sep 9, 2016

Thanks, everybody! It looks like the instructions are correct (though need a fix for @Boddlnagg's issue, potentially) enough to put on the website.

That said, as @retep998 and @Coder206 have noticed and I can confirm, the MSVC build currently does not complete loading and is blank. We'll have to look into that :-)

@Coder206
Copy link
Contributor Author

@Coder206 Coder206 commented Sep 9, 2016

@larsbergstrom I think I had issues with storage space on my VM. What are your thoughts (or anyone's) about adding a recommended disk space?

@retep998
Copy link

@retep998 retep998 commented Sep 9, 2016

With regards to disk space... for a simple dev build, with no tests, and no release build, and not counting space taken up in the cargo cache...

So I'd say at least 10GB of free space.

@Coder206
Copy link
Contributor Author

@Coder206 Coder206 commented Sep 9, 2016

@retep998 Thanks for doing this. I think this is why I had issues compiling (ie compiling "script" failed).

@larsbergstrom
Copy link
Contributor

@larsbergstrom larsbergstrom commented Sep 9, 2016

Yeah, I think that a "low disk space warning" (as a separate issue) might be worthwhile. Right now, when we run out of space, the script build fails in a way that is both opaque and non-trivial to recover from - you typically have to do a clean build.

@Coder206
Copy link
Contributor Author

@Coder206 Coder206 commented Sep 11, 2016

@larsbergstrom Success on clean Windows 10 machine

@jasonwilliams
Copy link
Contributor

@jasonwilliams jasonwilliams commented Sep 12, 2016

You don't need Visual Studio.
You can get Visual C++ as stand alone from here:
http://landinghub.visualstudio.com/visual-cpp-build-tools
Using the default install option

@Coder206
Copy link
Contributor Author

@Coder206 Coder206 commented Sep 12, 2016

@Jayflux I like that much better, it saves lots of space

@jasonwilliams
Copy link
Contributor

@jasonwilliams jasonwilliams commented Sep 12, 2016

Build failing for me
https://pastebin.mozilla.org/8909561

OS Name Microsoft Windows 10 Pro
Version 10.0.10586 Build 10586
<vlad> Jayflux: you want https://github.com/vvuk/mozjs/commit/f9b707cbeb6ad653b8afb8e457b0b2d609ec66ef

When using Vlad's fork i get this
https://pastebin.mozilla.org/8909575

Testing on cmd

  Compiling miniz-sys v0.1.7
   Compiling unreachable v0.1.1
   Compiling ordered-float v0.2.3
   Compiling quickersort v2.1.0
   Compiling openssl v0.7.14
Build failed, waiting for other jobs to finish...
error: failed to run custom build command for `mozjs_sys v0.0.0 (https://github.com/servo/mozjs#87c47526)`
process didn't exit successfully: `C:\Users\Jason\workspace\servo\target\debug\build\mozjs_sys-661d4efe7c7ca939\build-script-build` (exit code: 101)
--- stdout
[[ /c/Users/Jason/workspace/servo/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/master/mozjs/js/src/configure -ot /c/Users/Jason/workspace/servo/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/master/mozjs/js/src/configure.in ]] && touch /c/Users/Jason/workspace/servo/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/master/mozjs/js/src/configure || true
[[ /c/Users/Jason/workspace/servo/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/master/mozjs/js/src/old-configure -ot /c/Users/Jason/workspace/servo/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/master/mozjs/js/src/old-configure.in ]] && touch /c/Users/Jason/workspace/servo/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/master/mozjs/js/src/old-configure || true
! [[ /c/Users/Jason/workspace/servo/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/master/mozjs/js/src/configure.in -ot /c/Users/Jason/workspace/servo/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/master/mozjs/js/src/configure ]] && touch /c/Users/Jason/workspace/servo/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/master/mozjs/js/src/configure || true
! [[ /c/Users/Jason/workspace/servo/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/master/mozjs/js/src/old-configure.in -ot /c/Users/Jason/workspace/servo/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/master/mozjs/js/src/old-configure ]] && touch /c/Users/Jason/workspace/servo/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/master/mozjs/js/src/old-configure || true
if [[ /c/Users/Jason/workspace/servo/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/master/mozjs/js/src/configure -nt C:\Users\Jason\workspace\servo\target\debug\build\mozjs_sys-661d4efe7c7ca939\out/config.status ]] ; then \
  cd C:\Users\Jason\workspace\servo\target\debug\build\mozjs_sys-661d4efe7c7ca939\out && \
  PYTHON="python" MOZ_TOOLS="" \
  CC="gcc" CPP="gcc -E" CXX="g++" AR="ar" \
  /c/Users/Jason/workspace/servo/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/master/mozjs/js/src/configure --disable-jemalloc --disable-js-shell --disable-tests --without-intl-api --build-backends=RecursiveMake --disable-shared-js || (cat config.log && exit 1) ; \
fi
makefile.cargo:120: recipe for target 'maybe-configure' failed

--- stderr
C:/Users/Jason/AppData/Local/Temp/make7000-5.sh: line 2: cd: C:UsersJasonworkspaceservotargetdebugbuildmozjs_sys-661d4efe7c7ca939out: No such file or directory
cat: config.log: No such file or directory
mozmake: *** [maybe-configure] Error 1
thread 'main' panicked at 'assertion failed: result.success()', C:\Users\Jason\workspace\servo\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\master\build.rs:43
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Build FAILED in 0:05:56
@larsbergstrom
Copy link
Contributor

@larsbergstrom larsbergstrom commented Sep 12, 2016

Can you do set PATH and paste the results in here? I'm worried that there is another, more evil, python that is first in your PATH. Mine looks like:

C:\Users\larsberg>set PATH
Path=C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\system32\config\systemprofile\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Git\cmd;C:\Program Files (x86)\WiX Toolset v3.10\bin
@jasonwilliams
Copy link
Contributor

@jasonwilliams jasonwilliams commented Sep 12, 2016

C:\Users\Jason\workspace\servo>set PATH
Path=C:\Program Files (x86)\MSBuild\14.0\bin\amd64;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Windows\Microsoft.NET\Framework64\;C:\Program Files (x86)\Windows Kits\10\bin\x64;C:\Program Files (x86)\Windows Kits\10\bin\x86;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\x64\;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Program Files\Oracle\VirtualBox;C:\Program Files\Sublime Text 3;C:\Program Files (x86)\Skype\Phone\;C:\HashiCorp\Vagrant\bin;C:\Program Files\Git\cmd;C:\Users\Jason\AppData\Roaming\npm;C:\Program Files (x86)\Nmap
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
@jasonwilliams
Copy link
Contributor

@jasonwilliams jasonwilliams commented Sep 12, 2016

NATIVE_WIN32_PYTHON hasn't worked for me

@aochagavia
Copy link
Contributor

@aochagavia aochagavia commented Sep 13, 2016

The instructions worked for me as well.

@Coder206 Is there an open issue for the problem of seeing a white screen instead of the contents of the website? I am experiencing the same problem on Windows 10 Educational (Version 10.0.10586) with an Intel HD Graphics 4000.

@Coder206
Copy link
Contributor Author

@Coder206 Coder206 commented Sep 13, 2016

@aochagavia No there is no issue for it

@aochagavia
Copy link
Contributor

@aochagavia aochagavia commented Sep 13, 2016

Should I create a new one?

@Coder206
Copy link
Contributor Author

@Coder206 Coder206 commented Sep 13, 2016

I would think it would be a good idea. Thanks for doing this @aochagavia!

@vvuk
Copy link
Contributor

@vvuk vvuk commented Sep 13, 2016

in mozjs makefile.cargo, there's a line: SRC_DIR = $(shell pwd) I wonder if for you, pwd is giving c:......, and for me, it's giving c:/....

For me %MOZTOOLS_PATH%\pwd gives /c/proj/r; but that's with a local MOZTOOLS_PATH. You should see whatever mach does to set up $PATH/$MOZTOOLS_PATH and what pwd it finds.

@jasonwilliams
Copy link
Contributor

@jasonwilliams jasonwilliams commented Sep 13, 2016

@vlad are there any steps to working out what pwd is giving me?
These commands don't run in the console

Do i need to set the moztools paths env variable?

@jasonwilliams
Copy link
Contributor

@jasonwilliams jasonwilliams commented Sep 14, 2016

@vvuk here are the results (my host machine, not VM)
cmder:

C:\Users\Jason\workspace\servo (master)
λ .servo\msvc-dependencies\moztools\bin\pwd.exe
/c/Users/Jason/workspace/servo

CMD

C:\Users\Jason\workspace\servo>.servo\msvc-dependencies\moztools\bin\pwd.exe
/c/Users/Jason/workspace/servo

C:\Users\Jason\workspace\servo>

Also...
Don't know if this helps, but i've noticed you've added a path to python here:
servo/mozjs@7ba7cfa#diff-9080a05d9a2f1078a5790475b50fdb37L96

However, my installation of python is:
C:\Python27 with an uppercase P

@jasonwilliams
Copy link
Contributor

@jasonwilliams jasonwilliams commented Sep 14, 2016

By looking at makefile.cargo:98 in mosjs-sys I found the line

$(message You must either have the Native Win32 python installed in C:/python27, or set NATIVE_WIN32_PYTHON to point to the appropriate python.exe.)
which is unfortunately never shown when building, because it ends up in stdout instead of stderr, so it won't be forwarded by cargo.

Setting NATIVE_WIN32_PYTHON then actually fixed the issue 😃
Now I'm also at the point where running servo shows an empty white window with the correct title, but nothing else. I'm running Windows 10 Home.

@Boddlnagg I did the same thing but its still failling for me 😭 😭
Looks like its hardcoded to c:\python27 which will fail for some, as its an uppercase P on installation (or at least for me it was)

@Boddlnagg
Copy link

@Boddlnagg Boddlnagg commented Sep 15, 2016

@Jayflux Did you set it to the path containing python.exe or actually to point to python.exe itself? It must be the latter.
And I don't know why the uppercase P should matter here, since (a) that is the default and (b) filenames should be case insensitive on Windows ...

@jasonwilliams
Copy link
Contributor

@jasonwilliams jasonwilliams commented Sep 15, 2016

@Boddlnagg i pointed directly to the python.exe itself and i still get the same error
Ok didn't know about the case insensitivity, good to know

@jasonwilliams
Copy link
Contributor

@jasonwilliams jasonwilliams commented Sep 15, 2016

So if #13272 is anything to go by.. Visual C++ build tools is giving different results to the full Visual Studio build

I'm going to try doing this again, uninstalling the Visual C++ build tools and instead using the Visual Studio full install, to see if that has anything to do with it

@jasonwilliams
Copy link
Contributor

@jasonwilliams jasonwilliams commented Sep 19, 2016

@larsbergstrom @vvuk
Turns out the issue was me using http://landinghub.visualstudio.com/visual-cpp-build-tools instead of installing Visual Studio.

I now get the white screen like everyone else

bors-servo added a commit that referenced this issue Oct 6, 2016
Instructions for building with the MSVC toolchain

<!-- Please describe your changes on the following line: -->
Adding instructions to build using the MSVC toolchain.

r? @vvuk

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x ] `./mach build -d` does not report any errors
- [x ] `./mach test-tidy` does not report any errors
- [x ] These changes fix #13206 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13621)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

9 participants
You can’t perform that action at this time.