Skip to content

Add appveyor.yml for Windows-based CI - #9406

Closed
frewsxcv wants to merge 22 commits into
masterfrom
appveyor
Closed

frewsxcv wants to merge 22 commits into
masterfrom
appveyor

Conversation

@frewsxcv

Copy link
Copy Markdown
Contributor

Review on Reviewable

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jan 23, 2016
@frewsxcv

Copy link
Copy Markdown
Contributor Author

Not done, but definitely making progress. Will try to finish it up tomorrow

@frewsxcv

Copy link
Copy Markdown
Contributor Author

@larsbergstrom and @vvuk: I tried to get this working, but didn't make it very far. I realized I'm more unfamiliar with development on Windows than I thought. I intentionally pushed this branch to origin instead of a fork, so feel free to push directly to this branch if you want to try anything; I won't be adding anymore commits. If neither of you are interested and/or give up, feel free to close this.

@larsbergstrom

Copy link
Copy Markdown
Contributor

This error fatal error - cygheap base mismatch detected is a huge pain. It's because cygwin binaries were updated and are loaded in-memory, but the machine hasn't been rebooted after the update. There may be another way to "force" them to be fixed. I'll try to look into it - we can't be the only ones running into it on appveyor.

@larsbergstrom

Copy link
Copy Markdown
Contributor

Oh! We may be able to fudge this by making sure we have a PATH that puts all of the msys stuff first. I think it's the cygwin tools installed with the Git package that are breaking (which, in this case).

Or, if we can get the git tools installed without the "bash environment support", that would work, too.

@larsbergstrom larsbergstrom self-assigned this Jan 24, 2016
@frewsxcv frewsxcv mentioned this pull request Jan 27, 2016
@ghost

ghost commented Jan 27, 2016

Copy link
Copy Markdown

🎉
@frewsxcv can we hook VS2015 in the matrix too?

@ghost

ghost commented Jan 27, 2016

Copy link
Copy Markdown

Have a look at Installed Software, Python2.7 is already there: http://www.appveyor.com/docs/installed-software#python.

You can set environment variables in more YAML'ish way:

version: 1.0.{build}

platform:
  - x64

environment:
  MSYSTEM: MSYS 
  MSYS: winsymlinks=lnk
  CC: gcc

install:
  # If for some reason the installed mingw does not suffice, you can try this fast mirror
  - ps: |
      $file = "x86_64-4.9.2-release-win32-seh-rt_v4-rev3.7z"
      wget https://bintray.com/artifact/download/drewwells/generic/$file -OutFile $file
      &7z x -oC:\ $file > $null
  # downloaded and extracted at C:\mingw64\bin

  - SET PATH=\msys64\usr\bin\bash;C:\mingw64\bin;%PATH%
  - bash -lc "pacman --needed --noconfirm -Sy pacman-mirrors"
  - bash -lc "pacman --noconfirm -Sy"
  - bash -lc "pacman -Sy --noconfirm git mingw-w64-x86_64-toolchain mingw-w64-x86_64-freetype mingw-w64-x86_64-icu mingw-w64-x86_64-nspr mingw-w64-x86_64-ca-certificates mingw-w64-x86_64-expat mingw-w64-x86_64-cmake tar diffutils patch patchutils make python2-setuptools"
  - easy_install-2.7 pip virtualenv
  - bash -lc "mv /mingw64/bin/python2.exe /mingw64/bin/python2-mingw64.exe"
  - bash -lc "mv /mingw64/bin/python2.7.exe /mingw64/bin/python2.7-mingw64.exe"

For better performance, you can even cache the toolchain stack directories like this: https://github.com/sass/libsass/blob/master/appveyor.yml#L17-L19. See http://www.appveyor.com/docs/build-cache.

@vvuk

vvuk commented Jan 27, 2016

Copy link
Copy Markdown
Contributor

FWIW, the build won't work yet with the MSVC builds of Rust -- that's coming down the line.

@UK992

UK992 commented Feb 1, 2016

Copy link
Copy Markdown
Contributor

With today Appveyor update, cygwin problem gone.
So I've been playing with it, and somehow make it work, but failed at rust download, because is forbidden.
https://ci.appveyor.com/project/UK992/servo-hga0y/build/1.0.19
Tested PR: UK992#1

@vvuk

vvuk commented Feb 1, 2016

Copy link
Copy Markdown
Contributor

This is the problem:

C:\msys64\usr\bin\bash -lc "cd $APPVEYOR_BUILD_FOLDER; ./mach build -d --verbose"
...
Downloading Rust compiler...
Download failed (403): Forbidden - https://static-rust-lang-org.s3.amazonaws.com/dist/2015-12-27/rustc-nightly-x86_64-unknown.tar.gz

Note the "unknown"; that's not correct. It's not sufficient to run mach build using msys bash -- the ming64_shell script sets some variables, which is what mach uses to determine the build environment. Specifically, MSYSTEM must be set to MINGW64. This happens to be the only thing that it sets though, so perhaps just adding an 'export MSYSTEM=MINGW64' before running mach build would make it work.

@UK992

UK992 commented Feb 1, 2016

Copy link
Copy Markdown
Contributor

@vvuk Thanks, that worked, downloaded Rust successfully. But now failing at compiling on random crates.

Could not compile servo.

Caused by:
Could not execute process rustc build.rs --crate-name build_script_build --crate-type bin -g --cfg feature="default" --cfg feature="webdriver_server" --cfg feature="webdriver" --cfg feature="window" --cfg feature="glutin_app" --out-dir C:/projects/servo-hga0y/target\debug\build\servo-f21f0834a7b8fb16 --emit=dep-info,link -L dependency=C:/projects/servo-hga0y/target\debug -L dependency=C:/projects/servo-hga0y/target\debug\deps (never executed)

