bazel: Bazel HEAD build fails on Ubuntu 16.04.2 LTS VirtualBox VM

Description of the problem / feature request / question:

Compiling the latest version of Bazel from HEAD (commit https://github.com/bazelbuild/bazel/commit/97975603e5ff2247e6bb352e3afd27fea38f108d as of time of me writing this), with the command bazel build //src:bazel, fails with the following error.

jonathan@jonathan-VirtualBox:~/dev/bazel$ bazel build //src:bazel
............................
WARNING: /home/jonathan/dev/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: /home/jonathan/dev/bazel/src/main/tools/BUILD:42:1: C++ compilation of rule '//src/main/tools:linux-sandbox' failed: Process exited with status 1 [sandboxed].
src/main/tools/linux-sandbox-pid1.cc:193: "mount(/tmp, /tmp, NULL, MS_BIND, NULL)": Invalid argument
Use --strategy=CppCompile=standalone to disable sandboxing for the failing actions.
Target //src:bazel failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 10.990s, Critical Path: 0.11s

Running bazel clean --expunge && bazel shutdown beforehand or restarting the virtual machine (see Environment Info) do not seem to resolve the problem.

FWIW, bash ./compile.sh compile /usr/bin/bazel works with no problems.

If possible, provide a minimal example to reproduce the problem:

Environment info

  • Operating System: Ubuntu 16.04.2 LTS. Running as a guest in VirtualBox 5.1.20, itself running on Windows 7.

  • Bazel version (output of bazel info release): release 0.5.0

Have you found anything relevant by searching the web?

I have tried searching the GitHub issues with the search terms sandbox and build, but AFAICT there’s no pre-existing bug report that matches or seems similar enough to the problem that I’m experiencing.

Anything else, information or logs or outputs that would be helpful?

Running bazel build //src:bazel --verbose_failures generates the following output:

jonathan@jonathan-VirtualBox:~/dev/bazel$ bazel build //src:bazel --verbose_failures
WARNING: /home/jonathan/dev/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: /home/jonathan/dev/bazel/src/main/tools/BUILD:3:1: C++ compilation of rule '//src/main/tools:logging' failed: gcc failed: error executing command 
  (exec env - \
    PWD=/proc/self/cwd \
  /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -B/usr/bin -B/usr/bin -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -MD -MF bazel-out/local-fastbuild/bin/src/main/tools/_objs/logging/src/main/tools/logging.pic.d '-frandom-seed=bazel-out/local-fastbuild/bin/src/main/tools/_objs/logging/src/main/tools/logging.pic.o' -fPIC -iquote . -iquote bazel-out/local-fastbuild/genfiles -iquote external/bazel_tools -iquote bazel-out/local-fastbuild/genfiles/external/bazel_tools -isystem external/bazel_tools/tools/cpp/gcc3 -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c src/main/tools/logging.cc -o bazel-out/local-fastbuild/bin/src/main/tools/_objs/logging/src/main/tools/logging.pic.o)

Use --sandbox_debug to see verbose messages from the sandbox.
src/main/tools/linux-sandbox-pid1.cc:193: "mount(/tmp, /tmp, NULL, MS_BIND, NULL)": Invalid argument
Use --strategy=CppCompile=standalone to disable sandboxing for the failing actions.
Target //src:bazel failed to build
INFO: Elapsed time: 0.465s, Critical Path: 0.08s

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 15 (13 by maintainers)

Most upvoted comments

@Helcaraxan A fix for this has been submitted by a colleague and should land in the GitHub repo later today. 😃 I tagged it with this bug so it will automatically be pinged.

Would be appreciated if you could build Bazel from HEAD then and give it a try to make sure that it really solves the issue for you.

Upgrading to VirtualBox 5.1.22 and updating the Guest Additions within my Ubuntu VM to 5.1.22 seem to have no effect.

Furthermore, manually deleting the contents of ~/.cache/bazel/ and running bazel clean --expunge && bazel shutdown && bazel build //src:bazel also has no effect.