Skip to content

MSVC support for Servo, and CMake builds for native code#11756

Merged
bors-servo merged 12 commits intoservo:masterfrom
vvuk:servo-msvc
Aug 17, 2016
Merged

MSVC support for Servo, and CMake builds for native code#11756
bors-servo merged 12 commits intoservo:masterfrom
vvuk:servo-msvc

Conversation

@vvuk
Copy link
Copy Markdown
Contributor

@vvuk vvuk commented Jun 16, 2016

This is the base PR for MSVC builds of servo and dependent crates. It's got replacements in the Cargo.toml to pull in the right versions, to make sure that crates were properly converted to CMake for all other platforms, not just Windows. (Servo builds with MSVC 2015 with this PR; also with 2013, though a manual change in rust-mozjs to select a different set of bindings is needed.)

This PR isn't quite ready yet, but I want bors-servo to do builds.


This change is Reviewable

@highfive
Copy link
Copy Markdown

Heads up! This PR modifies the following files:

  • @wafflespeanut: python/servo/command_base.py
  • @KiChjang: components/script/dom/bindings/codegen/GlobalGen.py, components/script/dom/mod.rs, components/script/Cargo.toml, components/script/build.rs, components/script/CMakeLists.txt, components/script/dom/bindings/codegen/pythonpath.py, components/script/script_runtime.rs

@highfive
Copy link
Copy Markdown

warning Warning warning

  • These commits modify gfx and script code, but no tests are modified. Please consider adding a test!

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jun 16, 2016
@aneeshusa
Copy link
Copy Markdown
Contributor

@bors-servo try (by request)

@bors-servo
Copy link
Copy Markdown
Contributor

🔒 Merge conflict

@Ms2ger
Copy link
Copy Markdown
Contributor

Ms2ger commented Jun 16, 2016

Given that Gecko is dropping 2013, is there any point to us trying to?

@vvuk
Copy link
Copy Markdown
Contributor Author

vvuk commented Jun 16, 2016

@bors-servo try

@bors-servo
Copy link
Copy Markdown
Contributor

⌛ Trying commit d5c2e45 with merge e715025...

bors-servo pushed a commit that referenced this pull request Jun 16, 2016
MSVC support for Servo, and CMake builds for native code

This is the base PR for MSVC builds of servo and dependent crates.  It's got replacements in the Cargo.toml to pull in the right versions, to make sure that crates were properly converted to CMake for all other platforms, not just Windows.  (Servo builds with MSVC 2015 with this PR; also with 2013, though a manual change in rust-mozjs to select a different set of bindings is needed.)

This PR isn't quite ready yet, but I want bors-servo to do builds.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11756)
<!-- Reviewable:end -->
@vvuk vvuk self-assigned this Jun 16, 2016
@bors-servo
Copy link
Copy Markdown
Contributor

💔 Test failed - mac-dev-unit

@highfive highfive added the S-tests-failed The changes caused existing tests to fail. label Jun 16, 2016
@nox nox removed their assignment Jun 20, 2016
@bors-servo
Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #11785) made this pull request unmergeable. Please resolve the merge conflicts.

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Jun 20, 2016
@highfive highfive removed the S-tests-failed The changes caused existing tests to fail. label Jun 21, 2016
@vvuk vvuk force-pushed the servo-msvc branch 2 times, most recently from d421f99 to 7e5b33c Compare June 22, 2016 14:48
@vvuk
Copy link
Copy Markdown
Contributor Author

vvuk commented Jun 22, 2016

@metajack can we get ninja installed on the builders, or should I try to figure out the parallel make issue?

@vvuk vvuk force-pushed the servo-msvc branch 3 times, most recently from 68347ff to 3a5ae33 Compare July 14, 2016 20:05
@bors-servo
Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #12451) made this pull request unmergeable. Please resolve the merge conflicts.

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Jul 15, 2016
@metajack
Copy link
Copy Markdown
Collaborator

This is looking good. I had a few comments, but the main stuff left to do is:

  1. Land dependent PRs so that we can remove the [replace] section.
  2. Update the other Cargo.locks if needed

Reviewed 9 of 9 files at r1, 11 of 11 files at r2, 1 of 1 files at r3, 2 of 2 files at r4, 10 of 10 files at r5, 1 of 1 files at r6, 2 of 2 files at r7, 7 of 7 files at r8, 1 of 1 files at r9, 1 of 1 files at r10, 1 of 1 files at r11, 1 of 1 files at r12, 8 of 8 files at r13, 1 of 1 files at r14, 1 of 1 files at r15, 1 of 1 files at r16, 1 of 1 files at r17, 1 of 1 files at r18, 2 of 2 files at r19.
Review status: all files reviewed at latest revision, 5 unresolved discussions, some commit checks failed.


components/script/build.rs, line 11 [r10] (raw file):

    // parallelizes cmake's output properly.  (Cmake generates
    // separate makefiles, each of which try to build
    // ParserResults.pkl, and then stomp on eachother.)

I'm not sure what you mean by it generating separate makefiles. Which build generator did that? Nmake? You might mention that the VS generator serializes all custom commands, so they won't run in parallel even if it is successful. I seem to recall nmake had a similar behavior, but not 100% sure.


components/script/build.rs, line 20 [r11] (raw file):

    if target.contains("windows-msvc") {
        // because we're using ninja, we need to explicitly set these
        // to VC++, otherwise it'll try to use cc

I think we should use vcvars.bat to do this and check for the right stuff in mach. I don't remember needing to do any of this, but I was definitely running in cmd.exe shells that had run vcvars.bat


components/script/CMakeLists.txt, line 93 [r2] (raw file):

endforeach()

PREPEND(globalgen_out ${CMAKE_BINARY_DIR}/ ${globalgen_base_src})

Where were these going before? It's not clear why this bit is needed.


components/script/CMakeLists.txt, line 82 [r19] (raw file):

# below would cause GlobalGen.py to be executed each time.
add_custom_target(ParserResults ALL DEPENDS ParserResults.pkl)
add_custom_target(generate-bindings ALL)

Isn't this weird to have a target that has no dependencies?


components/servo/Cargo.toml, line 21 [r4] (raw file):

bench = false

[replace]

We'll need to remove this when it's ready to finally land.


Comments from Reviewable

@vvuk
Copy link
Copy Markdown
Contributor Author

vvuk commented Jul 19, 2016

Review status: all files reviewed at latest revision, 5 unresolved discussions, some commit checks failed.


components/script/build.rs, line 11 [r10] (raw file):

Previously, metajack (Jack Moffitt) wrote…

I'm not sure what you mean by it generating separate makefiles. Which build generator did that? Nmake? You might mention that the VS generator serializes all custom commands, so they won't run in parallel even if it is successful. I seem to recall nmake had a similar behavior, but not 100% sure.

I updated this comment to explain what was going on in the latest commit; but basically, if cmake has a custom command A for a target (RESULT), and that target depends on the output of another custom command B, it creates a rule that runs both B and A for RESULT.

So in our case, we had a command to generate ParserResults.pkl, and then each individual binding depended on ParserResults.pkl. Without an intermediate target, every binding target re-created ParserResults.pkl first -- which would often error out with a pickle error, as one command was trying to read it while something else was stomping on it.

This happened with makefiles, msbuild, or ninja. In a later commit once I figured out what was going on I fixed it, so in theory we could use any generator here, including msbuild... I kept it using ninja for msvc targets though.


components/script/build.rs, line 20 [r11] (raw file):

Previously, metajack (Jack Moffitt) wrote…

I think we should use vcvars.bat to do this and check for the right stuff in mach. I don't remember needing to do any of this, but I was definitely running in cmd.exe shells that had run vcvars.bat

The issue is that cmake makefiles/ninja/etc. will prefer cc/gcc before cl if it finds them -- so if you're running from a shell that has cc/gcc in the path at all, it won't choose cl. The msbuild cmake generator prefers cl.

components/script/CMakeLists.txt, line 93 [r2] (raw file):

Previously, metajack (Jack Moffitt) wrote…

Where were these going before? It's not clear why this bit is needed.

They're all being generated in the cmake build dir, script-.../out/build. We need them in script-.../out. For the Bindings/*, we have the install(DIRECTORY... ) command, but for these one-off files that are not in the Bindings dir, we have to manually prepend the "build/" bit.

components/script/CMakeLists.txt, line 82 [r19] (raw file):

Previously, metajack (Jack Moffitt) wrote…

Isn't this weird to have a target that has no dependencies?

It does -- we add dependencies to it in the foreach() loop below. But we have to create the target first before doing so.

Comments from Reviewable

@vvuk
Copy link
Copy Markdown
Contributor Author

vvuk commented Jul 19, 2016

Hmm, we'll need to bump version numbers on everything as well... I forgot to do that, I'll make more PRs.

@larsbergstrom
Copy link
Copy Markdown
Contributor

@bors-servo r+

@bors-servo
Copy link
Copy Markdown
Contributor

📌 Commit ae117c1 has been approved by larsbergstrom

@highfive highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Aug 17, 2016
@highfive highfive assigned larsbergstrom and unassigned vvuk Aug 17, 2016
@highfive highfive removed the S-needs-rebase There are merge conflict errors. label Aug 17, 2016
@bors-servo
Copy link
Copy Markdown
Contributor

⌛ Testing commit ae117c1 with merge ff970e4...

@highfive highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Aug 17, 2016
bors-servo pushed a commit that referenced this pull request Aug 17, 2016
MSVC support for Servo, and CMake builds for native code

This is the base PR for MSVC builds of servo and dependent crates.  It's got replacements in the Cargo.toml to pull in the right versions, to make sure that crates were properly converted to CMake for all other platforms, not just Windows.  (Servo builds with MSVC 2015 with this PR; also with 2013, though a manual change in rust-mozjs to select a different set of bindings is needed.)

This PR isn't quite ready yet, but I want bors-servo to do builds.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11756)
<!-- Reviewable:end -->
@bors-servo
Copy link
Copy Markdown
Contributor

💔 Test failed - linux-dev

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Aug 17, 2016
@larsbergstrom
Copy link
Copy Markdown
Contributor

Gah, looks like the CEF (and possibly geckolib?) Cargo.lock files are not updated:

error: failed to select a version for `expat-sys` (required by `servo-fontconfig-sys`):
all possible versions conflict with previously selected versions of `expat-sys`
  version 2.1.2 in use by expat-sys v2.1.2
  possible versions to select: 2.1.4

An easy way to "fix" this is to copy the components/servo/Cargo.lock over them and then do ./mach build-geckolib and ./mach build-cef to remove the extra bits.

Once @SimonSapin lands the removal of the [replace] for geckolib, I can land the move to cargo workspaces and we'll only have one Cargo.lock file.

@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-tests-failed The changes caused existing tests to fail. labels Aug 17, 2016
@larsbergstrom
Copy link
Copy Markdown
Contributor

@bors-servo r+

(the additional checksum blocks in geckolib seem spurious, but the builders will tell us if they're redundant via checking for a changed Cargo.lock file)

@bors-servo
Copy link
Copy Markdown
Contributor

📌 Commit dd37716 has been approved by larsbergstrom

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Aug 17, 2016
@bors-servo
Copy link
Copy Markdown
Contributor

⌛ Testing commit dd37716 with merge ec53136...

bors-servo pushed a commit that referenced this pull request Aug 17, 2016
MSVC support for Servo, and CMake builds for native code

This is the base PR for MSVC builds of servo and dependent crates.  It's got replacements in the Cargo.toml to pull in the right versions, to make sure that crates were properly converted to CMake for all other platforms, not just Windows.  (Servo builds with MSVC 2015 with this PR; also with 2013, though a manual change in rust-mozjs to select a different set of bindings is needed.)

This PR isn't quite ready yet, but I want bors-servo to do builds.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11756)
<!-- Reviewable:end -->
@bors-servo
Copy link
Copy Markdown
Contributor

☀️ Test successful - arm32, arm64, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt, windows-dev

@bors-servo bors-servo merged commit dd37716 into servo:master Aug 17, 2016
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Aug 17, 2016
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.

9 participants