Skip to content

Conversation

keiichiw
Copy link
Contributor

The can_compile function in build.rs previously invoked rustc with -o -, which causes rustc to attempt to create a temporary metadata directory in the current working directory.

When building this in another build system such as Portage, this happens in a sandbox where the current working directory is not writeable, resulting in a sandbox access violation.

This change modifies the can_compile function to use a temporary directory for the output file. This forces rustc to create the temporary file in a writeable location, avoiding the sandbox issue.

The can_compile function in build.rs previously invoked rustc with
-o -, which causes rustc to attempt to create a temporary metadata
directory in the current working directory.

When building with Portage for ChromeOS, this happens in a sandbox where
the current working directory is not writeable, resulting in a sandbox
access violation.

This change modifies the can_compile function to use a temporary
directory for the output file. This forces rustc to create the temporary
file in a writeable location, avoiding the sandbox issue.
@sunfishcode sunfishcode merged commit fae4d47 into bytecodealliance:main Aug 22, 2025
49 of 51 checks passed
@sunfishcode
Copy link
Member

Thanks!

@keiichiw keiichiw deleted the build-rs-tmpdir branch August 22, 2025 21:12
@sunfishcode
Copy link
Member

This is now released in rustix 1.1.1.

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