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

Windows compile script is broken #3001

Closed
kchodorow opened this issue May 12, 2017 · 9 comments
Closed

Windows compile script is broken #3001

kchodorow opened this issue May 12, 2017 · 9 comments
Assignees
Labels
breakage P1 I'll work on this now. (Assignee required) platform: windows

Comments

@kchodorow
Copy link
Contributor

It looks like it's stripping one of the /s?

+ /c/tools/msys64/usr/bin/bash -l -c 'cd /c/jenkins/workspace/Bazel/JAVA_VERSION/1.8/PLATFORM_NAME/windows-x86_64; source env.sh; exec ./scripts/ci/windows/compile_windows.sh'
.............
ERROR: not a valid absolute pattern (absolute target patterns must start with exactly two slashes): '/src:bazel'.

http://ci.bazel.io/view/Bazel%20bootstrap%20and%20maintenance/job/Bazel/JAVA_VERSION=1.8,PLATFORM_NAME=windows-x86_64/1497/console

@kchodorow kchodorow added breakage platform: windows P1 I'll work on this now. (Assignee required) labels May 12, 2017
@kchodorow
Copy link
Contributor Author

Ah, looks like this is the RC build, fwiw

@laszlocsomor
Copy link
Contributor

This is caused by MSYS's path translation heuristic. I changed the bootstrap bazel to be 0.5.0rc6-msvc so it is now a non-msys binary, so MSYS will translate its path-looking arguments, e.g.:

$ /c/work/app1/Debug/app1.exe --bazelrc=${BAZELRC:-/dev/null} --nomaster_bazelrc build //src:bazel //src:bazel_with_jdk
argc=6
argv[0]=(C:\work\app1\Debug\app1.exe)
argv[1]=(--bazelrc=nul)
argv[2]=(--nomaster_bazelrc)
argv[3]=(build)
argv[4]=(/src:bazel)
argv[5]=(/src:bazel_with_jdk)

But fortunately this can be turned of with MSYS2_ARG_CONV_EXCL="*" (http://stackoverflow.com/questions/7250130/how-to-stop-mingw-and-msys-from-mangling-path-names-given-at-the-command-line/34386471#34386471)

$ export MSYS2_ARG_CONV_EXCL="*"

$ /c/work/app1/Debug/app1.exe --bazelrc=${BAZELRC:-/dev/null} --nomaster_bazelrc build //src:bazel //src:bazel_with_jdk
argc=6
argv[0]=(C:\work\app1\Debug\app1.exe)
argv[1]=(--bazelrc=/dev/null)
argv[2]=(--nomaster_bazelrc)
argv[3]=(build)
argv[4]=(//src:bazel)
argv[5]=(//src:bazel_with_jdk)

@laszlocsomor
Copy link
Contributor

MSYS-ful binaries aren't affected by the MSYS2_ARG_CONV_EXCL envvar, so this is safe to add to our CI scripts.

@laszlocsomor
Copy link
Contributor

We may also be interested in MSYS2_ENV_CONV_EXCL.

And it turns out @gintas already asked the MSYS devs about this 2.5 years ago: msys2/MSYS2-packages#84

@laszlocsomor
Copy link
Contributor

In this comment: msys2/MSYS2-packages#84 (comment)
"Second, you can disable mangling some arguments with MSYS2_ARG_CONV_EXCL environment variable. This variable can contain semicolon separated list of arguments started with values that don't need to be converted." -- So all we need is MSYS2_ARG_CONV_EXCL="//"

@laszlocsomor
Copy link
Contributor

This was fixed by 866ecc8.

@improbablekeren
Copy link

I checked out bazel official example on window git clone https://github.com/bazelbuild/examples/ and got this issue when I built it:
bazel build //...

It's fixed with MSYS2_ARG_CONV_EXCL="//". Should this fix be a part of bazel build? my bazel version is 0.7.0

@laszlocsomor
Copy link
Contributor

@improbablekeren : Try running Bazel from cmd.exe, not from MSYS Bash.

This is an issue outside of Bazel's control: MSYS converts Unix-path-looking arguments to Windows paths, and its heuristic thinks "//..." is a Unix path. The workaround you found should disable this heuristic for this path.

@improbablekeren
Copy link

improbablekeren commented Nov 30, 2017

got it. very helpful, thanks. probably it would be great to mention it somewhere in the bazel example docs. it's really confusing for beginners.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breakage P1 I'll work on this now. (Assignee required) platform: windows
Projects
None yet
Development

No branches or pull requests

3 participants