admin管理员组文章数量:1404923
Is it possible to know about target platform constrains from-inside the transition implementation?
The problem comes from building a TensorFlow extension that apart from a few extra flags requires to transition to libstd
if built on Linux. The main codebase is built with libc++
via LLVM.
Generally, I try to modify this code to fit multi-platform build: .bzl
Originally, it was written only for Linux. And attempt to extend it for macOS met an issue of conditioning those libstd
lines on Linux only:
if (target_is_linux):
cxxopts.append("-stdlib=libstdc++")
linkopts.append("-stdlib=libstdc++")
What is the best way to approch it?
Bazel version: 7.5.0
Taking the transition is defined as inbound, I consider modifying the native_binary rule inside the [tf_custom_op_library
]((.bzl#L111)) macros to execute a select
on any of its attributes to resolve it before the transition invocation, and then access its value through atrs
.
Although it seems to be the only way I've found so far, I wonder, if there is a better way? Or should the whole thing be redesigned for a milti-OS use? Or is there a way to pass constraints into transition as inputs
?
本文标签: How to condition Bazel transition on target OSStack Overflow
版权声明:本文标题:How to condition Bazel transition on target OS? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744865783a2629336.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论