Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Windows support #10

Closed
alexeagle opened this issue Oct 9, 2017 · 14 comments
Closed

Windows support #10

alexeagle opened this issue Oct 9, 2017 · 14 comments
Assignees

Comments

@alexeagle
Copy link
Contributor

The whole example should work on Windows, verified by testing on CI.

@gregbown
Copy link

gregbown commented Oct 9, 2017

Hi Alex,
Just circling back on this so please excuse my post if it's just duplicating what is already documented.
I am still seeing the same two issues despite having updated to Bazel 0.6.1

The SASS rules are still broken. I don't think there is any movement on that repo. Still getting the same error for your example and my minimal test for sass rules

C:\Users\gbown\Documents\bazel-angular\angular-bazel-example>bazel build src
INFO: Found 1 target...
INFO: From Compiling external/libsass/src/sass2scss.cpp [for host]:
external/libsass/src/sass2scss.cpp(2): warning C4005: '_CRT_SECURE_NO_WARNINGS': macro redefinition
external/libsass/src/sass2scss.cpp(2): note: command-line arguments:  see previous definition of '_CRT_SECURE_NO_WARNINGS'
INFO: From Compiling external/libsass/src/file.cpp [for host]:
external/libsass/src/file.cpp(14): warning C4005: 'NOMINMAX': macro redefinition
external/libsass/src/file.cpp(14): note: command-line arguments:  see previous definition of 'NOMINMAX'
INFO: From Compiling external/libsass/src/json.cpp [for host]:
external/libsass/src/json.cpp(25): warning C4005: '_CRT_SECURE_NO_WARNINGS': macro redefinition
external/libsass/src/json.cpp(25): note: command-line arguments:  see previous definition of '_CRT_SECURE_NO_WARNINGS'
ERROR: C:/users/gbown/appdata/local/temp/_bazel_gbown/afpn2gxi/external/sassc/BUILD.bazel:4:1: C++ compilation of rule '@sassc//:sassc' failed (Exit 2).
external/sassc/sassc.c(10): fatal error C1083: Cannot open include file: 'getopt.h': No such file or directory
Target //src:src failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 26.508s, Critical Path: 10.29s

C:\Users\gbown\Documents\bazel-angular\angular-bazel-example>

Also, if I comment out all the SASS related Bazel stuff, I am still getting the same node rules error

Action failed to execute: java.io.IOException: CreateProcess(): %1 is not a valid Win32 application.

C:\Users\gbown\Documents\bazel-angular\angular-bazel-example>bazel build src
INFO: Found 1 target...
ERROR: C:/users/gbown/appdata/local/temp/_bazel_gbown/afpn2gxi/external/build_bazel_rules_typescript/internal/tsc_wrapped/BUILD.bazel:26:1: Compiling TypeScript (devmode) @build_
zel_rules_typescript//internal/tsc_wrapped:tsc_wrapped failed (Exit -1). Note: Remote connection/protocol failed with: execution failed.
Action failed to execute: java.io.IOException: CreateProcess(): %1 is not a valid Win32 application.

Target //src:src failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 2.875s, Critical Path: 0.39s

C:\Users\gbown\Documents\bazel-angular\angular-bazel-example>

@alexeagle
Copy link
Contributor Author

alexeagle commented Dec 7, 2017 via email

@ocombe
Copy link

ocombe commented Dec 22, 2017

The install works, but ibazel doesn't
And the script "buildifier" fails as well (because "EXPORT" doesn't exist on windows):

$ npm run buildifier

> [email protected] buildifier C:\www\angular-bazel-example
> bazel build @com_github_bazelbuild_buildtools//buildifier && find . -type f \( -name BUILD -or -name BUILD.bazel \) ! -path "./node_modules/*" | xargs $(bazel info bazel-bin)/external/com_github_bazelbuild_buildtools/buildifier/buildifier

DEBUG: C:/users/olivier/appdata/local/temp/_bazel_olivier/cg1g4de4/external/bazel_tools/tools/cpp/lib_cc_configure.bzl:37:3:
Auto-Configuration Warning: 'BAZEL_VC' is not set, start looking for the latest Visual C++ installed.
DEBUG: C:/users/olivier/appdata/local/temp/_bazel_olivier/cg1g4de4/external/bazel_tools/tools/cpp/lib_cc_configure.bzl:37:3:
Auto-Configuration Warning: Looking for VS%VERSION%COMNTOOLS environment variables,eg. VS140COMNTOOLS
DEBUG: C:/users/olivier/appdata/local/temp/_bazel_olivier/cg1g4de4/external/bazel_tools/tools/cpp/lib_cc_configure.bzl:37:3:
Auto-Configuration Warning: Visual C++ build tools found at C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\
INFO: Analysed target @com_github_bazelbuild_buildtools//buildifier:buildifier (0 packages loaded).
INFO: Found 1 target...
ERROR: C:/users/olivier/appdata/local/temp/_bazel_olivier/cg1g4de4/external/go_stdlib_windows_amd64_cgo/BUILD.bazel:4:1: error executing shell command: 'export GOROOT=$(pwd)/bazel-out/host/bin/external/go_stdlib_windows_amd64_cgo GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=$(pwd)/C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.ex...' failed (Exit 1)
/usr/bin/bash: -c: line 0: syntax error near unexpected token `('
/usr/bin/bash: -c: line 0: `export GOROOT=$(pwd)/bazel-out/host/bin/external/go_stdlib_windows_amd64_cgo GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=$(pwd)/C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe CXX=$(pwd)/C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe COMPILER_PATH=C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64 CGO_CPPFLAGS="/DCOMPILER_MSVC /DNOMINMAX /D_WIN32_WINNT=0x0600 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS /bigobj /Zm500 /J /Gy /GF /EHsc /wd4351 /wd4291 /wd4250 /wd4996" CGO_LDFLAGS="/MACHINE:X64" && mkdir -p bazel-out/host/bin/external/go_stdlib_windows_amd64_cgo/src && mkdir -p bazel-out/host/bin/external/go_stdlib_windows_amd64_cgo/pkg && cp external/go_sdk//bin/go bazel-out/host/bin/external/go_stdlib_windows_amd64_cgo/bin/go && cp -rf external/go_sdk//src/* bazel-out/host/bin/external/go_stdlib_windows_amd64_cgo/src/ && cp -rf external/go_sdk//pkg/tool bazel-out/host/bin/external/go_stdlib_windows_amd64_cgo/pkg/ && cp -rf external/go_sdk//pkg/include bazel-out/host/bin/external/go_stdlib_windows_amd64_cgo/pkg/ && bazel-out/host/bin/external/go_stdlib_windows_amd64_cgo/bin/go install  std && bazel-out/host/bin/external/go_stdlib_windows_amd64_cgo/bin/go install  runtime/cgo'
Target @com_github_bazelbuild_buildtools//buildifier:buildifier failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1,613s, Critical Path: 0,05s
FAILED: Build did NOT complete successfully
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] buildifier: `bazel build @com_github_bazelbuild_buildtools//buildifier && find . -type f \( -name BUILD -or -name BUILD.bazel \) ! -path "./node_modules/*" | xargs $(bazel info bazel-bin)/external/com_github_bazelbuild_buildtools/buildifier/buildifier`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] buildifier script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Olivier\AppData\Roaming\npm-cache\_logs\2017-12-22T10_30_17_327Z-debug.log

npm test fails as well:

λ npm test

> [email protected] pretest C:\www\angular-bazel-example
> bazel build test/...

DEBUG: C:/users/olivier/appdata/local/temp/_bazel_olivier/cg1g4de4/external/bazel_tools/tools/cpp/lib_cc_configure.bzl:37:3:
Auto-Configuration Warning: 'BAZEL_VC' is not set, start looking for the latest Visual C++ installed.
DEBUG: C:/users/olivier/appdata/local/temp/_bazel_olivier/cg1g4de4/external/bazel_tools/tools/cpp/lib_cc_configure.bzl:37:3:
Auto-Configuration Warning: Looking for VS%VERSION%COMNTOOLS environment variables,eg. VS140COMNTOOLS
DEBUG: C:/users/olivier/appdata/local/temp/_bazel_olivier/cg1g4de4/external/bazel_tools/tools/cpp/lib_cc_configure.bzl:37:3:
Auto-Configuration Warning: Visual C++ build tools found at C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\
ERROR: C:/www/angular-bazel-example/test/e2e/BUILD.bazel:3:1: every rule of type ts_library implicitly depends upon the target '@build_bazel_rules_typescript_deps//:node_modules', but this target could not be found because of: no such package '@build_bazel_rules_typescript_deps//': Traceback (most recent call last):
        File "C:/users/olivier/appdata/local/temp/_bazel_olivier/cg1g4de4/external/build_bazel_rules_nodejs/internal/npm_install.bzl", line 36
                repository_ctx.execute([repository_ctx.path(repository_...("")])
        File "C:/users/olivier/appdata/local/temp/_bazel_olivier/cg1g4de4/external/build_bazel_rules_nodejs/internal/npm_install.bzl", line 37, in repository_ctx.execute
                repository_ctx.path(repository_ctx.attr._npm)
Not a regular file: C:/users/olivier/appdata/local/temp/_bazel_olivier/cg1g4de4/external/nodejs/bin/npm
ERROR: Analysis of target '//test/e2e:e2e' failed; build aborted: no such package '@build_bazel_rules_typescript_deps//': Traceback (most recent call last):
        File "C:/users/olivier/appdata/local/temp/_bazel_olivier/cg1g4de4/external/build_bazel_rules_nodejs/internal/npm_install.bzl", line 36
                repository_ctx.execute([repository_ctx.path(repository_...("")])
        File "C:/users/olivier/appdata/local/temp/_bazel_olivier/cg1g4de4/external/build_bazel_rules_nodejs/internal/npm_install.bzl", line 37, in repository_ctx.execute
                repository_ctx.path(repository_ctx.attr._npm)
Not a regular file: C:/users/olivier/appdata/local/temp/_bazel_olivier/cg1g4de4/external/nodejs/bin/npm
INFO: Elapsed time: 0,908s
FAILED: Build did NOT complete successfully (2 packages loaded)
    currently loading:
npm ERR! Test failed.  See above for more details.

which seems to be the same error that @filipesilva has on bazelbuild/rules_typescript#56 (comment)

@alexeagle
Copy link
Contributor Author

@ocombe in general, it's not surprising that many things in the bazel ecosystem don't work on Windows. We need to file issues upstream, remind maintainers that it's important, and often we'll just have to contribute the fixes (and add the missing CI so it stays fixed)

@alexeagle
Copy link
Contributor Author

Seems we are blocked on support in rules_go as well...

@spongessuck
Copy link

I've had some luck setting up Bazel in WSL and building from there. It's really slow, though...

@alexeagle
Copy link
Contributor Author

Update: with some local changes, I'm able to build the @angular/core npm package with Bazel on Windows. For Angular v6 we've committed that at least the ng_package rule will work on windows.

@alexeagle
Copy link
Contributor Author

alexeagle commented Mar 2, 2018 via email

@domkrel
Copy link

domkrel commented May 18, 2018

any news on this issue?

@djleonskennedy
Copy link

djleonskennedy commented Jul 16, 2018

@domkrel @alexeagle this issue is "opened since the creation of the universe"

bazelbuild/bazel-watcher#105

they just don't care about windows support, so buy mac, or install linux, cause bazel-watcher for windows is dead :)

@alexeagle
Copy link
Contributor Author

Update: most things are working on Windows, still a couple details left before we can close this.

@alexeagle
Copy link
Contributor Author

Still to be fixed:

  • ts_devserver runs a Go program which needs to be runfiles MANIFEST aware
  • bazel-watcher has some issues still?

@ronnyek
Copy link

ronnyek commented Apr 2, 2019

bazel-watcher now has a release for windows, that at least works without throwing those errors (around not being built for appropriate architecture)

Now I'm getting errors about @io_bazel_rules_docker and I believe something similar for k8s. I don't know enough about how to just leave that stuff out of the build. I tried removing from WORKSPACE file and references in build.bazel, but still seeing something trying to reference those things

@alexeagle
Copy link
Contributor Author

Docker and k8s rules are used here, but are outside the scope of what we support from the Angular team. Could you file issue(s) with them?

I believe this example is now working on windows.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants