bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
22.95k stars 4.02k forks source link

--workspace_status_command option doesn't work on Windows #2040

Closed davido closed 7 years ago

davido commented 7 years ago

With Bazel 0.3.2, on Windows, it's failing to compile this particular target:

https://github.com/GerritCodeReview/gerrit/blob/master/gerrit-patch-jgit/BUILD#L27-L37

With this outcome:

davido@DESKTOP-VDNCUPU MSYS ~/projects/gerrit
$ bazel build gerrit-patch-jgit:edit.srcjar --verbose_failures --subcommands
WARNING: C:/tools/msys64/var/tmp/Bazel/Vne9nLyn/external/bazel_tools/tools/cpp/cc_configure.bzl:57:3:
Auto-Configuration Warning: 'BAZEL_VS' is not set, start looking for the latest Visual Studio installed.
.
WARNING: C:/tools/msys64/var/tmp/Bazel/Vne9nLyn/external/bazel_tools/tools/cpp/cc_configure.bzl:57:3:
Auto-Configuration Warning: Visual Studio found at C:\Program Files (x86)/Microsoft Visual Studio 15.0
.
INFO: Found 1 target...
>>>>> # //gerrit-patch-jgit:jgit_edit_src [action 'Executing genrule //gerrit-patch-jgit:jgit_edit_src']
cd C:/tools/msys64/var/tmp/Bazel/Vne9nLyn/execroot/gerrit
  SET PATH=C:\tools\msys64\usr\local\bin;C:\tools\msys64\usr\bin;C:\tools\msys64\usr\bin;C:\tools\msys64\opt\bin;C:\Windows\System32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ProgramData\chocolatey\bin;C:\ProgramData\chocolatey\bin;C:\tools\python2;C:\ProgramData\chocolatey\bin;C:\tools\python2;C:\ProgramData\chocolatey\bin;C:\tools\python2;C:\ProgramData\chocolatey\bin;C:\tools\python2;C:\ProgramData\chocolatey\bin;C:\tools\python2;C:\ProgramData\chocolatey\bin;C:\tools\python2;C:\ProgramData\chocolatey\bin;C:\tools\python2
  C:/tools/msys64/usr/bin/bash.exe -c source external/bazel_tools/tools/genrule/genrule-setup.sh; ROOT=$PWD && TMP=$(mktemp -d || mktemp -d -t bazel-tmp) && (unzip -qd $TMP external/jgit_src/file/org.eclipse.jgit-4.5.0.201609210915-r-sources.jar org/eclipse/jgit/diff/Edit.java && cd $TMP && zip -Dq $ROOT/bazel-out/local-fastbuild/genfiles/gerrit-patch-jgit/edit.srcjar org/eclipse/jgit/diff/Edit.java)
ERROR: Process exited with status 1.
ERROR: C:/tools/msys64/home/davido/projects/gerrit/gerrit-patch-jgit/BUILD:27:1: declared output 'gerrit-patch-jgit/edit.srcjar' was not created by genrule. This is probably because the genrule actually didn't create this output, or because the output was a directory and the genrule was run remotely (note that only the contents of declared file outputs are copied from genrules run remotely).
Target //gerrit-patch-jgit:edit.srcjar failed to build
INFO: Elapsed time: 1,032s, Critical Path: 0,04s

It seems that there is an issue with creating output artifacts here, e.g. here is similar failure for different target [1].

Environment: Bazel 0.3.2, bundled install with Chocolatey.

[1] http://paste.openstack.org/show/587839/

laszlocsomor commented 7 years ago

I can repro this even with bazel built off HEAD:

$ cat WORKSPACE
http_file(
  name = "blah",
  # blah.jar is a copy of the jar in @jgit_src
  url = "http://localhost:8765/blah.jar",
  sha256 = "426bf32d097a846a247d5fb1d258fcde1707dec3362b8a62c68785b953c2ae65",
)

$ bazel --batch build @blah//file --verbose_failures
...
INFO: Found 1 target...
ERROR: Process exited with status 1.
Target @blah//file:file up-to-date (nothing to build)

...but only in the gerrit repo. If I create a new dummy repo, everything works fine.

davido commented 7 years ago

So, can it be, that it's something related to .bazelrc?

build --workspace_status_command=./tools/workspace-status.sh --strategy=Javac=worker

Ans particularly to ./tools/workspace-status.sh?

There is another pending fix for that:

https://gerrit-review.googlesource.com/90834

laszlocsomor commented 7 years ago

Good catch, that's in fact the culprit. :)

$ pwd
/c/work/gitroot/gerrit

$ bazel --bazelrc=/dev/null --batch build @blah//file --verbose_failures
...
INFO: Found 1 target...
Target @blah//file:file up-to-date (nothing to build)
INFO: Elapsed time: 12.697s, Critical Path: 0.02s
davido commented 7 years ago

That was just WAG ;-)

Actually this raises the question why failure in workspace command so bad tracked down. Particularly I would expect, that --verbose_failures and --subcommands command arguments are reflected...

laszlocsomor commented 7 years ago

Agreed, this is a UX failure on our side.

@aehlig , can we print a more helpful error message if the --workspace_status_command fails than "Process exited with status 1"?

davido commented 7 years ago

@laszlocsomor @aehlig not sure if I should open another issue for the actual culprit?

It seems that mentioning in .bazelrc:

build --workspace_status_command=./tools/workspace-status.sh

doesn't seem to have any effect on Windows (or it's failing to execute, with unkown reason). Consider this content of tools/workspace-status.sh:

$ cat tools/workspace-status.sh
#!/bin/bash

# This script will be run by bazel when the build process starts to
# generate key-value information that represents the status of the
# workspace. The output should be like
#
# KEY1 VALUE1
# KEY2 VALUE2
#
# If the script exits with non-zero code, it's considered as a failure
# and the output will be discarded.

echo STABLE_BUILD_GERRIT_LABEL $(git describe --always --match "v[0-9].*" --dirty)

When invoked as standalone script it works as expected:

$ ./tools/workspace-status.sh
STABLE_BUILD_GERRIT_LABEL v2.13.2-1378-g99ab2a6-dirty

Now, consider this rule in BUILD file:

genrule(
  name = 'gen_version',
  stamp = 1,
  cmd = ("cat bazel-out/stable-status.txt | " +
    "grep STABLE_BUILD_GERRIT_LABEL | cut -d ' ' -f 2 > $@"),
  outs = ['version.txt'],
  visibility = ['//visibility:public'],
)

If I run it manually, all is fine:

$ ./tools/workspace-status.sh > bazel-out/stable-status.txt
$ cat bazel-out/stable-status.txt | grep STABLE_BUILD_GERRIT_LABEL | cut -d ' ' -f 2
v2.13.2-1378-g99ab2a6-dirty

When, however I'm running the mentioned :gen_version rule, workspace status is not generated, and as consequence the command is failing:

$ /home/davido/projects/bazel/bazel-bin/src/bazel build :gen_version --verbose_failures --subcommands
WARNING: C:/tools/msys64/var/tmp/Bazel/Vne9nLyn/external/bazel_tools/tools/cpp/cc_configure.bzl:57:3:
Auto-Configuration Warning: 'BAZEL_VS' is not set, start looking for the latest Visual Studio installed.
.
WARNING: C:/tools/msys64/var/tmp/Bazel/Vne9nLyn/external/bazel_tools/tools/cpp/cc_configure.bzl:57:3:
Auto-Configuration Warning: Visual Studio found at C:\Program Files (x86)/Microsoft Visual Studio 15.0
.
INFO: Found 1 target...
ERROR: Process exited with status 1.
Target //:gen_version failed to build
INFO: Elapsed time: 1,858s, Critical Path: 0,03s

davido@DESKTOP-VDNCUPU MSYS ~/projects/gerrit
$ cat bazel-out/stable-status.txt
cat: bazel-out/stable-status.txt: No such file or directory

Bazel version: most recent master, compiled from source.

davido@DESKTOP-VDNCUPU MSYS ~/projects/bazel
$ git describe --always --match "v[0-9].*" --dirty
fa407e5
laszlocsomor commented 7 years ago

Shot in the dark: bazel executes the workspace status command in a subprocess through CreateProcess and a shell script is not a Windows binary? (EDIT: let me check)

davido commented 7 years ago

Shot in the dark: bazel executes the workspace status command in a subprocess through CreateProcess and a shell script is not a Windows binary? (EDIT: let me check)

Sounds reasonable, and the question is, to fix that we would need some native support for this scenario?

laszlocsomor commented 7 years ago

Apparently --workspace_status_command doesn't work at all on Windows out of the box. But nor does it on Linux!

Windows:

$ cat ws.sh
#!/bin/bash
echo BINARY bash

$ cat ws.cmd
@echo BINARY cmd

$ bazel build :stamp.txt && cat bazel-genfiles/stamp.txt
...
BUILD_EMBED_LABEL
BUILD_HOST <redacted>
BUILD_USER laszlocsomor
BUILD_TIMESTAMP 1478512278617

$ bazel build --workspace_status_command=true :stamp.txt && cat bazel-genfiles/stamp.txt
...
FAILED: Build did NOT complete successfully

$ bazel build --workspace_status_command=$(pwd)/ws.sh :stamp.txt && cat bazel-genfiles/stamp.txt
...
FAILED: Build did NOT complete successfully

$ bazel build --workspace_status_command=$(pwd)/ws.cmd :stamp.txt && cat bazel-genfiles/stamp.txt
...
FAILED: Build did NOT complete successfully

And on Linux:

$ cat ws.sh
#!/bin/bash
echo BINARY bash

$ bazel build --workspace_status_command=true :stamp.txt >&/dev/null && cat bazel-genfiles/stamp.txt
BUILD_EMBED_LABEL 
BUILD_HOST <redacted>
BUILD_USER laszlocsomor
BUILD_TIMESTAMP 1478513229508

$ bazel build --workspace_status_command=$(pwd)/ws.sh :stamp.txt >&/dev/null && cat bazel-genfiles/stamp.txt
BUILD_EMBED_LABEL 
BUILD_HOST <redacted>
BUILD_USER laszlocsomor
BUILD_TIMESTAMP 1478513229508
laszlocsomor commented 7 years ago

My genrule:

$ cat BUILD 
genrule(
    name = "stamp",
    outs = ["stamp.txt"],
    cmd = "( cat bazel-out/stable-status.txt ; echo ; cat bazel-out/volatile-status.txt ; ) > $@",
    stamp = 1,
)
davido commented 7 years ago

Buck's genrule provide some kind support for platform diversity by exposing these attributes:

See also this issue: https://github.com/facebook/buck/issues/267 for more context.

ulfjack commented 7 years ago

Laszlo, do you need to add --stamp to the bazel command line?

ajaysaini-sgvu commented 7 years ago

I am facing the same problem. Is there any way to resolve this ?

bazel build -c opt //tensorflow/contrib/android:libtensorflow_inference.so --crosstool_top=//external:android/crosstool --host_crosstool_top=@bazel_tools//tools/cpp:toolchain --cpu=armeabi-v7a WARNING: The major revision of the Android NDK referenced by android_ndk_repository rule 'androidndk' is 15. The major revisions supported by Bazel are [10, 11, 12, 13, 14]. Defaulting to revision 14.. WARNING: C:/users/ajaysaini/appdata/local/temp/_bazel_ajaysaini/aeorbm85/external/bazel_tools/tools/cpp/cc_configure.bzl:67:3: Auto-Configuration Warning: 'BAZEL_VC' is not set, start looking for the latest Visual C++ installed. . WARNING: C:/users/ajaysaini/appdata/local/temp/_bazel_ajaysaini/aeorbm85/external/bazel_tools/tools/cpp/cc_configure.bzl:67:3: Auto-Configuration Warning: Looking for VS%VERSION%COMNTOOLS environment variables,eg. VS140COMNTOOLS . WARNING: C:/users/ajaysaini/appdata/local/temp/_bazel_ajaysaini/aeorbm85/external/bazel_tools/tools/cpp/cc_configure.bzl:67:3: Auto-Configuration Warning: Looking for Visual C++ through registry . ERROR: in target '//external:cc_toolchain': no such package '@local_config_cc//': Traceback (most recent call last): File "C:/users/ajaysaini/appdata/local/temp/_bazel_ajaysaini/aeorbm85/external/bazel_tools/tools/cpp/cc_configure.bzl", line 762 _find_vc_path(repository_ctx) File "C:/users/ajaysaini/appdata/local/temp/_bazel_ajaysaini/aeorbm85/external/bazel_tools/tools/cpp/cc_configure.bzl", line 539, in _find_vc_path auto_configure_fail("Visual C++ build tools not foun...") File "C:/users/ajaysaini/appdata/local/temp/_bazel_ajaysaini/aeorbm85/external/bazel_tools/tools/cpp/cc_configure.bzl", line 60, in auto_configure_fail fail("\n%sAuto-Configuration Error:%s...))

Auto-Configuration Error: Visual C++ build tools not found on your machine. . ____Elapsed time: 6.290s

laszlocsomor commented 7 years ago

@ajaysaini-sgvu : You just closed a similar bug (https://github.com/bazelbuild/bazel/issues/3221) an hour ago, does your comment here refer to the same problem, and is it resolved now?

ajaysaini-sgvu commented 7 years ago

@laszlocsomor Nope. It was different issue, problem was with my network so had some interruption while downloading Bazel.

ajaysaini-sgvu commented 7 years ago

@laszlocsomor I have added error logs, may help you to look what went wrong.

laszlocsomor commented 7 years ago

Thanks! Do you have Visual Studio (with Visual C++) installed? Under which path? Also, if you open cmd.exe, what's the output of set VS?

ajaysaini-sgvu commented 7 years ago

@laszlocsomor I installed Visual Studio , it prints Environment variable VS not defined on set VS

laszlocsomor commented 7 years ago

Which version did you install exactly?

If for example it's Visual Studio 2015, you'd have the VS140COMNTOOLS envvar set, e.g.:

VS140COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\

When you install VS, it usually adds these envvars to your environment. Bazel is looking for VSversionCOMNTOOLS envvars to find where VS is installed and which version is it. Your build is failing because Bazel cannot find these.

To fix it, you can set the BAZEL_VS environment variable to point to the VS installation location, e.g.:

set BAZEL_VS=C:\Program Files (x86)\Microsoft Visual Studio 14.0

(See https://bazel.build/versions/master/docs/windows.html#build-c)

ajaysaini-sgvu commented 7 years ago

Well @laszlocsomor . I am not sure why my cmd prompt : Permission denied even though I run it as administrator.

ajaysaini@AJAY3145984 D:\tensorflow $ bazel build -c opt //tensorflow/contrib/android:libtensorflow_inference.so --crosstool_top=//external:android/crosstool --host_crosstool_top=@bazel_tools//tools/cpp:toolchain --cpu=armeabi-v7a WARNING: The major revision of the Android NDK referenced by android_ndk_repository rule 'androidndk' is 15. The major revisions supported by Bazel are [10, 11, 12, 13, 14]. Defaulting to revision 14.. Loading complete. Analyzing... Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/v3.3.1.tar.gz: 115,187 bytes Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/v3.3.1.tar.gz: 479,327 bytes Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/v3.3.1.tar.gz: 1,479,139 bytes Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/v3.3.1.tar.gz: 1,513,159 bytes Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/v3.3.1.tar.gz: 1,537,727 bytes Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/v3.3.1.tar.gz: 1,590,647 bytes Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/v3.3.1.tar.gz: 1,622,147 bytes Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/v3.3.1.tar.gz: 1,670,027 bytes Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/v3.3.1.tar.gz: 1,715,387 bytes Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/v3.3.1.tar.gz: 1,768,171 bytes Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/v3.3.1.tar.gz: 1,823,747 bytes Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/v3.3.1.tar.gz: 1,881,707 bytes Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/v3.3.1.tar.gz: 1,952,267 bytes Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/v3.3.1.tar.gz: 2,019,047 bytes Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/v3.3.1.tar.gz: 2,094,647 bytes Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/v3.3.1.tar.gz: 2,176,547 bytes Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/v3.3.1.tar.gz: 2,263,487 bytes Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/v3.3.1.tar.gz: 2,355,467 bytes Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/v3.3.1.tar.gz: 2,443,667 bytes Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/v3.3.1.tar.gz: 2,545,727 bytes Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/v3.3.1.tar.gz: 2,612,507 bytes Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/v3.3.1.tar.gz: 2,735,987 bytes Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/v3.3.1.tar.gz: 2,880,887 bytes Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/v3.3.1.tar.gz: 3,044,687 bytes Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/v3.3.1.tar.gz: 3,198,407 bytes Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/v3.3.1.tar.gz: 3,407,567 bytes Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/v3.3.1.tar.gz: 3,614,207 bytes Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/v3.3.1.tar.gz: 3,841,007 bytes Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/v3.3.1.tar.gz: 4,084,187 bytes ERROR: D:/tensorflow/tensorflow/contrib/android/BUILD:72:1: error loading package 'tensorflow/core': Encountered error while reading extension file 'protobuf.bzl': no such package '@protobuf//': Traceback (most recent call last): File "D:/tensorflow/tensorflow/workspace.bzl", line 122 _apply_patch(repo_ctx, repo_ctx.attr.patch_file) File "D:/tensorflow/tensorflow/workspace.bzl", line 113, in _apply_patch _execute_and_check_ret_code(repo_ctx, cmd) File "D:/tensorflow/tensorflow/workspace.bzl", line 97, in _execute_and_check_ret_code fail("Non-zero return code({1}) when ..., <2 more arguments>)) Non-zero return code(126) when executing 'c:\tools\msys64\usr\bin\bash.exe -c patch -p1 -d C:/users/ajaysaini/appdata/local/temp/_bazel_ajaysaini/aeorbm85/external/protobuf -i D:/tensorflow/third_party/protobuf/add_noinlines.patch': Stdout: Stderr: /usr/bin/bash: /d/GnuWin32/bin/patch: Permission denied and referenced by '//tensorflow/contrib/android:libtensorflow_inference.so'. ERROR: Analysis of target '//tensorflow/contrib/android:libtensorflow_inference.so' failed; build aborted. ____Elapsed time: 21.264s

laszlocsomor commented 7 years ago
Stderr: /usr/bin/bash: /d/GnuWin32/bin/patch: Permission denied

This looks like the wrong patch utility. Try running pacman -Syuu patch in MSYS.

ajaysaini-sgvu commented 7 years ago

@laszlocsomor Yep. Would be great if this is in docs also. It is giving this error now:

ERROR: D:/tensorflow/tensorflow/contrib/android/BUILD:72:1: error loading package 'tensorflow/core': Encountered error while reading extension file 'protobuf.bzl': no such package '@protobuf//': Traceback (most recent call last): File "D:/tensorflow/tensorflow/workspace.bzl", line 122 _apply_patch(repo_ctx, repo_ctx.attr.patch_file) File "D:/tensorflow/tensorflow/workspace.bzl", line 113, in _apply_patch _execute_and_check_ret_code(repo_ctx, cmd) File "D:/tensorflow/tensorflow/workspace.bzl", line 97, in _execute_and_check_ret_code fail("Non-zero return code({1}) when ..., <2 more arguments>)) Non-zero return code(256) when executing 'c:\tools\msys64\usr\bin\bash.exe -c patch -p1 -d C:/users/ajaysaini/appdata/local/temp/_bazel_ajaysaini/aeorbm85/external/protobuf -i D:/tensorflow/third_party/protobuf/add_noinlines.patch': Stdout: Stderr: Process terminated by signal 2 and referenced by '//tensorflow/contrib/android:libtensorflow_inference.so'. ERROR: Analysis of target '//tensorflow/contrib/android:libtensorflow_inference.so' failed; build aborted. ____Elapsed time: 46.924s

ajaysaini-sgvu commented 7 years ago

@laszlocsomor can you guess cause of above error?

laszlocsomor commented 7 years ago

Hey, yes, sorry about the long delay. This indicates that your WORKSPACE file doesn't declare any external repository called "protobuf". You have to clone https://github.com/google/protobuf (e.g. to c:\gitroot\protobuf), then add this rule to your WORKSPACE file:

local_repository(
    name = "protobuf",
    path = "c:\\gitroot\\protobuf",
)
ajaysaini-sgvu commented 7 years ago

@laszlocsomor Thanks! I did same which you suggested but it still fails. Here is my WORKSPACE file.

workspace(name = "org_tensorflow")

http_archive(
    name = "io_bazel_rules_closure",
    sha256 = "bc41b80486413aaa551860fc37471dbc0666e1dbb5236fb6177cb83b0c105846",
    strip_prefix = "rules_closure-dec425a4ff3faf09a56c85d082e4eed05d8ce38f",
    urls = [
        "http://mirror.bazel.build/github.com/bazelbuild/rules_closure/archive/dec425a4ff3faf09a56c85d082e4eed05d8ce38f.tar.gz",  # 2017-06-02
        "https://github.com/bazelbuild/rules_closure/archive/dec425a4ff3faf09a56c85d082e4eed05d8ce38f.tar.gz",
    ],
)

load("@io_bazel_rules_closure//closure:defs.bzl", "closure_repositories")

closure_repositories()

load("//tensorflow:workspace.bzl", "tf_workspace")

android_sdk_repository(
    name = "androidsdk",
    api_level = 23,
#    # Ensure that you have the build_tools_version below installed in the
#    # SDK manager as it updates periodically.
    build_tools_version = "25.0.2",
#    # Replace with path to Android SDK on your system
    path = "C:/Users/ajaysaini/AppData/Local/Android\sdk",
)

# Android NDK r12b is recommended (higher may cause issues with Bazel)
android_ndk_repository(
    name="androidndk",
    path="C:/android-ndk-r15",
#    # This needs to be 14 or higher to compile TensorFlow.
#    # Note that the NDK version is not the API level.
    api_level=15)

# Please add all new TensorFlow dependencies in workspace.bzl.
tf_workspace()

new_http_archive(
    name = "inception5h",
    build_file = "models.BUILD",
    sha256 = "d13569f6a98159de37e92e9c8ec4dae8f674fbf475f69fe6199b514f756d4364",
    urls = [
        "http://storage.googleapis.com/download.tensorflow.org/models/inception5h.zip",
        "http://download.tensorflow.org/models/inception5h.zip",
    ],
)

new_http_archive(
    name = "mobile_multibox",
    build_file = "models.BUILD",
    sha256 = "859edcddf84dddb974c36c36cfc1f74555148e9c9213dedacf1d6b613ad52b96",
    urls = [
        "http://storage.googleapis.com/download.tensorflow.org/models/mobile_multibox_v1a.zip",
        "http://download.tensorflow.org/models/mobile_multibox_v1a.zip",
    ],
)

new_http_archive(
    name = "stylize",
    build_file = "models.BUILD",
    sha256 = "3d374a730aef330424a356a8d4f04d8a54277c425e274ecb7d9c83aa912c6bfa",
    urls = [
        "http://storage.googleapis.com/download.tensorflow.org/models/stylize_v1.zip",
        "http://download.tensorflow.org/models/stylize_v1.zip",
    ],
)

local_repository(
    name = "protobuf",
    path = "D:/protobuf-master",
)

Here are the error logs:

bazel build -c opt //tensorflow/contrib/android:libtensorflow_inference.so --crosstool_top=//external:android/crosstool --host_crosstool_top=@bazel_tools//tools/cpp:toolchain --cpu=armeab 7a
java.lang.ExceptionInInitializerError
at com.google.devtools.build.lib.runtime.BlazeRuntime.fileSystemImplementation(BlazeRuntime.java:825)
at com.google.devtools.build.lib.runtime.BlazeRuntime.newRuntime(BlazeRuntime.java:971)
at com.google.devtools.build.lib.runtime.BlazeRuntime.batchMain(BlazeRuntime.java:753)
at com.google.devtools.build.lib.runtime.BlazeRuntime.main(BlazeRuntime.java:561)
at com.google.devtools.build.lib.bazel.BazelMain.main(BazelMain.java:56)
Caused by: java.lang.IllegalThreadStateException: process has not exited
at java.lang.ProcessImpl.exitValue(ProcessImpl.java:443)
at com.google.devtools.build.lib.windows.WindowsFileSystem.determineUnixRoot(WindowsFileSystem.java:509)
at com.google.devtools.build.lib.windows.WindowsFileSystem.(WindowsFileSystem.java:324)
... 5 more

crash in async thread: java.lang.ExceptionInInitializerError at com.google.devtools.build.lib.runtime.BlazeRuntime.fileSystemImplementation(BlazeRuntime.java:825) at com.google.devtools.build.lib.runtime.BlazeRuntime.newRuntime(BlazeRuntime.java:971) at com.google.devtools.build.lib.runtime.BlazeRuntime.batchMain(BlazeRuntime.java:753) at com.google.devtools.build.lib.runtime.BlazeRuntime.main(BlazeRuntime.java:561) at com.google.devtools.build.lib.bazel.BazelMain.main(BazelMain.java:56) Caused by: java.lang.IllegalThreadStateException: process has not exited at java.lang.ProcessImpl.exitValue(ProcessImpl.java:443) at com.google.devtools.build.lib.windows.WindowsFileSystem.determineUnixRoot(WindowsFileSystem.java:509) at com.google.devtools.build.lib.windows.WindowsFileSystem.(WindowsFileSystem.java:324) ... 5 more
laszlocsomor commented 7 years ago

This is the culprit:

Caused by: java.lang.IllegalThreadStateException: process has not exited
    at java.lang.ProcessImpl.exitValue(ProcessImpl.java:443)
    at com.google.devtools.build.lib.windows.WindowsFileSystem.determineUnixRoot(WindowsFileSystem.java:509)
    at com.google.devtools.build.lib.windows.WindowsFileSystem.(WindowsFileSystem.java:324)
    ... 5 more

Bazel tried to shell out to bash.exe and call cygpath to find the Windows path of /. The next version of Bazel will no longer do this, it will just read the BAZEL_SH environment variable and compute the path from that.

Solution: you need to tell Bazel this path. It's easy to compute though, it's BAZEL_SH's value without the trailing usr\bin\bash.exe, so for example if BAZEL_SH=c:\tools\msys64\usr\bin\bash.exe then you need to run bazel like so:

bazel --host_jvm_args=-Dbazel.windows_unix_root=c:\tools\msys64 build (...)

Or for even easier use, add this line to %USERPROFILE%\.bazelrc (mind the double back-slashes!):

startup --host_jvm_args=-Dbazel.windows_unix_root=C:\\tools\\msys64

so you don't need to pass the flag every time you run bazel, and can just run

bazel build (...)

and it will pick up the flag from the bazelrc.

ajaysaini-sgvu commented 7 years ago

@laszlocsomor Thanks! I set BAZEL_SH=c:\tools\msys64\usr\bin\bash.exe. Hope my below command is correct now and WORKSPACE. I am getting below error:

ajaysaini@Ajay3145984 /d/tensorflow $ bazel --host_jvm_args=-Dbazel.windows_unix_root=%BAZEL_SH% build -c opt //tensorflow/contrib/android:libtensorflow_inference.so --crosstool_top=//external:android/crosstool --host_crosstool _top=@bazel_tools//tools/cpp:toolchain --cpu=armeabi-v7a WARNING: Running Bazel server needs to be killed, because the startup options are different. . ERROR: D:/tensorflow/WORKSPACE:71:1: Cannot redefine repository after any load statement in the WORKSPACE file (for repository 'protobuf'). ERROR: Error evaluating WORKSPACE file. ERROR: error loading package 'external': Package 'external' contains errors. ____Elapsed time: 11.465s

Here is my WORKSPACE


workspace(name = "org_tensorflow")

http_archive(
    name = "io_bazel_rules_closure",
    sha256 = "bc41b80486413aaa551860fc37471dbc0666e1dbb5236fb6177cb83b0c105846",
    strip_prefix = "rules_closure-dec425a4ff3faf09a56c85d082e4eed05d8ce38f",
    urls = [
        "http://mirror.bazel.build/github.com/bazelbuild/rules_closure/archive/dec425a4ff3faf09a56c85d082e4eed05d8ce38f.tar.gz",  # 2017-06-02
        "https://github.com/bazelbuild/rules_closure/archive/dec425a4ff3faf09a56c85d082e4eed05d8ce38f.tar.gz",
    ],
)

load("@io_bazel_rules_closure//closure:defs.bzl", "closure_repositories")

closure_repositories()

load("//tensorflow:workspace.bzl", "tf_workspace")

android_sdk_repository(
    name = "androidsdk",
    api_level = 23,
#    # Ensure that you have the build_tools_version below installed in the
#    # SDK manager as it updates periodically.
    build_tools_version = "25.0.2",
#    # Replace with path to Android SDK on your system
    path = "C:/Users/ajaysaini/AppData/Local/Android\sdk",
)

# Android NDK r12b is recommended (higher may cause issues with Bazel)
android_ndk_repository(
    name="androidndk",
    path="C:/android-ndk-r15",
#    # This needs to be 14 or higher to compile TensorFlow.
#    # Note that the NDK version is not the API level.
    api_level=15)

# Please add all new TensorFlow dependencies in workspace.bzl.
tf_workspace()

new_http_archive(
    name = "inception5h",
    build_file = "models.BUILD",
    sha256 = "d13569f6a98159de37e92e9c8ec4dae8f674fbf475f69fe6199b514f756d4364",
    urls = [
        "http://storage.googleapis.com/download.tensorflow.org/models/inception5h.zip",
        "http://download.tensorflow.org/models/inception5h.zip",
    ],
)

new_http_archive(
    name = "mobile_multibox",
    build_file = "models.BUILD",
    sha256 = "859edcddf84dddb974c36c36cfc1f74555148e9c9213dedacf1d6b613ad52b96",
    urls = [
        "http://storage.googleapis.com/download.tensorflow.org/models/mobile_multibox_v1a.zip",
        "http://download.tensorflow.org/models/mobile_multibox_v1a.zip",
    ],
)

new_http_archive(
    name = "stylize",
    build_file = "models.BUILD",
    sha256 = "3d374a730aef330424a356a8d4f04d8a54277c425e274ecb7d9c83aa912c6bfa",
    urls = [
        "http://storage.googleapis.com/download.tensorflow.org/models/stylize_v1.zip",
        "http://download.tensorflow.org/models/stylize_v1.zip",
    ],
)

local_repository(
    name = "protobuf",
    path = "d:/protobuf",
)
laszlocsomor commented 7 years ago

If you're running Bazel from the MSYS shell, then it's safer to use forward-slashes in BAZEL_SH, like so:

export BAZEL_SH=c:/tools/msys64/usr/bin/bash.exe

Also, you shouldn't pass %BAZEL_SH% in the --host_jvm_args, because MSYS doesn't understand the %NAME% envvar syntax, it only understands $NAME, and also because you need just c:/tools/msys64 as the windows_unix_root, not the full BAZEL_SH.

As for the WORKSPACE error, it says you may not define a repository after a load statement in the WORKSPACE file. So you have to move the local_repository rule above the first load(...) and that should do the trick.

ajaysaini-sgvu commented 7 years ago

@laszlocsomor ah lot of rules, I think that these are not in docs. It is throwing this error now:

ajaysaini@Ajay3145984 /d/tensorflow $ bazel --host_jvm_args=-Dbazel.windows_unix_root=$BAZEL_SH build -c opt //tensorflow/contrib/android:libtensorflow_inference.so --crosstool_top=//external:android/crosstool --hostcrosstool top=@bazel_tools//tools/cpp:toolchain --cpu=armeabi-v7a WARNING: Running Bazel server needs to be killed, because the startup options are different. . Loading package: tensorflow/contrib/android Loading package: @bazel_tools//tools/jdk WARNING: The major revision of the Android NDK referenced by android_ndk_repository rule 'androidndk' is 15. The major revisions supported by Bazel are [10, 11, 12, 13, 14]. Defaulting to revision 14.. Loading package: @local_config_xcode// Loading package: @local_jdk// Loading package: @bazel_tools//tools/cpp Loading package: @local_config_cc// Loading complete. Analyzing... Loading package: tensorflow/java/src/main/native Loading package: tensorflow/c ____Loading package: tensorflow/tools/proto_text Loading package: third_party/eigen3 Loading package: @protobuf// Loading package: @local_config_sycl//sycl Downloading http://mirror.bazel.build/bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 727,020 bytes Loading package: @eigen_archive// WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:avgpooling_op.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:bounds_check.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:cwise_ops.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:cwise_ops_common.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:cwise_ops_gradients.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_activations.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_attention.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_backward_cuboid_convolutions.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_backward_spatial_convolutions.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_cuboid_convolution.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_pooling.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_softmax.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_spatial_convolutions.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_volume_patch.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:fifo_queue.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:maxpooling_op.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:ops_util.cc' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:ops_util.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:padding_fifo_queue.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:pooling_ops_common.cc' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:pooling_ops_common.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:queue_base.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:queue_op.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:typed_queue.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_beam_entry.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_beam_scorer.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_beam_search.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_decoder.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_loss_util.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/tensor_bundle:naming.cc' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/tensor_bundle:naming.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/tensor_bundle:tensor_bundle.cc' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/tensor_bundle:tensor_bundle.h' directly. You should either move the file to this package or depend on an appropriate rule there. Downloading http://mirror.bazel.build/github.com/google/gemmlowp/archive/a6f29d8ac48d63293f845f2253eccbf86bc28321.tar.gz: 40,960 bytes Loading package: @gemmlowp// Found 1 target... Building... [0 / 6] BazelWorkspaceStatusAction stable-status.txt [2 / 16] Writing file external/protobuf/protoc.exe-2.params [for host] [6 / 120] Creating source manifest for @protobuf//:protoc [for host] [6 / 145] Writing file tensorflow/core/libprotos_all_cc.a-2.params [for host] ERROR: C:/users/ajaysaini/appdata/local/temp/_bazel_ajaysaini/aeorbm85/external/protobuf/BUILD:281:1: C++ compilation of rule '@protobuf//:protoc_lib' failed: msvc_cl.bat failed: error executing command external/local_config_cc/wrapper/bin/msvc_cl.bat /DOS_WINDOWS=OS_WINDOWS /DCOMPILER_MSVC /DNOGDI /DNOMINMAX /DPRAGMA_SUPPORTED /D_WIN32_WINNT=0x0600 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS ... (remaining 33 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1. The system cannot find the path specified. Building complete. Target //tensorflow/contrib/android:libtensorflow_inference.so failed to build Use --verbose_failures to see the command lines of failed build steps. Elapsed time: 37.330s, Critical Path: 0.14s

ajaysaini@Ajay3145984 /d/tensorflow $

laszlocsomor commented 7 years ago

Can you run the build with --verbose_failures? There's not enough info in the log.

laszlocsomor commented 7 years ago

And you were still building with --host_jvm_args=-Dbazel.windows_unix_root=$BAZEL_SH. What's the value of BAZEL_SH?

ajaysaini-sgvu commented 7 years ago

@laszlocsomor See here complete logs:

ajaysaini@AJAY3145984 D:\tensorflow

bazel --host_jvm_args=-Dbazel.windows_unix_root=C:/tools/msys64/usr/bin/bash.exe build -c opt //tensorflow/contrib/android:libtensorflow_inference.so --crosstool_top=//external:android/crosstool --host_crosstool_top=@bazel_tools//tools/cpp:toolchain --cpu=armeabi-v7a --verbose_failures WARNING: Running Bazel server needs to be killed, because the startup options are different. . Loading package: tensorflow/contrib/android Loading package: @bazel_tools//tools/jdk Loading package: @local_config_xcode// WARNING: The major revision of the Android NDK referenced by android_ndk_repository rule 'androidndk' is 15. The major revisions supported by Bazel are [10, 11, 12, 13, 14]. Defaulting to revision 14.. Loading package: @androidndk// Loading package: @local_jdk// ____Loading package: @bazel_tools//tools/cpp Loading package: @local_config_cc// Loading complete. Analyzing... Loading package: tensorflow Loading package: tensorflow/java/src/main/native Loading package: tensorflow/tools/proto_text Loading package: tensorflow/core/kernels Loading package: @protobuf// __Loading package: @local_config_sycl//sycl WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:avgpooling_op.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:bounds_check.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:cwise_ops.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:cwise_ops_common.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:cwise_ops_gradients.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_activations.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_attention.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_backward_cuboid_convolutions.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_backward_spatial_convolutions.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_cuboid_convolution.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_pooling.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_softmax.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_spatial_convolutions.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_volume_patch.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:fifo_queue.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:maxpooling_op.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:ops_util.cc' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:ops_util.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:padding_fifo_queue.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:pooling_ops_common.cc' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:pooling_ops_common.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:queue_base.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:queue_op.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:typed_queue.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_beam_entry.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_beam_scorer.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_beam_search.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_decoder.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_loss_util.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/tensor_bundle:naming.cc' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/tensor_bundle:naming.h' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/tensor_bundle:tensor_bundle.cc' directly. You should either move the file to this package or depend on an appropriate rule there. WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/tensor_bundle:tensor_bundle.h' directly. You should either move the file to this package or depend on an appropriate rule there. __Loading package: @gemmlowp// Found 1 target... Building... [0 / 2] BazelWorkspaceStatusAction stable-status.txt [2 / 20] Compiling external/protobuf/src/google/protobuf/stubs/common.cc ERROR: C:/users/ajaysaini/appdata/local/temp/_bazel_ajaysaini/aeorbm85/external/protobuf/BUILD:93:1: C++ compilation of rule '@protobuf//:protobuf_lite' failed: clang failed: error executing command cd C:/users/ajaysaini/appdata/local/temp/_bazel_ajaysaini/aeorbm85/execroot/tensorflow SET PATH=C:\tools\msys64\usr\bin;C:\tools\msys64\bin;C:\Program Files\ConEmu\ConEmu\Scripts;C:\Program Files\ConEmu;C:\Program Files\ConEmu\ConEmu;C:\Python27\;C:\Python27\Scripts;C:\ProgramData\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Git\cmd;C:\Program Files (x86)\Yarn\bin;C:\Program Files\nodejs\;C:\Program Files\Cloud Foundry;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Users\ajaysaini\AppData\Local\atom\bin;D:\React Native\Example 1\ExampleOne\node_modules\watchman;C:\Program Files\Java\jdk1.8.0_121\bin;C:\Users\ajaysaini\AppData\Local\Android\sdk\platform-tools;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Program Files\Heroku\bin;C:\Users\ajaysaini\AppData\Local\Yarn.bin;C:\Python27;C:\Python27\Scripts;C:\cygwin64\bin;C:\Users\ajaysaini\AppData\Roaming\npm;C:\Program Files\MongoDB\Server\3.4\bin;C:\apktool;C:\ProgramData\chocolatey\lib\msys2;C:\tools\msys64; SET PWD=/proc/self/cwd external/androidndk/ndk/toolchains/llvm/prebuilt/windows-x86_64/bin/clang -gcc-toolchain external/androidndk/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64 -fpic -ffunction-sections -funwind-tables -fstack-protector-strong -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -no-canonical-prefixes -fno-integrated-as -target armv7-none-linux-androideabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -MD -MF bazel-out/arm-linux-androideabi-clang3.8-v7a-gnu-libstdcpp-opt/bin/external/protobuf/_objs/protobuf_lite/external/protobuf/src/google/protobuf/stubs/once.d -frandom-seed=bazel-out/arm-linux-androideabi-clang3.8-v7a-gnu-libstdcpp-opt/bin/external/protobuf/_objs/protobuf_lite/external/protobuf/src/google/protobuf/stubs/once.o -iquote external/protobuf -iquote bazel-out/arm-linux-androideabi-clang3.8-v7a-gnu-libstdcpp-opt/genfiles/external/protobuf -iquote external/bazel_tools -iquote bazel-out/arm-linux-androideabi-clang3.8-v7a-gnu-libstdcpp-opt/genfiles/external/bazel_tools -isystem external/protobuf/src -isystem bazel-out/arm-linux-androideabi-clang3.8-v7a-gnu-libstdcpp-opt/genfiles/external/protobuf/src -isystem external/bazel_tools/tools/cpp/gcc3 -DHAVE_PTHREAD -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -Wno-unused-function --sysroot=external/androidndk/ndk/platforms/android-14/arch-arm -isystem external/androidndk/ndk/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem external/androidndk/ndk/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -isystem external/androidndk/ndk/sources/cxx-stl/gnu-libstdc++/4.9/include/backward -c external/protobuf/src/google/protobuf/stubs/once.cc -o bazel-out/arm-linux-androideabi-clang3.8-v7a-gnu-libstdcpp-opt/bin/external/protobuf/_objs/protobuf_lite/external/protobuf/src/google/protobuf/stubs/once.o: com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1. error: unable to open output file 'C:\Temp\once-9f53e0.s': 'No such file or directory' 1 error generated. Target //tensorflow/contrib/android:libtensorflow_inference.so failed to build ____Elapsed time: 24.739s, Critical Path: 1.96s

ajaysaini@AJAY3145984 D:\tensorflow

laszlocsomor commented 7 years ago

Thanks! We're getting to the end of it! :)

Two things:

  1. The command you're running has an error:

    bazel --host_jvm_args=-Dbazel.windows_unix_root=C:/tools/msys64/usr/bin/bash.exe build -c opt //tensorflow/contrib/android:libtensorflow_inference.so --crosstool_top=//external:android/crosstool --host_crosstool_top=@bazel_tools//tools/cpp:toolchain --cpu=armeabi-v7a --verbose_failures

    The --host_jvm_args flag's value should be -Dbazel.windows_unix_root=C:/tools/msys64. So this is the correct command:

    bazel --host_jvm_args=-Dbazel.windows_unix_root=C:/tools/msys64 build -c opt //tensorflow/contrib/android:libtensorflow_inference.so --crosstool_top=//external:android/crosstool --host_crosstool_top=@bazel_tools//tools/cpp:toolchain --cpu=armeabi-v7a --verbose_failures
  2. I don't know why the build is failing, so let's try some sanity checks:

    • Download and use the latest MSVC version of Bazel: link
    • Check out the latest commit from both Tensorflow and Protobuf master branches, just to make sure you have no local modifications (other then the local_repository rule you added to the WORKSPACE file)
    • In MSYS, set the temp environment variables like so:
      export TMP=c:/temp
      export TEMP=c:/temp
      export TMPDIR=c:/temp
laszlocsomor commented 7 years ago
ERROR: no such package 'tensorflow/contrib/android': BUILD file not found on package path.

Looks like tensorflow/contrib/android/BUILD doesn't exist. Can you check?

You have to cd into the directory where you have Tensorflow's sources checked out.

ajaysaini-sgvu commented 7 years ago

@laszlocsomor my bad. I see. I tried to set temp environment variables on MSYS bash but it didn't work. Should I try with environment variable of my computer ?

laszlocsomor commented 7 years ago

Yes, please try that!

ajaysaini-sgvu commented 7 years ago

@laszlocsomor I did. Here are error logs:

ajaysaini@AJAY3145984 D:\tensorflow

bazel --host_jvm_args=-Dbazel.windows_unix_root=C:/tools/msys64 build -c opt //tensorflow/contrib/android:libtensorflow_inference.so --crosstool_top=//external:android/crosstool --host_cross tool_top=@bazel_tools//tools/cpp:toolchain --cpu=armeabi-v7a --verbose_failures
Extracting Bazel installation...
................................
Downloading http://mirror.bazel.build/github.com/bazelbuild/rules_closure/archive/dec425a4ff3faf09a56c85d082e4eed05d8ce38f.tar.gz: 40,960 bytes
Loading package: tensorflow/contrib/android
Loading package: @bazel_tools//tools/jdk
Loading package: @local_config_xcode//
Loading package: @local_jdk//
WARNING: The major revision of the Android NDK referenced by android_ndk_repository rule 'androidndk' is 15. The major revisions supported by Bazel are [10, 11, 12, 13, 14]. Defaulting to revi sion 14..
Loading package: @androidndk//
Loading package: @bazel_tools//tools/cpp
Loading package: @local_config_cc//
Loading complete. Analyzing...
Loading package: tensorflow/java/src/main/native
Loading package: tensorflow/core/platform/default/build_config
____Loading package: @bazel_tools//tools/genrule
Loading package: @protobuf//
Loading package: @local_config_sycl//sycl
Downloading http://mirror.bazel.build/bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 788,760 bytes
Downloading http://mirror.bazel.build/bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,974,420 bytes
Loading package: @eigen_archive//
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:avgpool ing_op.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_liblite: please do not import '//tensorflow/core/kernels:bounds check.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:cwise_o ps.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:cwise_o ps_common.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:cwise_o ps_gradients.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_a ctivations.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_a ttention.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_b ackward_cuboid_convolutions.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_b ackward_spatial_convolutions.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_c uboid_convolution.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_p ooling.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_s oftmax.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_s patial_convolutions.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_v olume_patch.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:fifo_qu eue.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:maxpool ing_op.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:ops_uti l.cc' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:ops_uti l.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:padding _fifo_queue.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:pooling _ops_common.cc' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:pooling _ops_common.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:queue_b ase.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:queue_o p.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:typed_q ueue.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_be am_entry.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_be am_scorer.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_be am_search.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_de coder.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_lo ss_util.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/tensor_bun dle:naming.cc' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/tensor_bun dle:naming.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/tensor_bun dle:tensor_bundle.cc' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/tensor_bun dle:tensor_bundle.h' directly. You should either move the file to this package or depend on an appropriate rule there.
Downloading http://mirror.bazel.build/github.com/google/gemmlowp/archive/a6f29d8ac48d63293f845f2253eccbf86bc28321.tar.gz: 40,960 bytes
Loading package: @gemmlowp//
Found 1 target...
Building...
[0 / 6] BazelWorkspaceStatusAction stable-status.txt
[0 / 6] Creating source manifest for //tensorflow/contrib/android:libtensorflow_inference.so
[2 / 37] Compiling external/protobuf/src/google/protobuf/dynamic_message.cc
[3 / 37] Compiling external/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.cc
[5 / 37] Compiling external/protobuf/src/google/protobuf/util/message_differencer.cc
[28 / 37] Compiling external/protobuf/src/google/protobuf/util/delimited_message_util.cc
[39 / 46] Compiling external/protobuf/src/google/protobuf/util/internal/proto_writer.cc
[40 / 47] Compiling external/protobuf/src/google/protobuf/io/strtod.cc
[41 / 48] Compiling external/protobuf/src/google/protobuf/source_context.pb.cc
[42 / 49] Compiling external/protobuf/src/google/protobuf/generated_message_reflection.cc
[43 / 50] Compiling external/protobuf/src/google/protobuf/descriptor.pb.cc
[45 / 52] Compiling external/protobuf/src/google/protobuf/duration.pb.cc
[50 / 57] Compiling external/protobuf/src/google/protobuf/util/internal/json_escaping.cc
[53 / 63] Creating source manifest for //tensorflow/tools/proto_text:gen_proto_text_functions [for host]
[54 / 82] Writing file external/protobuf/libprotobuf_lite.a-2.params [for host]
[55 / 87] Compiling external/protobuf/src/google/protobuf/stubs/time.cc [for host]
ERROR: C:/temp/_bazel_ajaysaini/aeorbm85/external/protobuf/BUILD:93:1: C++ compilation of rule '@protobuf//:protobuf_lite' failed: msvc_cl.bat failed: error executing command
cd C:/temp/_bazel_ajaysaini/aeorbm85/execroot/tensorflow
SET INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE;C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt;C:\Program Files (x86)\Windows Kits\8.1\include\sh ared;C:\Program Files (x86)\Windows Kits\8.1\include\um;C:\Program Files (x86)\Windows Kits\8.1\include\winrt;c:\tools\python2\include
SET LIB=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\8.1\lib\winv6. 3\um\x64;c:\tools\python2\libs
SET 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\8.1\bin\x64;C:\Program Files (x86)\Windows Kits\8.1\bin\x86;C:\Program Files\ConEmu\ConEmu\Scripts;C:\Program Files\ConEmu;C:\Program File s\ConEmu\ConEmu;C:\Python27\;C:\Python27\Scripts;C:\ProgramData\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Prog ram Files\TortoiseSVN\bin;C:\Program Files\Git\cmd;C:\Program Files (x86)\Yarn\bin;C:\Program Files\nodejs\;C:\Program Files\Cloud Foundry;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\ Windows Kits\8.1\Windows Performance Toolkit\;C:\Users\ajaysaini\AppData\Local\atom\bin;D:\React Native\Example 1\ExampleOne\node_modules\watchman;C:\Program Files\Java\jdk1.8.0_121\bin;C:\Use rs\ajaysaini\AppData\Local\Android\sdk\platform-tools;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Program Files\Heroku\bin;C:\Users\ajaysaini\AppData\Local\Yarn.bin;C:\Python27;C:\Python2 7\Scripts;C:\cygwin64\bin;C:\Users\ajaysaini\AppData\Roaming\npm;C:\Program Files\MongoDB\Server\3.4\bin;C:\apktool;C:\ProgramData\chocolatey\lib\msys2;C:\tools\msys64;;C:\windows\system32
SET PWD=/proc/self/cwd
SET TMP=c:\temp
external/local_config_cc/wrapper/bin/msvc_cl.bat /DOS_WINDOWS=OS_WINDOWS /DCOMPILER_MSVC /DNOGDI /DNOMINMAX /DPRAGMA_SUPPORTED /D_WIN32_WINNT=0x0600 /D_CRT_SECURE_NO_DEPRECATE /D_CRTSECURE NO_WARNINGS /D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS /D_USE_MATH_DEFINES /bigobj /Zm500 /J /Gy /GF /W3 /EHsc /wd4351 /wd4291 /wd4250 /wd4996 -Xcompilation-mode=opt -g0 -g0 /nologo /Iexterna l/protobuf /Ibazel-out/host/genfiles/external/protobuf /Iexternal/bazel_tools /Ibazel-out/host/genfiles/external/bazel_tools /Iexternal/protobuf/src /Ibazel-out/host/genfiles/external/protobuf /src /Iexternal/bazel_tools/tools/cpp/gcc3 /showIncludes /MT /O2 /c external/protobuf/src/google/protobuf/stubs/time.cc /Fobazel-out/host/bin/external/protobuf/_objs/protobuf_lite/external/pro tobuf/src/google/protobuf/stubs/time.o /DHAVE_PTHREAD /wd4018 /wd4514: com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
The system cannot find the path specified.
__Building complete.
Target //tensorflow/contrib/android:libtensorflow_inference.so failed to build
__
Elapsed time: 89.004s, Critical Path: 13.01s

ajaysaini@AJAY3145984 D:\tensorflow

laszlocsomor commented 7 years ago
com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
The system cannot find the path specified.

I suspect this is a long path issue, where the MSVC compiler cannot handle long path. Let's shorten the output file paths using the --output_user_root flag:

bazel --output_user_root=c:/tmp1 --host_jvm_args=-Dbazel.windows_unix_root=C:/tools/msys64 build -c opt //tensorflow/contrib/android:libtensorflow_inference.so --crosstool_top=//external:android/crosstool --host_crosstool_top=@bazel_tools//tools/cpp:toolchain --cpu=armeabi-v7a --verbose_failures
ajaysaini-sgvu commented 7 years ago

@laszlocsomor Thanks. I have done suggested changes. I see lot of files created in tmp1 directory but it still fails.

ajaysaini@AJAY3145984 D:\tensorflow

bazel --output_user_root=D:/tmp1 --host_jvm_args=-Dbazel.windows_unix_root=C:/tools/msys64 build -c opt //tensorflow/contrib/android:libtensorflow_inference.so --crosstool_top=//external:and roid/crosstool --host_crosstool_top=@bazel_tools//tools/cpp:toolchain --cpu=armeabi-v7a --verbose_failures
Extracting Bazel installation...
.....................................
Loading package: tensorflow/contrib/android
Loading package: @bazel_tools//tools/jdk
Loading package: @local_config_xcode//
WARNING: The major revision of the Android NDK referenced by android_ndk_repository rule 'androidndk' is 15. The major revisions supported by Bazel are [10, 11, 12, 13, 14]. Defaulting to revi sion 14..
Loading package: @androidndk//
Loading package: @local_jdk//
____Loading package: @bazel_tools//tools/cpp
Loading package: @local_config_cc//
Loading complete. Analyzing...
Loading package: tensorflow
Loading package: tensorflow/core
Loading package: tensorflow/java/src/main/native
Loading package: tensorflow/c
Loading package: third_party/eigen3
Loading package: tensorflow/core/kernels
Loading package: tensorflow/core/util/tensor_bundle
Loading package: tensorflow/tools/proto_text
Loading package: @local_config_sycl//sycl
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 30,319 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 32,768 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 40,960 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 251,178 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 267,537 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 300,255 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 316,614 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 332,973 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 349,332 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 365,691 bytes
Lost connection for https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz due to java.net.SocketTimeoutException: Read timed out
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 382,050 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 393,574 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 401,766 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 418,125 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 449,934 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 466,293 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 482,652 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 499,011 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 548,088 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 564,447 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 580,806 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 613,524 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 629,883 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 646,242 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 662,601 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 695,319 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 728,037 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 760,755 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 777,114 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 793,473 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 826,191 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 842,550 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 875,268 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 891,627 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 957,063 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 973,422 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,006,140 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,038,858 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,071,576 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,104,294 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,120,653 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,202,448 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,218,807 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,235,166 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,251,525 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,267,884 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,284,243 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,300,602 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,316,961 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,333,320 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,349,679 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,382,397 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,398,756 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,415,115 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,447,833 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,496,910 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,529,628 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,578,705 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,627,782 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,660,500 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,709,577 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,725,936 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,742,295 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,758,654 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,775,013 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,922,244 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,938,603 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 1,971,321 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 2,020,398 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 2,053,116 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 2,069,475 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 2,183,988 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 2,216,706 bytes
Downloading https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz: 2,249,424 bytes
Loading package: @eigen_archive//
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:avgpool ing_op.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_liblite: please do not import '//tensorflow/core/kernels:bounds check.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:cwise_o ps.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:cwise_o ps_common.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:cwise_o ps_gradients.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_a ctivations.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_a ttention.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_b ackward_cuboid_convolutions.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_b ackward_spatial_convolutions.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_c uboid_convolution.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_p ooling.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_s oftmax.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_s patial_convolutions.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:eigen_v olume_patch.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:fifo_qu eue.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:maxpool ing_op.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:ops_uti l.cc' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:ops_uti l.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:padding _fifo_queue.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:pooling _ops_common.cc' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:pooling _ops_common.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:queue_b ase.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:queue_o p.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/kernels:typed_q ueue.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_be am_entry.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_be am_scorer.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_be am_search.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_de coder.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/ctc:ctc_lo ss_util.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/tensor_bun dle:naming.cc' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/tensor_bun dle:naming.h' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/tensor_bun dle:tensor_bundle.cc' directly. You should either move the file to this package or depend on an appropriate rule there.
WARNING: D:/tensorflow/tensorflow/core/BUILD:919:12: in srcs attribute of cc_library rule //tensorflow/core:android_tensorflow_lib_lite: please do not import '//tensorflow/core/util/tensor_bun dle:tensor_bundle.h' directly. You should either move the file to this package or depend on an appropriate rule there.
Downloading http://mirror.bazel.build/github.com/google/gemmlowp/archive/a6f29d8ac48d63293f845f2253eccbf86bc28321.tar.gz: 563,723 bytes
Loading package: @gemmlowp//
Found 1 target...
Building...
[0 / 6] Creating source manifest for //tensorflow/contrib/android:libtensorflow_inference.so
[0 / 6] BazelWorkspaceStatusAction stable-status.txt
[2 / 140] Writing file external/protobuf/libprotobuf.a-2.params [for host]
[3 / 193] Writing file external/protobuf/protoc.exe-2.params [for host]
[4 / 193] Compiling external/protobuf/src/google/protobuf/util/internal/utility.cc [for host]
[4 / 193] Compiling external/protobuf/src/google/protobuf/util/internal/type_info_test_helper.cc [for host]
[4 / 193] Compiling external/protobuf/src/google/protobuf/descriptor_database.cc [for host]
ERROR: D:/tmp1/aeorbm85/external/protobuf/BUILD:133:1: C++ compilation of rule '@protobuf//:protobuf' failed: msvc_cl.bat failed: error executing command
cd D:/tmp1/aeorbm85/execroot/tensorflow
SET INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE;C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt;C:\Program Files (x86)\Windows Kits\8.1\include\sh ared;C:\Program Files (x86)\Windows Kits\8.1\include\um;C:\Program Files (x86)\Windows Kits\8.1\include\winrt;c:\tools\python2\include
SET LIB=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\8.1\lib\winv6. 3\um\x64;c:\tools\python2\libs
SET 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\8.1\bin\x64;C:\Program Files (x86)\Windows Kits\8.1\bin\x86;C:\Program Files\ConEmu\ConEmu\Scripts;C:\Program Files\ConEmu;C:\Program File s\ConEmu\ConEmu;C:\Python27\;C:\Python27\Scripts;C:\ProgramData\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Prog ram Files\TortoiseSVN\bin;C:\Program Files\Git\cmd;C:\Program Files (x86)\Yarn\bin;C:\Program Files\nodejs\;C:\Program Files\Cloud Foundry;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\ Windows Kits\8.1\Windows Performance Toolkit\;C:\Users\ajaysaini\AppData\Local\atom\bin;D:\React Native\Example 1\ExampleOne\node_modules\watchman;C:\Program Files\Java\jdk1.8.0_121\bin;C:\Use rs\ajaysaini\AppData\Local\Android\sdk\platform-tools;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Program Files\Heroku\bin;C:\Users\ajaysaini\AppData\Local\Yarn.bin;C:\Python27;C:\Python2 7\Scripts;C:\cygwin64\bin;C:\Users\ajaysaini\AppData\Roaming\npm;C:\Program Files\MongoDB\Server\3.4\bin;C:\apktool;C:\ProgramData\chocolatey\lib\msys2;C:\tools\msys64;;C:\windows\system32
SET PWD=/proc/self/cwd
SET TMP=c:\temp
external/local_config_cc/wrapper/bin/msvc_cl.bat /DOS_WINDOWS=OS_WINDOWS /DCOMPILER_MSVC /DNOGDI /DNOMINMAX /DPRAGMA_SUPPORTED /D_WIN32_WINNT=0x0600 /D_CRT_SECURE_NO_DEPRECATE /D_CRTSECURE NO_WARNINGS /D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS /D_USE_MATH_DEFINES /bigobj /Zm500 /J /Gy /GF /W3 /EHsc /wd4351 /wd4291 /wd4250 /wd4996 -Xcompilation-mode=opt -g0 -g0 /nologo /Iexterna l/protobuf /Ibazel-out/host/genfiles/external/protobuf /Iexternal/bazel_tools /Ibazel-out/host/genfiles/external/bazel_tools /Iexternal/protobuf/src /Ibazel-out/host/genfiles/external/protobuf /src /Iexternal/bazel_tools/tools/cpp/gcc3 /showIncludes /MT /O2 /c external/protobuf/src/google/protobuf/message.cc /Fobazel-out/host/bin/external/protobuf/_objs/protobuf/external/protobuf/sr c/google/protobuf/message.o /DHAVE_PTHREAD /wd4018 /wd4514: com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
The system cannot find the path specified.
Building complete.
Target //tensorflow/contrib/android:libtensorflow_inference.so failed to build
____Elapsed time: 172.163s, Critical Path: 0.37s

ajaysaini@AJAY3145984 D:\tensorflow

laszlocsomor commented 7 years ago

@ajaysaini-sgvu, I'm looking at it now. Nothing obvious stands out.

laszlocsomor commented 7 years ago

@ajaysaini-sgvu : I think Windows is not yet fully supported by all the tools involved in this build.

Here's the command you ran:

bazel --output_user_root=D:/tmp1 --host_jvm_args=-Dbazel.windows_unix_root=C:/tools/msys64 build -c opt //tensorflow/contrib/android:libtensorflow_inference.so --crosstool_top=//external:android/crosstool --host_crosstool_top=@bazel_tools//tools/cpp:toolchain --cpu=armeabi-v7a --verbose_failures

I ran a slightly modified version, with bazel 0.5.2:

C:\work\tensorflow>c:\work\bazel-msvc-0.5.2-windows-msvc-x86_64\bazel.exe --bazelrc=NUL --nomaster_bazelrc --output_user_root=c:/tmp1 --host_jvm_args=-Dbazel.windows_unix_root=C:/tools/msys64 build -c opt //tensorflow/contrib/android:libtensorflow_inference.so --crosstool_top=//external:android/crosstool --host_crosstool_top=@bazel_tools//tools/cpp:toolchain --cpu=armeabi-v7a --verbose_failures --copt=-w --host_copt=-w

And I also get a build error, though it's different than yours:

ERROR: C:/tmp1/cfyq7gze/external/protobuf/BUILD:113:1: C++ compilation of rule '@protobuf//:protobuf' failed: false failed: error executing command
  cd C:/tmp1/cfyq7gze/execroot/org_tensorflow
  SET PATH=C:\tools\msys64\usr\bin;C:\tools\msys64\bin;c:\tools\msys64\usr\bin;C:\Python27\;C:\Python27\Scripts;C:\ProgramData\Oracle\Java\javapath;C:\Windows\CCM\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\corpam;C:\Program Files (x86)\Google\Cert Installer\;C:\Windows\mrmagoo;C:\gnubby\bin\;C:\python_27_amd64\files;C:\Windows\ccmsetup;C:\Program Files (x86)\Google\gWindows-Updater;C:\Program Files\Puppet Labs\Puppet\bin;C:\Program Files (x86)\Bit9\Parity Agent;C:\Program Files\Git\cmd;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files (x86)\Google\gWindowsInformation;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\ProgramData\GooGet;C:\Program Files\Java\jdk1.8.0_112\bin;C:\Program Files\Google\gWindows-Updater;C:\Program Files (x86)\Corp SSH Helper;C:\Program Files\gWindows-Updater;C:\gnubby\bin;C:\Program Files (x86)\Google\Cert Installer;C:\Windows\system32\WindowsPowerShell\v1.0;C:\Program Files\CMake\bin;C:\Program Files\dotnet\;;C:\ProgramData\Diagnose_me;C:\Program Files (x86)\PuTTY\;
    SET PWD=/proc/self/cwd
  /bin/false -w -MD -MF bazel-out/stub_armeabi-v7a-opt/bin/external/protobuf/_objs/protobuf/external/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.pic.d -frandom-seed=bazel-out/stub_armeabi-v7a-opt/bin/external/protobuf/_objs/protobuf/external/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.pic.o -fPIC -iquote external/protobuf -iquote bazel-out/stub_armeabi-v7a-opt/genfiles/external/protobuf -iquote external/bazel_tools -iquote bazel-out/stub_armeabi-v7a-opt/genfiles/external/bazel_tools -isystem external/protobuf/src -isystem bazel-out/stub_armeabi-v7a-opt/genfiles/external/protobuf/src -isystem external/bazel_tools/tools/cpp/gcc3 -DHAVE_PTHREAD -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -Wno-unused-function -c external/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.cc -o bazel-out/stub_armeabi-v7a-opt/bin/external/protobuf/_objs/protobuf/external/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.pic.o: java.io.IOException: CreateProcess(): The system cannot find the file specified.
.
Target //tensorflow/contrib/android:libtensorflow_inference.so failed to build
INFO: Elapsed time: 79.805s, Critical Path: 11.58s

The --bazelrc=NUL and --nomaster_bazelrc flags ensure that bazel won't pick up any of my bazelrc files, and use flags from there. This way the flags I passed in this command are the only ones that are actually used.

The --output_user_root and --host_jvm_args flags are the same I recommended to you earlier.

The --cpu, --crosstool_top, and --host_crosstool_top flags come from your command, and I believe you copied those from //tensorflow/contrib/android/BUILD file. Those were added by @andrewharp, and I believe he intended those to be used on Linux or MacOS.

The --copt=-w and --host_copt=-w flags just reduce compiler noise on stdout; MSVC likes to print zillions of warnings and notices.

I believe the specified crosstool and host-crosstool don't yet work on Windows. The reason I believe that is that the command Bazel tried to run was /bin/false, which of course always fails, so it looks like the crosstool isn't supported on this platform. @andrewharp, @mhlopko : can you confirm?

andrewharp commented 7 years ago

@laszlocsomor correct, we only support Android bazel tf builds with Linux-based OS's. You can see https://github.com/tensorflow/tensorflow/issues/6385 for more details and workarounds.

davido commented 7 years ago

So, trying again to build gerrit with Bazel 0.5.2 It seems that python tool chain doesn't work, neither on Cygwin, nor on Msys2. We are providing custom maven_jar implementation and route it throw home made Python script: gerrit/tools/download_file.py. It seems that it cannot be invoked.

Trying to install bazel-0.5.2-without-jdk-windows-x86_64: it says, that msys-2.0.dll is missing, even though I installed it.

Installation of bazel-msvc-0.5.2-windows-msvc-x86_64 works.

I installed Windows native python 36. Trying to start building gerrit is failing on msys2:

$ ../../pgm/bazel/bazel-msvc-0.5.2-windows-msvc-x86_64.exe --client_debug build gerrit-common:server --subcommands --verbose_failures
CLIENT: Debug logging active
CLIENT: Trying to connect to server (timeout: 10 secs)...
____Loading package: gerrit-common
WARNING: C:/msys64/tmp/_bazel_davido/_biltsqa/external/bazel_tools/tools/cpp/cc_configure.bzl:67:3:
Auto-Configuration Warning: 'BAZEL_VC' is not set, start looking for the latest Visual C++ installed.
.
WARNING: C:/msys64/tmp/_bazel_davido/_biltsqa/external/bazel_tools/tools/cpp/cc_configure.bzl:67:3:
Auto-Configuration Warning: Looking for VS%VERSION%COMNTOOLS environment variables,eg. VS140COMNTOOLS
.
WARNING: C:/msys64/tmp/_bazel_davido/_biltsqa/external/bazel_tools/tools/cpp/cc_configure.bzl:67:3:
Auto-Configuration Warning: Looking for Visual C++ through registry
.
WARNING: C:/msys64/tmp/_bazel_davido/_biltsqa/external/bazel_tools/tools/cpp/cc_configure.bzl:67:3:
Auto-Configuration Warning: Visual C++ build tools found at C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\\VC\
.
____Loading complete.  Analyzing...
____Loading package: gerrit-patch-jgit
ERROR: C:/users/davido/projects/gerrit/lib/log/BUILD:1:1: no such package '@log_api//jar': Argument 0 of execute is neither a path nor                                         a string. and referenced by '//lib/log:api'.
ERROR: Analysis of target '//gerrit-common:server' failed; build aborted.
____Elapsed time: 0,745s

Environment here is:

$ set | grep BAZEL
BAZEL_PYTHON=C:/Users/davido/pgm/python/python36/python.exe
BAZEL_SH=C:/msys64/usr/bin/bash.exe

Trying to build on Cygwin is failing with:

$ ../../pgm/bazel/bazel-msvc-0.5.2-windows-msvc-x86_64.exe build gerrit-common:server --subcommands --verbose_failures
WARNING: C:/cygwin64/tmp/_bazel_davido/_biltsqa/external/bazel_tools/tools/cpp/cc_configure.bzl:67:3:
Auto-Configuration Warning: 'BAZEL_VC' is not set, start looking for the latest Visual C++ installed.
.
WARNING: C:/cygwin64/tmp/_bazel_davido/_biltsqa/external/bazel_tools/tools/cpp/cc_configure.bzl:67:3:
Auto-Configuration Warning: Looking for VS%VERSION%COMNTOOLS environment variables,eg. VS140COMNTOOLS
.
WARNING: C:/cygwin64/tmp/_bazel_davido/_biltsqa/external/bazel_tools/tools/cpp/cc_configure.bzl:67:3:
Auto-Configuration Warning: Looking for Visual C++ through registry
.
WARNING: C:/cygwin64/tmp/_bazel_davido/_biltsqa/external/bazel_tools/tools/cpp/cc_configure.bzl:67:3:
Auto-Configuration Warning: Visual C++ build tools found at C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\\VC\
.
____Loading package: @local_config_cc//
____Loading complete.  Analyzing...
ERROR: C:/users/davido/projects/gerrit/lib/BUILD:78:1: no such package '@guava//jar': failed C:/cygwin64/bin/python C:/users/davido/projects/gerrit/tools/download_file.py -o C:/cygwin64/tmp/_bazel_davido/_biltsqa/external/guava/jar/guava-22.0.jar -u MAVEN_CENTRAL:/com/google/guava/guava/22.0/guava-22.0.jar -v 3564ef3803de51fb0530a8377ec6100b33b0d073: java.io.IOException: CreateProcess(): Zugriff verweigert
 and referenced by '//lib:guava'.
ERROR: Analysis of target '//gerrit-common:server' failed; build aborted.
____Elapsed time: 2,206s

Environment here is:

$ set | grep BAZEL
BAZEL_PYTHON=C:/Users/davido/pgm/python/python36/python.exe
BAZEL_SH=C:/cygwin64/bin/bash.exe

Here it seems, that cygwin's own python is used: C:/cygwin64/bin/python, even though I said BAZEL_PYTHON=C:/Users/davido/pgm/python/python36/python.exe.

davido commented 7 years ago

/CC @damienmg (I would like to add Gerrit build on windows platform to Bazel CI).

I think I'm making progress. I decided to use MSYS shell for now. I can build Bazel from scratch (0.5.2 distribution).

Environment:

$ set | grep BAZEL
BAZEL_PYTHON=/C/Python27/python.exe
BAZEL_SH=C:/msys64/usr/bin/bash.exe

Build is failing on Gerrit master with custom built bazel: http://paste.openstack.org/show/614981.

davido@DESKTOP-N3CDIH8 MSYS /C/Users/davido/projects/gerrit
$ /C/Users/davido/projects/batel_dist/output/bazel.exe build --subcommands --verbose_failures gerrit-common:server
WARNING: C:/msys64/tmp/_bazel_davido/_biltsqa/external/bazel_tools/tools/cpp/cc_configure.bzl:67:3:
Auto-Configuration Warning: 'BAZEL_VC' is not set, start looking for the latest Visual C++ installed.
.
WARNING: C:/msys64/tmp/_bazel_davido/_biltsqa/external/bazel_tools/tools/cpp/cc_configure.bzl:67:3:
Auto-Configuration Warning: Looking for VS%VERSION%COMNTOOLS environment variables,eg. VS140COMNTOOLS
.
WARNING: C:/msys64/tmp/_bazel_davido/_biltsqa/external/bazel_tools/tools/cpp/cc_configure.bzl:67:3:
Auto-Configuration Warning: Looking for Visual C++ through registry
.
WARNING: C:/msys64/tmp/_bazel_davido/_biltsqa/external/bazel_tools/tools/cpp/cc_configure.bzl:67:3:
Auto-Configuration Warning: Visual C++ build tools found at C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\\VC\
.
ERROR: C:/users/davido/projects/gerrit/lib/joda/BUILD:9:1: no such package '@joda_convert//jar': Argument 0 of execute is neither a path nor a string. and referenced by '//lib/joda:joda-convert'.
ERROR: Analysis of target '//gerrit-common:server' failed; build aborted.
INFO: Elapsed time: 10,795s

Joda is here:

https://github.com/GerritCodeReview/gerrit/blob/master/lib/joda/BUILD#L9-L13

and here:

https://github.com/GerritCodeReview/gerrit/blob/master/WORKSPACE#L201-L205

Interestingly:

Building Bazel master with my custom bazel build failing here too, but in cpp tool chain:

davido@DESKTOP-N3CDIH8 MSYS /C/Users/davido/projects/bazel
$ /C/Users/davido/projects/batel_dist/output/bazel.exe build --verbose_failures src:bazel
WARNING: C:/msys64/tmp/_bazel_davido/e7lhz0a0/external/bazel_tools/tools/cpp/cc_configure.bzl:67:3:
Auto-Configuration Warning: 'BAZEL_VC' is not set, start looking for the latest Visual C++ installed.
.
WARNING: C:/msys64/tmp/_bazel_davido/e7lhz0a0/external/bazel_tools/tools/cpp/cc_configure.bzl:67:3:
Auto-Configuration Warning: Looking for VS%VERSION%COMNTOOLS environment variables,eg. VS140COMNTOOLS
.
WARNING: C:/msys64/tmp/_bazel_davido/e7lhz0a0/external/bazel_tools/tools/cpp/cc_configure.bzl:67:3:
Auto-Configuration Warning: Looking for Visual C++ through registry
.
WARNING: C:/msys64/tmp/_bazel_davido/e7lhz0a0/external/bazel_tools/tools/cpp/cc_configure.bzl:67:3:
Auto-Configuration Warning: Visual C++ build tools found at C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\\VC\
.
WARNING: C:/users/davido/projects/bazel/tools/build_defs/docker/docker.bzl:19:1: The docker_{build,bundle} rules bundled with Bazel are deprecated in favor of:
https://github.com/bazelbuild/rules_docker. Please change BUILD loads to reference: @io_bazel_rules_docker//docker:docker.bzl and add the following to your WORKSPACE:
git_repository(
    name = "io_bazel_rules_docker",
    remote = "https://github.com/bazelbuild/rules_docker.git",
    commit = "...",
)
load("@io_bazel_rules_docker//docker:docker.bzl", "docker_repositories")
docker_repositories().
INFO: Found 1 target...
ERROR: C:/users/davido/projects/bazel/src/main/cpp/util/BUILD:98:1: C++ compilation of rule '//src/main/cpp/util:logging' failed: msvc_cl.bat failed: error executing command
  cd C:/msys64/tmp/_bazel_davido/e7lhz0a0/execroot/io_bazel
  SET INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\ATLMFC\include;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\ucrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\shared;C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\winrt;/C/Python27/include
    SET LIB=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\ATLMFC\lib\x64;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\lib\x64;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.15063.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.14393.0\um\x64;/C/Python27/libs
    SET PATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\bin\HostX64\x64;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCPackages;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\bin\Roslyn;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Team Tools\Performance Tools;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools\;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\;C:\Program Files (x86)\Windows Kits\10\bin\x64;C:\Program Files (x86)\Windows Kits\10\bin\10.0.14393.0\x64;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\\MSBuild\15.0\bin;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\;c:\msys64\usr\local\bin;c:\msys64\usr\bin;c:\msys64\usr\bin;c:\msys64\opt\bin;c:\windows\system32;c:\windows;c:\windows\system32\wbem;c:\windows\system32\windowspowershell\v1.0\;c:\msys64\usr\bin\site_perl;c:\msys64\usr\bin\vendor_perl;c:\msys64\usr\bin\core_perl;C:\WINDOWS\system32
    SET PWD=/proc/self/cwd
    SET TMP=c:\msys64\tmp
  external/local_config_cc/wrapper/bin/msvc_cl.bat /DOS_WINDOWS=OS_WINDOWS /DCOMPILER_MSVC /DNOGDI /DNOMINMAX /DPRAGMA_SUPPORTED /D_WIN32_WINNT=0x0600 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS /D_USE_MATH_DEFINES /bigobj /Zm500 /J /Gy /GF /EHsc /wd4351 /wd4291 /wd4250 /wd4996 -Xcompilation-mode=fastbuild /nologo /I. /Ibazel-out/msvc_x64-fastbuild/genfiles /Iexternal/bazel_tools /Ibazel-out/msvc_x64-fastbuild/genfiles/external/bazel_tools /Iexternal/bazel_tools/tools/cpp/gcc3 /showIncludes /MT /Od /Z7 /c src/main/cpp/util/logging.cc /Fobazel-out/msvc_x64-fastbuild/bin/src/main/cpp/util/_objs/logging/src/main/cpp/util/logging.o: com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
Das System kann den angegebenen Pfad nicht finden.
Target //src:bazel failed to build
INFO: Elapsed time: 8,266s, Critical Path: 0,17s
davido commented 7 years ago

Not sure if I should open a new issue here for Bazel itself not building on Windows platform out of the box, but I need to patch bazel (master) to make Bauel compile itself.

The culrprit for the failure i posted in my previous comment seems to be the invocation in call_python.bat:

if not defined MSVCPYTHON set MSVCPYTHON="/C/Python27/python.exe"
%MSVCPYTHON% -B "%PYDIR%\%TOOLNAME%.py" %*

If I change echo ON I see the whole truth here:

C:\msys64\tmp\_bazel_davido\e7lhz0a0\execroot\io_bazel>external\local_config_cc\wrapper\bin\call_python.bat "C:\msys64\tmp\_bazel_davido\e7lhz0a0\execroot\io_bazel\external\local_config_cc\wrapper\bin\msvc_cl.bat" /DOS_WINDOWS=OS_WINDOWS /DCOMPILER_MSVC /DNOGDI /DNOMINMAX /DPRAGMA_SUPPORTED /D_WIN32_WINNT=0x0600 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS /D_USE_MATH_DEFINES /bigobj /Zm500 /J /Gy /GF /EHsc /wd4351 /wd4291 /wd4250 /wd4996 -Xcompilation-mode=fastbuild -DBLAZE_OPENSOURCE /nologo /I. /Ibazel-out/msvc_x64-fastbuild/genfiles /Iexternal/bazel_tools /Ibazel-out/msvc_x64-fastbuild/genfiles/external/bazel_tools /Iexternal/bazel_tools/tools/cpp/gcc3 /showIncludes /MT /Od /Z7 /c src/main/cpp/blaze_util.cc /Fobazel-out/msvc_x64-fastbuild/bin/src/main/cpp/_objs/blaze_util/src/main/cpp/blaze_util.o

Das System kann den angegebenen Pfad nicht finden.

And "/C/Python27/python.exe" is called from call_python.bat ... No wonder, trying to enter the command "/C/Python27/python.exe" in windows cmd.exe (it is bat file in the end): is failing in the same way:

C:\msys64\tmp\_bazel_davido\e7lhz0A0\execroot\io_bazel>"/C/Python27/python.exe"
Das System kann den angegebenen Pfad nicht finden.

If I change the command in call_python.bat to be:

if not defined MSVCPYTHON set MSVCPYTHON=C:\Python27\python.exe
%MSVCPYTHON% -B "%PYDIR%\%TOOLNAME%.py" %*

then it works and bazel can be compiled successfully:

$ /C/Users/davido/projects/bazel_dist/output/bazel.exe build src:bazel --verbose_failures --experimental_ui
[...]
C:\msys64\tmp\_bazel_davido\e7lhz0a0\execroot\io_bazel>C:\Python27\python.exe -B "C:\msys64\tmp\_bazel_davido\e7lhz0A0\execroot\io_bazel\external\local_config_cc\wrapper\bin\pydir\msvc_cl.py" "C:\msys64\tmp\_bazel_davido\e7lhz0a0\execroot\io_bazel\external\local_config_cc\wrapper\bin\msvc_cl.bat" /nologo /OUT:bazel-out/msvc_x64-fastbuild/bin/src/main/cpp/client.exe -DEFAULTLIB:advapi32.lib -DEFAULTLIB:ole32.lib -DEFAULTLIB:shell32.lib -DEFAULTLIB:ws2_32.lib /MACHINE:X64 /SUBSYSTEM:CONSOLE -Xcompilation-mode=fastbuild @bazel-out/msvc_x64-fastbuild/bin/src/main/cpp/client.exe-2.params /DEFAULTLIB:libcmt.lib /DEBUG:FASTLINK /INCREMENTAL:NO
link
Warning: Unmatched arguments: -lrt -ldl -lm -lm
Running: link @bazel-out\msvc_x64-fastbuild\bin\src\main\cpp\client.exe-2.params.msvc
Target //src:bazel up-to-date:
  C:/msys64/tmp/_bazel_davido/e7lhz0a0/execroot/io_bazel/bazel-out/msvc_x64-fastbuild/bin/src/bazel
INFO: Elapsed time: 257,945s, Critical Path: 141,22s
INFO: Build completed successfully, 1070 total actions

So the better question is, why MSVCPYTHON wasn't set here?

davido commented 7 years ago

OK, I figured it out the hard way, checked the source and noticed, call_python.bat.tpl is actually a template file, so replacing the variable with:

$ BAZEL_PYTHON=C:/Python27/python.exe

fixed Bazel build here. So for the record, and other folks, reading this. This environment did it for Bazel:

$ set | grep BAZEL
BAZEL_PYTHON=C:/Python27/python.exe
BAZEL_SH=C:/msys64/usr/bin/bash.exe
davido commented 7 years ago

Unfortunately, still no luck with gerrit here:

$ /C/Users/davido/projects/batel_dist/output/bazel.exe build gerrit-common:server --verbose_failures --experimental_ui --subcommands
....
WARNING: C:/msys64/tmp/_bazel_davido/_biltsqa/external/bazel_tools/tools/cpp/cc_configure.bzl:67:3:
Auto-Configuration Warning: 'BAZEL_VC' is not set, start looking for the latest Visual C++ installed.
WARNING: C:/msys64/tmp/_bazel_davido/_biltsqa/external/bazel_tools/tools/cpp/cc_configure.bzl:67:3:
Auto-Configuration Warning: Looking for VS%VERSION%COMNTOOLS environment variables,eg. VS140COMNTOOLS
WARNING: C:/msys64/tmp/_bazel_davido/_biltsqa/external/bazel_tools/tools/cpp/cc_configure.bzl:67:3:
Auto-Configuration Warning: Looking for Visual C++ through registry
WARNING: C:/msys64/tmp/_bazel_davido/_biltsqa/external/bazel_tools/tools/cpp/cc_configure.bzl:67:3:
Auto-Configuration Warning: Visual C++ build tools found at C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\\VC\
ERROR: C:/users/davido/projects/gerrit/lib/BUILD:29:1: no such package '@gwtjsonrpc//jar': Argument 0 of execute is neither a path nor a string. and referenced by '//lib:gwtjsonrpc'
ERROR: Analysis of target '//gerrit-common:server' failed; build aborted
INFO: Elapsed time: 24,612s
FAILED: Build did NOT complete successfully

Trying my small Bazel demo project that depends on guava but using vanilla maven_jar is failing with stamping command here:

davido@DESKTOP-N3CDIH8 MSYS /C/Users/davido/projects/bazel_printy
$ /C/Users/davido/projects/batel_dist/output/bazel.exe build --verbose_failures --experimental_ui --subcommands :printy              WARNING: C:/msys64/tmp/_bazel_davido/_yyoisfp/external/bazel_tools/tools/cpp/cc_configure.bzl:67:3:
Auto-Configuration Warning: 'BAZEL_VC' is not set, start looking for the latest Visual C++ installed.
WARNING: C:/msys64/tmp/_bazel_davido/_yyoisfp/external/bazel_tools/tools/cpp/cc_configure.bzl:67:3:
Auto-Configuration Warning: Looking for VS%VERSION%COMNTOOLS environment variables,eg. VS140COMNTOOLS
WARNING: C:/msys64/tmp/_bazel_davido/_yyoisfp/external/bazel_tools/tools/cpp/cc_configure.bzl:67:3:
Auto-Configuration Warning: Looking for Visual C++ through registry
WARNING: C:/msys64/tmp/_bazel_davido/_yyoisfp/external/bazel_tools/tools/cpp/cc_configure.bzl:67:3:
Auto-Configuration Warning: Visual C++ build tools found at C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\\VC\
INFO: Analysed target //:printy.
INFO: Found 1 target...
ERROR: Process exited with status 1: Process exited with status 1
Der Befehl "\"./tools/workspace-status.sh\"" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
Target //:printy failed to build
INFO: Elapsed time: 0,797s, Critical Path: 0,04s
FAILED: Build did NOT complete successfully

But after editing the tools/bazel.rc file and removing this line:

$ git diff
diff --git a/tools/bazel.rc b/tools/bazel.rc
index 2210511..e69de29 100644
--- a/tools/bazel.rc
+++ b/tools/bazel.rc
@@ -1 +0,0 @@
-build --workspace_status_command=./tools/workspace-status.sh

it works just fine:

davido@DESKTOP-N3CDIH8 MSYS /C/Users/davido/projects/bazel_printy
$ /C/Users/davido/projects/batel_dist/output/bazel.exe build --verbose_failures --experimental_ui --subcommands :printy
WARNING: C:/msys64/tmp/_bazel_davido/_yyoisfp/external/bazel_tools/tools/cpp/cc_configure.bzl:67:3:
Auto-Configuration Warning: 'BAZEL_VC' is not set, start looking for the latest Visual C++ installed.
WARNING: C:/msys64/tmp/_bazel_davido/_yyoisfp/external/bazel_tools/tools/cpp/cc_configure.bzl:67:3:
Auto-Configuration Warning: Looking for VS%VERSION%COMNTOOLS environment variables,eg. VS140COMNTOOLS
WARNING: C:/msys64/tmp/_bazel_davido/_yyoisfp/external/bazel_tools/tools/cpp/cc_configure.bzl:67:3:
Auto-Configuration Warning: Looking for Visual C++ through registry
WARNING: C:/msys64/tmp/_bazel_davido/_yyoisfp/external/bazel_tools/tools/cpp/cc_configure.bzl:67:3:
Auto-Configuration Warning: Visual C++ build tools found at C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\\VC\
INFO: Analysed target //:printy.
INFO: Found 1 target...
SUBCOMMAND: # @guava//jar:jar [action 'Extracting interface @guava//jar:jar']
cd C:/msys64/tmp/_bazel_davido/_yyoisfp/execroot/__main__
  SET PATH=C:\msys64\usr\bin;C:\msys64\bin;C:\msys64\usr\local\bin;C:\msys64\usr\bin;C:\msys64\usr\bin;C:\msys64\opt\bin;C:\Windows\System32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\msys64\usr\bin\site_perl;C:\msys64\usr\bin\vendor_perl;C:\msys64\usr\bin\core_perl
  external/bazel_tools/tools/jdk/ijar/ijar.exe external/guava/jar/guava-19.0.jar bazel-out/msvc_x64-fastbuild/genfiles/external/guava/jar/_ijar/jar/external/guava/jar/guava-19.0-ijar.jar
SUBCOMMAND: # //:printy [action 'Building printy.jar ()']
cd C:/msys64/tmp/_bazel_davido/_yyoisfp/execroot/__main__
  SET LC_CTYPE=en_US.UTF-8
  external/local_jdk/bin/java.exe -Xbootclasspath/p:external/bazel_tools/third_party/java/jdk/langtools/javac-9-dev-r4023-2.jar -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -jar external/bazel_tools/tools/jdk/JavaBuilder_deploy.jar @bazel-out/msvc_x64-fastbuild/bin/printy.jar-2.params
SUBCOMMAND: # //:printy_lib [action 'Building libprinty_lib.jar (1 source file)']
cd C:/msys64/tmp/_bazel_davido/_yyoisfp/execroot/__main__
  SET LC_CTYPE=en_US.UTF-8
  external/local_jdk/bin/java.exe -Xbootclasspath/p:external/bazel_tools/third_party/java/jdk/langtools/javac-9-dev-r4023-2.jar -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -jar external/bazel_tools/tools/jdk/JavaBuilder_deploy.jar @bazel-out/msvc_x64-fastbuild/bin/libprinty_lib.jar-2.params
Target //:printy up-to-date:
  C:/msys64/tmp/_bazel_davido/_yyoisfp/execroot/__main__/bazel-out/msvc_x64-fastbuild/bin/printy.jar
  C:/msys64/tmp/_bazel_davido/_yyoisfp/execroot/__main__/bazel-out/msvc_x64-fastbuild/bin/printy
  C:/msys64/tmp/_bazel_davido/_yyoisfp/execroot/__main__/bazel-out/msvc_x64-fastbuild/bin/printy.cmd
INFO: Elapsed time: 3,909s, Critical Path: 1,41s
INFO: Build completed successfully, 6 total actions

So the problem seems to be gerrit specific.

I will try to extract a small reproducer from gerrit tree in its own GH repository.

davido commented 7 years ago

Seeing this in the java.log:

170712 20:17:13.592:W 3118 [com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run] Aborting evaluation due to com.google.devtools.build.lib.rules.repository.RepositoryFunction$RepositoryFunctionException: com.google.devtools.build.lib.syntax.EvalExceptionWithStackTrace: Argument 0 of execute is neither a path nor a string. while evaluating REPOSITORY_DIRECTORY:@scribe
davido commented 7 years ago

Ok, I found the culprit in gerrit's maven_jar.bzl implementation:

  python = ctx.which("python")

seems to be not portable and produces None on the other plattform. The source code with diagnostic prints is:

def _maven_jar_impl(ctx):
  """rule to download a Maven archive."""
  print('_maven_jar_impl0')
  coordinates = _create_coordinates(ctx.attr.artifact)

  name = ctx.name
  sha1 = ctx.attr.sha1
  print('_maven_jar_impl1')
  parts = ctx.attr.artifact.split(':')
  # TODO(davido): Only releases for now, implement handling snapshots
  jar, url = _maven_release(ctx, parts)

  binjar = jar + '.jar'
  binjar_path = ctx.path('/'.join(['jar', binjar]))
  binurl = url + '.jar'
  print('_maven_jar_impl2')
  python = ctx.which("python")
  print(python)
  script = ctx.path(ctx.attr._download_script)

  args = [python, script, "-o", binjar_path, "-u", binurl]
  if ctx.attr.sha1:
    args.extend(["-v", sha1])
  if ctx.attr.unsign:
    args.append('--unsign')
  for x in ctx.attr.exclude:
    args.extend(['-x', x])

  print('_maven_jar_impl3, args: %s' % args)
  out = ctx.execute(args)

and the corresponding output is:

$ /C/Users/davido/projects/batel_dist/output/bazel.exe --nomaster_bazelrc build --verbose_failures --experimental_ui --subcommands :printy
WARNING: C:/users/davido/projects/bazel_printy/tools/bzl/maven_jar2.bzl:117:3: _maven_jar_impl0
WARNING: C:/users/davido/projects/bazel_printy/tools/bzl/maven_jar2.bzl:122:3: _maven_jar_impl1
WARNING: C:/users/davido/projects/bazel_printy/tools/bzl/maven_jar2.bzl:130:3: _maven_jar_impl2
WARNING: C:/users/davido/projects/bazel_printy/tools/bzl/maven_jar2.bzl:132:3: None
WARNING: C:/users/davido/projects/bazel_printy/tools/bzl/maven_jar2.bzl:143:3: _maven_jar_impl3, args: [None, C:/users/davido/projects/bazel_printy/tools/download_file.py, "-o", C:/msys64/tmp/_bazel_davido/_yyoisfp/external/guava/jar/guava-19.0.jar, "-u", "MAVEN_CENTRAL:/com/google/guava/guava/19.0/guava-19.0.jar", "-v", "6ce200f6b23222af3d8abb6b6459e6c44f4bb0e9"]
ERROR: C:/users/davido/projects/bazel_printy/BUILD:1:1: no such package '@guava//jar': Argument 0 of execute is neither a path nor a string. and referenced by '//:printy_lib'
ERROR: Analysis of target '//:printy' failed; build aborted
INFO: Elapsed time: 0,624s
FAILED: Build did NOT complete successfully

Workaround for now is:

  if not python:
    # TODO(davido): Figure out how to retrieve the python path in Skylark on the other plattform
    # Use python3 for os.link
    # python='C:/Python27/python.exe'
    python='C:/Python36/python.exe'

With this in place, the build is going further and is failing with missing link method in os module:

WARNING: C:/users/davido/projects/bazel_printy/tools/bzl/maven_jar2.bzl:146:3: _maven_jar_impl3, args: ["C:/Python27/python.exe", C:/users/davido/projects/bazel_printy/tools/download_file.py, "-o", C:/msys64/tmp/_bazel_davido/_yyoisfp/external/guava/jar/guava-19.0.jar, "-u", "MAVEN_CENTRAL:/com/google/guava/guava/19.0/guava-19.0.jar", "-v", "6ce200f6b23222af3d8abb6b6459e6c44f4bb0e9"]
ERROR: C:/users/davido/projects/bazel_printy/BUILD:1:1: no such package '@guava//jar': failed C:/Python27/python.exe C:/users/davido/projects/bazel_printy/tools/download_file.py -o C:/msys64/tmp/_bazel_davido/_yyoisfp/external/guava/jar/guava-19.0.jar -u MAVEN_CENTRAL:/com/google/guava/guava/19.0/guava-19.0.jar -v 6ce200f6b23222af3d8abb6b6459e6c44f4bb0e9: Traceback (most recent call last):
  File "C:/users/davido/projects/bazel_printy/tools/download_file.py", line 20, in <module>
    from os import link, makedirs, path, remove
ImportError: cannot import name link
 and referenced by '//:printy_lib'
ERROR: Analysis of target '//:printy' failed; build aborted
INFO: Elapsed time: 1,330s
FAILED: Build did NOT complete successfully

which I fixed, switching from using python2 to python3.

davido commented 7 years ago

After seeing what is going on printy demo project, I was able to patch gerrit and make Bazel work. Here is the (non polished, quick and durty) patch:

$ git diff
diff --git a/tools/bzl/maven_jar.bzl b/tools/bzl/maven_jar.bzl
index 55bfae178f..56beb94be7 100644
--- a/tools/bzl/maven_jar.bzl
+++ b/tools/bzl/maven_jar.bzl
@@ -128,6 +128,9 @@ def _maven_jar_impl(ctx):
   binurl = url + '.jar'

   python = ctx.which("python")
+  if not python:
+    # TODO(davido): Figure out how to retrieve the python path in Skylark on the other plattform
+       python='C:/Python36/python.exe'
   script = ctx.path(ctx.attr._download_script)

   args = [python, script, "-o", binjar_path, "-u", binurl]
diff --git a/tools/download_file.py b/tools/download_file.py
index 38c2974a7d..e7534047ef 100755
--- a/tools/download_file.py
+++ b/tools/download_file.py
@@ -24,7 +24,8 @@ from sys import stderr
 from util import hash_file, resolve_url
 from zipfile import ZipFile, BadZipfile, LargeZipFile

-GERRIT_HOME = path.expanduser('~/.gerritcodereview')
+#GERRIT_HOME = path.expanduser('~/.gerritcodereview')
+GERRIT_HOME = 'C:\\msys64\\home\\davido\\.gerritcodereview'
 # TODO(davido): Rename in bazel-cache
 CACHE_DIR = path.join(GERRIT_HOME, 'buck-cache', 'downloaded-artifacts')
 LOCAL_PROPERTIES = 'local.properties'
@@ -85,7 +86,7 @@ opts.add_option('--unsign', action='store_true')
 args, _ = opts.parse_args()

 root_dir = args.o
-while root_dir and root_dir != "/":
+while root_dir and root_dir != "/" and root_dir != "C:/":
   root_dir, n = path.split(root_dir)
   if n == 'WORKSPACE':
     break

Now a small part of gerrit can be built: http://paste.openstack.org/show/615216/

Trying to build other parts are failing in calling python from genrule:

load("//tools/bzl:maven.bzl", "merge_maven_jars")

# core and backward-codecs both provide
# META-INF/services/org.apache.lucene.codecs.Codec, so they must be merged.
merge_maven_jars(
    name = "lucene-core-and-backward-codecs",
    srcs = [
        "@backward_codecs//jar",
        "@lucene_core//jar",
    ],
    data = ["//lib:LICENSE-Apache2.0"],
    visibility = ["//visibility:public"],
)

# merge_maven_jars

def cmd(jars):
  return ('$(location //tools:merge_jars) $@ '
          + ' '.join(['$(location %s)' % j for j in jars]))

def merge_maven_jars(name, srcs, **kwargs):
  native.genrule(
    name = '%s__merged_bin' % name,
    cmd = cmd(srcs),
    tools = srcs + ['//tools:merge_jars'],
    outs = ['%s__merged.jar' % name],
  )
  native.java_import(
    name = name,
    jars = [':%s__merged_bin' % name],
    **kwargs
  )

# //tools:merge_jars
py_binary(
    name = "merge_jars",
    srcs = ["merge_jars.py"],
    main = "merge_jars.py",
    visibility = ["//visibility:public"],
)

with:

SUBCOMMAND: # //lib/lucene:lucene-core-and-backward-codecs__merged_bin [action 'Executing genrule //lib/lucene:lucene-core-and-backward-codecs__merged_bin']
cd C:/msys64/tmp/_bazel_davido/_biltsqa/execroot/gerrit
  SET PATH=C:\msys64\usr\bin;C:\msys64\bin;C:\msys64\usr\local\bin;C:\msys64\usr\bin;C:\msys64\usr\bin;C:\msys64\opt\bin;C:\Windows\System32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\msys64\usr\bin\site_perl;C:\msys64\usr\bin\vendor_perl;C:\msys64\usr\bin\core_perl
  C:/msys64/usr/bin/bash.exe -c source external/bazel_tools/tools/genrule/genrule-setup.sh; bazel-out/host/bin/tools/merge_jars bazel-out/msvc_x64-fastbuild/genfiles/lib/lucene/lucene-core-and-backward-codecs__merged.jar external/backward_codecs/jar/lucene-backward-codecs-5.5.4.jar external/lucene_core/jar/lucene-core-5.5.4.jar
ERROR: C:/users/davido/projects/gerrit/lib/lucene/BUILD:7:1: Executing genrule //lib/lucene:lucene-core-and-backward-codecs__merged_bin failed: bash.exe failed: error executing command
  cd C:/msys64/tmp/_bazel_davido/_biltsqa/execroot/gerrit
  SET PATH=C:\msys64\usr\bin;C:\msys64\bin;C:\msys64\usr\local\bin;C:\msys64\usr\bin;C:\msys64\usr\bin;C:\msys64\opt\bin;C:\Windows\System32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\msys64\usr\bin\site_perl;C:\msys64\usr\bin\vendor_perl;C:\msys64\usr\bin\core_perl
  C:/msys64/usr/bin/bash.exe -c source external/bazel_tools/tools/genrule/genrule-setup.sh; bazel-out/host/bin/tools/merge_jars bazel-out/msvc_x64-fastbuild/genfiles/lib/lucene/lucene-core-and-backward-codecs__merged.jar external/backward_codecs/jar/lucene-backward-codecs-5.5.4.jar external/lucene_core/jar/lucene-core-5.5.4.jar: com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 127
/usr/bin/env: 'python': No such file or directory