没有使用bazel make创建输出'external/name/x/lib/lib.so' [英] output 'external/name/x/lib/lib.so' was not created using bazel make
问题描述
我试图遵循提供的示例,使用bazel 发布以在特使中构建外部程序包.在WORKSPACE文件中,我添加了以下内容:
I was trying to follow the example provided by Building Makefile using bazel post to build an external package in envoy. In the WORKSPACE file I added the following:
new_git_repository(
name = "name",
remote = "remote.git",
build_file = "//foo/bazel/external:x.BUILD",
)
并且foo/bazel/external/x.BUILD具有以下内容:
And foo/bazel/external/x.BUILD has the following contents:
load("@rules_foreign_cc//tools/build_defs:make.bzl", "make")
filegroup(
name = "m_srcs",
srcs = glob(["code/**"]),
)
make(
name = "foo_bar",
make_commands = ["make lib"],
lib_source = ":m_srcs",
shared_libraries = ["lib.so"],
)
,然后将foo/bazel/BUILD中的可见性设置为package(default_visibility = ["//visibility:public"])
and I set the visibility in foo/bazel/BUILD as package(default_visibility = ["//visibility:public"])
在执行bazel build -s @name//:foo_bar
时,我收到未创建external/name/x/lib/lib.so
的错误.
On executing bazel build -s @name//:foo_bar
, I get the error that external/name/x/lib/lib.so
was not created.
我检查了bazel-bin/external/name/x/logs/GNUMake.log
并成功完成.我看到BUILD_TMPDIR
目录已创建lib.so.我认为它应该已经复制到EXT_BUILD_DEPS/lib,但是我不确定为什么不复制它.将不胜感激调试该错误的任何提示.
I checked the bazel-bin/external/name/x/logs/GNUMake.log
and make completes successfully. I see that BUILD_TMPDIR
directory has created lib.so. I think it should have been copied to EXT_BUILD_DEPS/lib, but I am not sure why it was not copied. Would appreciate any tips to debug the error.
推荐答案
编辑的make命令可将lib手动复制到预期的文件夹-make_commands = ["make libs; cp lib.so $INSTALLDIR/lib/lib.so"]
Edited make command to manually copy the lib to expected folder - make_commands = ["make libs; cp lib.so $INSTALLDIR/lib/lib.so"]
这篇关于没有使用bazel make创建输出'external/name/x/lib/lib.so'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!