Caused by:
The handle is invalid. (os error 6)

https://ci.appveyor.com/project/UK992/servo-hga0y/history - builds 1.0.20 and above

@nox

nox commented Feb 1, 2016

Copy link
Copy Markdown
Contributor

@UK992 It looks like it is trying to download the compiler after starting to compile things, no?

@UK992

UK992 commented Feb 2, 2016

Copy link
Copy Markdown
Contributor

@nox yes, and don't know why.

@Ms2ger

Ms2ger commented Feb 2, 2016

Copy link
Copy Markdown
Contributor

@jasonwilliams200OK, please refrain from making unhelpful comments like that.

@ghost

ghost commented Feb 2, 2016

Copy link
Copy Markdown

@Ms2ger, I apologize. It's removed. :)
Let me know if i could help anyway. I have written some CI scripts in past and would love to contribute to servo project.

@larsbergstrom

Copy link
Copy Markdown
Contributor

@jasonwilliams200OK If you would like to work on this CI script, you can check out this branch locally (git checkout -b origin/appveyor) and then create any changes and open up a PR just like you normally would to servo, but with appveyor as the target.

Alternatively, if the GH API is getting in your way, please feel free to just dump fixes into comments here and one of us can push them into the scripts.

Thanks for offering to help out - we'd love all the help we can get!

@larsbergstrom

Copy link
Copy Markdown
Contributor

Interestingly, if I RDP in, while the runner reproduces that build error (The handle is invalid. (os error 6)), if I open up a Mingw-64 64bit shell window and do ./mach build -d --verbose, the build continues as normal. So, I suspect that there's something going wrong with the way we're setting up/running the mingw environment.

@larsbergstrom

Copy link
Copy Markdown
Contributor

That shortcut runs:

C:\Windows\System32\cmd.exe /A /Q /K C:\msys64\mingw64_shell.bat

That shell file is:

:
@echo off

rem ember value of GOTO: is used to know recursion has happened.
if "%1" == "GOTO:" goto %2

if NOT "x%WD%" == "x" set WD=

rem ember command.com only uses the first eight characters of the label.
goto _WindowsNT

start /min %COMSPEC% /e:4096 /c %0 GOTO: _Resume %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
goto EOF

rem ember that we execute here if we recursed.
:_Resume
for %%F in (1 2 3) do shift
if NOT EXIST %WD%msys-2.0.dll set WD=.\usr\bin\

rem ember that we get here even in command.com.
:_WindowsNT

if NOT EXIST %WD%msys-2.0.dll set WD=%~dp0usr\bin\

set MSYSTEM=MINGW64
rem To activate windows native symlinks uncomment next line
rem set MSYS=winsymlinks:nativestrict
rem Set debugging program for errors
rem set MSYS=error_start:%WD%../../mingw64/bin/qtcreator.exe^|-debug^|^<process-id^>
set MSYSCON=mintty.exe
if "x%1" == "x-consolez" set MSYSCON=console.exe
if "x%1" == "x-mintty" set MSYSCON=mintty.exe

if "x%MSYSCON%" == "xmintty.exe" goto startmintty
if "x%MSYSCON%" == "xconsole.exe" goto startconsolez

:startmintty
if NOT EXIST %WD%mintty.exe goto startsh
start %WD%mintty -i /msys2.ico /usr/bin/bash --login %*
exit

:startconsolez
cd %WD%..\lib\ConsoleZ
start console -t "MinGW" -r "%*"
exit

:startsh
start %WD%sh --login -i %*
exit

:EOF

@larsbergstrom

Copy link
Copy Markdown
Contributor

Looking at the difference in the environment between the console created when you start from cmd.exe and run bash as in the AppVeyor scripts and when you launch a mingw64 command prompt from the shell, there are:

  • The PATH in the mingw64 command prompt starts with /mingw64/bin. Otherwise, they are identical after that.
  • There is a MSYSCON env variable set in mingw64, with a value of mintty.exe

At a casual glance, everything else appears identical.

@larsbergstrom

Copy link
Copy Markdown
Contributor

Hrm, attempting to run the same commands as AppVeyor runs, but from a cmd.exe shell, I get:

C:\projects\servo>C:\msys64\usr\bin\bash -lc "cd /c/projects/servo; pwd; ./mach
bootstrap-rust"
/c/projects/servo
Downloading Rust compiler...
Download failed (403): Forbidden - https://static-rust-lang-org.s3.amazonaws.com
/dist/2016-01-31/rustc-nightly-x86_64-unknown.tar.gz

C:\projects\servo>

So I am guessing something's not quite right with that environment, either (it succeeds for AppVeyor, using pc-windows-gnu instead of unknown).

@vvuk

vvuk commented Feb 10, 2016

Copy link
Copy Markdown
Contributor

Again, the code that will generate "pc-windows-gnu" checks for $MSYSTEM == "MINGW64". That's the only thing that it checks and the only thing that will produce pc-windows-gnu as the host triple. If $MSYSTEM is not set, "unknown" will be produced and the download will fail. Try:

C:\msys64\usr\bin\bash -lc "cd /c/projects/servo; pwd; export MSYSTEM=MINGW64; ./mach bootstrap-rust"

@jdm

jdm commented Feb 26, 2016

Copy link
Copy Markdown
Member

Closing since this isn't actively being worked on. A new PR will be made when it's taken up again.

@frewsxcv

Copy link
Copy Markdown
Contributor Author

Tracking issue: #9767

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-review There is new code that needs to be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants