Skip to content
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

sccache doesn't support clang-cl on non-Windows #669

Closed
glandium opened this issue Feb 20, 2020 · 1 comment
Closed

sccache doesn't support clang-cl on non-Windows #669

glandium opened this issue Feb 20, 2020 · 1 comment

Comments

@glandium
Copy link
Collaborator

@glandium glandium commented Feb 20, 2020

This code:

// First convert all `/foo` arguments to `-foo` to accept both styles
let it = arguments.iter().map(|i| {
if let Some(arg) = i.split_prefix("/") {
let mut dash = OsString::from("-");
dash.push(&arg);
dash
} else {
i.clone()
}
});

unconditionally transforms all arguments starting with a / to start with a -, which is fine for both MSVC and clang-cl when they run on Windows, but breaks things when running clang-cl on e.g. Linux.

@glandium

This comment has been minimized.

Copy link
Collaborator Author

@glandium glandium commented Feb 20, 2020

To make matters more interesting... clang-cl on Linux actually supports / arguments too, so we can't technically brush away things that start with a / as being paths.

glandium added a commit to glandium/sccache that referenced this issue Feb 27, 2020
34c6f9a added support for /arg flags by replacing the initial slash with
a -, and falling back to normal argument parsing. Unfortunately, when
running clang-cl on a non-Windows system, that means absolute paths get
garbled, and that can lead to bad argument parsing with separate
arguments (e.g. -I /absolute/path).

We change the arguments definition for MSVC to include both styles, by
hacking up a macro that generates two lists, one with - arguments, and
one with / arguments. Merging the two lists at build time doesn't seem
possible without going full procedural macro.

Fixes mozilla#669
glandium added a commit that referenced this issue Feb 28, 2020
34c6f9a added support for /arg flags by replacing the initial slash with
a -, and falling back to normal argument parsing. Unfortunately, when
running clang-cl on a non-Windows system, that means absolute paths get
garbled, and that can lead to bad argument parsing with separate
arguments (e.g. -I /absolute/path).

We change the arguments definition for MSVC to include both styles, by
hacking up a macro that generates two lists, one with - arguments, and
one with / arguments. Merging the two lists at build time doesn't seem
possible without going full procedural macro.

Fixes #669
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

1 participant
You can’t perform that action at this time.