如何在bazel中运行第三方二进制文件

时间:2017-11-12 20:37:56

标签: bazel

我是Bazel的新手,我试图在我的bazel构建中使用thrift 10,我需要运行thrift二进制来生成thrift文件。但是我在我的linux盒子里有一个相互冲突的thrift版本,并且在构建时使用了错误的版本。

有人可以帮我解决这个问题吗?请记住我有thrift.bzl生成节俭生成的文件..

这是当前的第三方定义

```

cc_library(
    name = "thrift",
    srcs = [
        "lib/libthrift.a",
        "lib/libthrift.so",
        "lib/libthrift.so.0.10.0",
        "lib/libthriftc.a",
        "lib/libthriftc.so",
        "lib/libthriftc.so.0.10.0",
        "lib/libthriftz.a",
    ],
    hdrs = glob(["include/**/*.h"]),
    includes = ["include"],
    linkshared = 0,
    tags = make_symlink_tags([
        "lib/libthrift.a",
        "lib/libthriftc.a",
        "lib/libthriftz.a",
        "lib/libthrift.so",
        "lib/libthriftc.so",
        "lib/libthrift.so.0.10.0",
        "lib/libthriftc.so.0.10.0",
        "lib/libthriftz.so.0.10.0",
    ]),
    visibility = ["//visibility:public"],
    deps = ["@boost_repo//:boost"],
)

filegroup(
    name = "thrift_gen",
    srcs = ["@thrift_repo//:bin/thrift"],
    visibility = ["//visibility:public"],
)

```

thrift.bzl

```

_generate_thrift_cc_lib = rule(
    attrs = {
        "src": attr.label(
            allow_files = True,  # FileType(["*.thrift"]),
            single_file = True,
        ),
        "thrifts": attr.label_list(
            allow_files = True,  # FileType(["*.thrift"]),
        ),
        "base_name": attr.string(),
        "service_name": attr.string(),
        "service": attr.bool(),
        "gen": attr.string(default = "cpp"),
        "_thrift": attr.label(
            default = Label("@thrift_repo//:thrift_gen"),
            executable = True,
            cfg = "host",
        ),
    },
    output_to_genfiles = True,
    outputs = _genthrift_outputs,
    implementation = _generate_thrift_lib,
)

```

这是错误

```
INFO: Found 11 targets...
ERROR: ...source/mlp/storage/services/thrift/BUILD:10:1: Generating mlp/storage/services/thrift/umm_geometry_constants.cpp failed (Exit 127).
external/thrift_repo/bin/thrift: error while loading shared libraries: libthriftc.so.0.10.0: cannot open shared object file: No such file or directory
```

0 个答案:

没有答案