Skip to content

Instantly share code, notes, and snippets.

@justbuchanan
Last active December 4, 2018 04:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justbuchanan/73baf217a4c67b2f3d8ed53a12759476 to your computer and use it in GitHub Desktop.
Save justbuchanan/73baf217a4c67b2f3d8ed53a12759476 to your computer and use it in GitHub Desktop.
Example of bazel analysis failure related to kythe's llvm setup
cc_binary(
name = "this_works",
srcs = ["main.cc"],
deps = ["@io_kythe//kythe/cxx/common:kythe_uri"],
)
# This fails bazel analysis because it can't find the compiled llvm libraries,
# which are built outside of bazel. This doesn't actually depend on anything
# llvm-related, but the kythe/cxx/extractor/BUILD file load()s the llvm BUILD
# file. The error looks like:
#
# ERROR: /home/justin/.cache/bazel/_bazel_justin/9739324307232adeb4820707e35a9597/external/io_kythe/third_party/llvm/BUILD:88:1: Traceback (most recent call last):
# File "/home/justin/.cache/bazel/_bazel_justin/9739324307232adeb4820707e35a9597/external/io_kythe/third_party/llvm/BUILD", line 88
# cc_resources(name = "clang_builtin_headers_re...", ..."]))
# File "/home/justin/.cache/bazel/_bazel_justin/9739324307232adeb4820707e35a9597/external/io_kythe/tools/build_rules/cc_resources.bzl", line 11, in cc_resources
# fail(("Empty `data` attribute in `%s`...))
# Empty `data` attribute in `clang_builtin_headers_resources`
# ERROR: /home/justin/.cache/bazel/_bazel_justin/9739324307232adeb4820707e35a9597/external/io_kythe/third_party/llvm/BUILD:21:1: Target '@io_kythe//third_party/llvm:llvm/build/lib/libclangFormat.a' contains an error and its package is in error and referenced by '@io_kythe//third_party/llvm:llvm'
cc_binary(
name = "this_doesnt",
srcs = ["main.cc"],
deps = ["@io_kythe//kythe/cxx/extractor:lib"],
)
#include <iostream>
int main(int argc, char **argv) {
std::cout << "Hello world" << std::endl;
return 0;
}
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
git_repository(
name = "io_kythe",
commit = "9474b21c8f6685575a5690ad341bb8c965f72589",
remote = "https://github.com/kythe/kythe",
)
load("@io_kythe//:setup.bzl", "kythe_rule_repositories")
kythe_rule_repositories()
load("@io_kythe//:external.bzl", "kythe_dependencies")
kythe_dependencies()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment