Skip to content

Conversation

@tronical
Copy link

@tronical tronical commented Jan 5, 2025

When building Rust applications with Bazel instead of cargo, typically a sandbox is in place, where each process invocation (rustc, build.rs program, etc.) runs in its own "root", where the view on the filesystem is the same, but the absolute paths are different. As a consequence, CARGO_MANIFEST_DIR differs between the invocation of build.rs and rustc.

That means that absolute paths in the generated webgl_exts.rs don't work. Fortunately, the source files are relative to the CARGO_MANIFEST_DIR, which, while changing between invocations, remains valid.

When building Rust applications with Bazel instead of cargo, typically a
sandbox is in place, where each process invocation (rustc, build.rs
program, etc.) runs in its own "root", where the view on the filesystem
is the same, but the absolute paths are different. As a consequence,
CARGO_MANIFEST_DIR differs between the invocation of build.rs and rustc.

That means that absolute paths in the generated webgl_exts.rs don't
work. Fortunately, the source files are relative to the
CARGO_MANIFEST_DIR, which, while changing between invocations, remains
valid.
tronical added a commit to slint-ui/slint that referenced this pull request Jan 5, 2025
Use relative paths to CARGO_MANIFEST_DIR in build.rs. Patch is
also submitted upstream at rust-windowing/gl-rs#549
@MarijnS95 MarijnS95 force-pushed the master branch 3 times, most recently from 69d0fb1 to a4140fe Compare August 8, 2025 19:38
@MarijnS95 MarijnS95 closed this in cd18716 Aug 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant