强迫Bazel _NOT_到静态嵌入的外部依赖关系?

发布于 2025-02-05 09:24:53 字数 448 浏览 1 评论 0原文

我正在调查Bazel来构建我的一些软件。不幸的是,我认为我遇到了一个令人难以置信的问题,那就是Bazel二进制文件无法打包去Debian之类的发行版。

问题在于,巴泽尔非常热衷于下载外部依赖性作为源代码,然后将其编译并将其链接到生成的二进制中。 Protobuf库就是一个例子。对于大多数Linux(和其他)分布而言,这是严格禁止的;合法包装的二进制文件需要链接到系统库,而不是嵌入自己的副本。

我怀疑这对此没有简单的修复,我只需要放弃巴泽尔,但是在不对劲的情况下,有人对此有所考虑:有一个吗?我认为这将需要类似于防止某些外部依赖项的能力,而是用本地占位符副本代替它们。例如,对于Protobuf情况,我需要确保以某种方式告诉Bazel,任何尝试下载COM_GITHUB_PROTOCOLBUFFERS_PROTOBUF的尝试都应该使用我制作的本地版本,该版本使用了系统库。当然,这也需要告诉巴泽尔忽略哈希,这太可怕了...

I'm investigating the use of bazel to build some of my software. Unfortunately, I think I've come across a show-stopping issue, which is that bazel binaries can't be packaged for distributions like Debian.

The issue is that bazel is very keen on downloading external dependencies as source code and then compiling and linking them into the resulting binary. The protobuf libraries are an example of this. This is strictly forbidden for most Linux (and other) distributions; legally packaged binaries need to link to the system libraries rather than embedding their own copies.

I suspect there's no easy fix for this and that I'll just have to give up on bazel, but on the off-chance that anyone's thought about this: is there one? I think this would need something like the ability to prevent certain external dependencies being fetched, instead replacing them with local placeholder copies. For example, for the protobuf case I'd need to make sure that somehow tell bazel that any attempt to download com_github_protocolbuffers_protobuf should instead use a local version I had made which used the system library. Of course, this would also require telling bazel to ignore the hash, which is terrible...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文