Skip to content

Commit

Permalink
Make work with latest released Bazel 0.14.1.
Browse files Browse the repository at this point in the history
Versions after 0.3.1 did strict dependency enforcement of includes. But the
compiler in the NaCl SDK doesn't get along with it, so it is effectively (and
hackishly) disabled in the CROSSTOOL file. Given the state of NaCl, I don't
think it'll ever be fixed.

As a consequence of doing this, tool out the io_bazel repo, which was used for
protobufs and gtest, and replace it with those two projects directly. Those
projects now have their own BUILD files.

Had to eliminate -Wunused-parameter to get protobufs to compile. Oh well.

Fixes #140.
  • Loading branch information
rpwoodbu committed Jun 10, 2018
1 parent aa8102b commit 7a2a16c
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 15 deletions.
15 changes: 11 additions & 4 deletions CROSSTOOL
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,14 @@ toolchain {
linker_flag: "-lc++"
linker_flag: "-Bexternal/nacl_sdk/toolchain/linux_pnacl/bin"

cxx_builtin_include_directory: "external/nacl_sdk/toolchain/linux_pnacl/lib"
# The compiler in the NaCl SDK doesn't support the flags necessary to do
# strict dependency enforcement (i.e., -no-canonical-prefixes and
# -fno-canonical-system-headers). So effectively disable the feature in this
# manner:
cxx_builtin_include_directory: "/"
# For reference, here's a path that we would ordinarily want to include:
#cxx_builtin_include_directory: "external/nacl_sdk/toolchain/linux_pnacl/lib"

#tool_path { name: "gcov" path: "/usr/bin/gcov" }
tool_path { name: "gcov" path: "/bin/false" }

Expand All @@ -59,7 +66,7 @@ toolchain {
tool_path { name: "objdump" path: "/bin/false" }
tool_path { name: "strip" path: "external/nacl_sdk/toolchain/linux_pnacl/bin/pnacl-strip" }

# Anticipated future default.
# Anticipated future default. (But NaCl SDK doesn't support them.)
#unfiltered_cxx_flag: "-no-canonical-prefixes"
#unfiltered_cxx_flag: "-fno-canonical-system-headers"

Expand Down Expand Up @@ -92,8 +99,8 @@ toolchain {
compiler_flag: "-Wall"
# All warnings are errors.
compiler_flag: "-Werror"
# Enable a few more warnings that aren't part of -Wall.
compiler_flag: "-Wunused-parameter"
# Would be nice to enable this warning, but then protobufs won't build.
#compiler_flag: "-Wunused-parameter"
# But disable some that are problematic.
#compiler_flag: "-Wno-free-nonheap-object" # has false positives

Expand Down
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ Building
package, so installation is easy; the only caveat is that it requires Java
(sorry).

NB: For now, **you must use Bazel v0.3.1**. See
[Issue #140](https://github.com/rpwoodbu/mosh-chrome/issues/140) for details.

You can build the dev track simply by running:

$ ./build.sh dev
Expand Down
20 changes: 16 additions & 4 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
workspace(name = "mosh_chrome")

# The manifest of NaCl SDK versions can be found here:
# https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/naclsdk_manifest2.json

# There are hardlinks in the stock NaCl SDK archive, and Bazel can't handle
# them. It just creates files of zero size. To work around this, I've hacked
# together a custom repository rule that just shells out to "tar". This isn't
Expand Down Expand Up @@ -98,11 +101,20 @@ new_git_repository(
build_file = "external_builds/BUILD.libapps",
)

# Bazel repo gives us access to useful things, e.g., //third_party.
git_repository(
name = "io_bazel",
remote = "https://github.com/bazelbuild/bazel.git",
commit = "e671d2950fb56c499db2c99a3d6dad2d291ed873", # tag = "0.3.0"
name = "com_google_protobuf",
remote = "https://github.com/google/protobuf.git",
commit = "ce044817c7ba0aea27c3fd8e496635d94d20a755", # tag = "v3.6.0.1"
)

git_repository(
name = "com_google_googletest",
remote = "https://github.com/google/googletest.git",
# Nothing special about this commit; this project simply doesn't have a
# recent release which includes Bazel support. Chose the same commit as
# found here:
# https://github.com/bazelbuild/bazel/blob/d3d86440e90a8cef8483dec83f06c8a6f644603e/WORKSPACE#L163
commit = "dfa853b63d17c787914b663b50c2095a0c5b706e",
)

# Google Style Guide includes cpplint.
Expand Down
6 changes: 3 additions & 3 deletions external_builds/BUILD.mosh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package(default_visibility = ["//visibility:private"])

load("@io_bazel//third_party/protobuf:protobuf.bzl", "cc_proto_library")
load("@com_google_protobuf//:protobuf.bzl", "cc_proto_library")

cc_library(
name = "mosh_client_lib",
Expand Down Expand Up @@ -165,8 +165,8 @@ cc_proto_library(
"src/protobufs/transportinstruction.proto",
"src/protobufs/userinput.proto",
],
protoc = "@io_bazel//third_party/protobuf:protoc",
default_runtime = "@io_bazel//third_party/protobuf:protobuf_clib",
protoc = "@com_google_protobuf//:protoc",
default_runtime = "@com_google_protobuf//:protobuf",
)

# Newlib header files don't declare pselect. This rule allows us to force this
Expand Down
2 changes: 1 addition & 1 deletion mosh_nacl/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ cc_test(
srcs = ["sshfp_record_test.cc"],
deps = [
":sshfp_record_lib",
"@io_bazel//third_party:gtest",
"@com_google_googletest//:gtest_main",
],
size = "small",
)
Expand Down

0 comments on commit 7a2a16c

Please sign in to comment.