MobileNativeFoundation / MobileNativeFoundation/rules_xcodeproj
Bug: `ProcessCcArgs` mis-processes arguments containing `-fdebug-prefix-map`
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 626
- Forks
- 124
- PR merge metrics
- No merged PRs in 30d
Description
Description
In ProcessCcArgs, when a -fdebug-prefix-map argument is detected, it is skipped, and the next argument is incorrectly also skipped. -fdebug-prefix-map does not take an additional argument, correct usage is something like -fdebug-prefix-map=a=b to map a to b. clang will not accept something like -fdebug-prefix-map a=b, so we should never skip the argument after -fdebug-prefix-map.
This will cause the arguments to get corrupted, in my case, an -iquote was getting skipped, causing the directory I included to be sent to the compiler as a compiler input file. This meant xcode got invalid command lines, making the "Indexing" step not succeed.
Reproduction steps
In a cc_library, add
copts = [
"-fdebug-prefix-map=a=b",
"-iquote",
".",
],
Then, bazel run //:xcodeproj, and open a source file in the modified library. The file will fail in the "Indexing" step since . will be passed as a compiler input (i.e., the iquote argument will not be provided to xcode)
Expected behavior
We expect -fdebug-prefix-m=a=b to be removed from the argument list, but no further arguments should be removed.
rules_xcodeproj version
8ba39d79ff79effb6c993ff0ac96e5cae4741095
Xcode version
15.4
Bazel version
7.2.1
rules_apple version
No response
rules_swift version
No response
Additional information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in tools/generators/target_build_settings/src/Generator/ProcessCcArgs.swift at the linked ProcessCcArgs code. Reproduce with the provided cc_library copts and run bazel run //:xcodeproj, then inspect the generated Xcode indexing command. Done means only the -fdebug-prefix-map entry is removed and the -iquote arguments remain intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100