Skip to content

Default --//:feature_acl=off #2434

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
lalten opened this issue Mar 14, 2025 · 6 comments · May be fixed by #2436
Open

Default --//:feature_acl=off #2434

lalten opened this issue Mar 14, 2025 · 6 comments · May be fixed by #2436

Comments

@lalten
Copy link
Contributor

lalten commented Mar 14, 2025

Brief feature description

The iceoryx Bazel build expects libacl to be available from the host on linux systems.
This assumption does not always hold and breaks hermeticity.

This line should default to off instead of auto (or, default to off and remove auto):

build_setting_default = "auto",

This is already done in the iceoryx BCR module: https://github.com/bazelbuild/bazel-central-registry/blob/main/modules/iceoryx/2.95.3.bcr.1/patches/build.patch and it would be better to just upstream this patch.

lalten added a commit to lalten/iceoryx that referenced this issue Mar 14, 2025
@lalten lalten linked a pull request Mar 14, 2025 that will close this issue
21 tasks
@elBoberido
Copy link
Member

Actually, we want to have ACL enabled by default on systems that supports ACL and deactivated on systems that do not support it. Why does it break hermeticity? It's just another dependency?

@lalten
Copy link
Contributor Author

lalten commented Mar 14, 2025

Actually, we want to have ACL enabled by default on systems that supports ACL and deactivated on systems that do not support it. Why does it break hermeticity? It's just another dependency?

To have a hermetic build you need to provide a hermetic acl dependency. Just adding -lacl is not hermetic, it just takes whatever acl is available on whatever host the build happens to run on - if it is even available: acl isn't installed by default in every linux.

If there was an acl Bzlmod or WORKSPACE version available iceoryx could depend on that and just always enable the acl feature. I don't know that this exists though.

@elBoberido
Copy link
Member

Keep in mind, I'm not that familiar with bazel, so this questions might sound stupid.

How can a build be hermetic if the hermetic environment can have dependencies that are not specified in the build system? This kind of sounds like a flaw in bazel?

Anyway, I'm not strictly against this. I just want to understand the reasoning and explore if there are other options which do not risk to have silent breakage on users who already depend on the default behavior of v2.95. That was the main reason to have the auto flag in the first place, since the bazel support was added to the main branch years ago and the ACL feature flag only a few months ago.

So, just for fun. Let's assume we would like to keep the default for Linux for all users to depend on libacl, what would be necessary to make the build hermetic?

@lalten
Copy link
Contributor Author

lalten commented Mar 14, 2025

There are no stupid questions :)
Bazel makes it possible to have fully hermetic builds. It doesn't mean that anything you do is automatically hermetic.

For example many people use new_local_repository() to pull in pre-built system-installed OpenCV as that is exceptionally hard to build from source. At that point you have a build that works but requires you to have OpenCV installed on the system. Bazel doesn't install OpenCV for you and you must ensure you have the correct version with other means. This is not a hermetic build.

There are rulesets like the https://github.com/shabanzd/debian_dependency_bazelizer which lets you depend on pre-built binary distributions. This avoids some of that hassle and is more hermetic. You do want to stop traversing transitive dependencies at some point so you don't pull in glibc and end up with an unportable binary. Another downside is that you lose cross build / cross platform capability.

A fully hermetic build is definitely possible (and desirable). There are fully hermetic compiler toolchains (e.g. https://github.com/bazel-contrib/toolchains_llvm) and libraries pulled from the BCR are generally hermetic. This lets you have fully deterministic builds that will produce the same result byte for byte on any machine.

@lalten
Copy link
Contributor Author

lalten commented Mar 14, 2025

So, just for fun. Let's assume we would like to keep the default for Linux for all users to depend on libacl, what would be necessary to make the build hermetic?

Someone would need to create a libacl BCR module for Bzlmod builds and a libacl.BUILD for Workspace builds. Both entail translating https://github.com/philips/acl/blob/master/libacl/Makefile (*) to a (set of) cc_library in a BUILD file.

This is entirely possible, and people create new BCR modules for C libraries every day (https://github.com/bazelbuild/bazel-central-registry/pulls?q=is%3Apr+is%3Aclosed)

The catch is that you will need to "Bazelize" any dependencies that libacl has first so that it can depend on them.

*) this seems to be some very old copy. the current one is at https://git.savannah.nongnu.org/cgit/acl.git/tree/ / https://download-mirror.savannah.gnu.org/releases/acl/acl-2.3.2.tar.xz.

@gpalmer-latai
Copy link

Yeah FWIW we deal with this problem by patching in our own libacl dependency when fetching the repository. A bit messy. I'd be happy about removing that patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants