Skip to content

Solution for building without sandbox and EXT_BUILD_DEPS containing files from building this same target for other (host, other target) configuration#321

Merged
irengrig merged 1 commit intobazel-contrib:masterfrom
irengrig:fix-no-sandbox
Sep 26, 2019
Merged

Solution for building without sandbox and EXT_BUILD_DEPS containing files from building this same target for other (host, other target) configuration#321
irengrig merged 1 commit intobazel-contrib:masterfrom
irengrig:fix-no-sandbox

Conversation

@irengrig
Copy link
Copy Markdown
Contributor

When executed without sandbox, target- and host- configured targets are created in the same execution root with the same names.
Apparently, it is not the problem for build outputs, but deps directory that is created by script.
What is even more problematic is that this directory can be accessed while building this target in parallel for different configurations. So even if we clean it before using, we might break the build of the parallel target.

Solution: create temp directory to be used as deps directory.
(Additionally, this demonstrates the benefits of sandboxed execution.)

How to execute without sandbox:
bazel build/test --spawn_strategy=standalone

How to reproduce the problem:
For instance, have the results of cmake_external/configure_make be consumed by genrule in tools attribute.
Tools attribute of the genrule is expecting the passed label to exist/ be built for the host configuration.
This way, if you build genrule using your cmake_external target and this cmake_external target with the same command, cmake_external target will be built two times - for host and target.

…re created in the same execution root with the same names.

Apparently, it is not the problem for build outputs, but deps directory that is created by script.
What is even more problematic is that this directory can be accessed while building this target in parallel for different configurations. So even if we clean it before using, we might break the build of the parallel target.

Solution: create temp directory to be used as deps directory.
(Additionally, this demonstrates the benefits of sandboxed execution.)
@irengrig irengrig requested a review from jin September 26, 2019 16:25
Copy link
Copy Markdown
Collaborator

@jin jin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM and great catch, thanks for the clear explanation in the PR description.

@irengrig irengrig merged commit 7bc4be7 into bazel-contrib:master Sep 26, 2019
@irengrig
Copy link
Copy Markdown
Contributor Author

Thank you for the quick turnaround!

lizan pushed a commit to envoyproxy/envoy that referenced this pull request Sep 26, 2019
Update rules_foreign_cc to include bazel-contrib/rules_foreign_cc#321
This allows curl to be built with Envoy's libraries for dependencies (c-ares, zlib, ssl) without sandboxing.

Testing: OSS-Fuzz builds pointed to this branch

Signed-off-by: Asra Ali <asraa@google.com>
danzh2010 pushed a commit to danzh2010/envoy that referenced this pull request Oct 4, 2019
Update rules_foreign_cc to include bazel-contrib/rules_foreign_cc#321
This allows curl to be built with Envoy's libraries for dependencies (c-ares, zlib, ssl) without sandboxing.

Testing: OSS-Fuzz builds pointed to this branch

Signed-off-by: Asra Ali <asraa@google.com>
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 this pull request may close these issues.

2 participants