Skip to content

Remove layering_check feature on darwin#17763

Closed
keith wants to merge 1 commit intobazelbuild:masterfrom
keith:ks/remove-layering_check-feature-on-darwin
Closed

Remove layering_check feature on darwin#17763
keith wants to merge 1 commit intobazelbuild:masterfrom
keith:ks/remove-layering_check-feature-on-darwin

Conversation

@keith
Copy link
Copy Markdown
Member

@keith keith commented Mar 13, 2023

Using this feature isn't supported by the Xcode based toolchain on macOS, and generating a modulemap for the entire macOS SDK takes a huge amount of time. This disables this feature on macOS until there's a better solution to those performance issues.

Fixes #16619 (comment)

@keith
Copy link
Copy Markdown
Member Author

keith commented Mar 13, 2023

cc @meteorcloudy @hlopko

Maybe we want to go a different path here, like gating this behind an env var or something? It feels a bit weird to just remove this but I imagine since it hasn't ever been in the default Xcode toolchain there aren't many macOS users of this today. This never hit CI because previously CI only tested the Xcode toolchain until it was removed

@ShreeM01 ShreeM01 added team-Rules-CPP Issues for C++ rules awaiting-review PR is awaiting review from an assigned reviewer labels Mar 13, 2023
@googlewalt
Copy link
Copy Markdown
Contributor

Instead of listing each header in the module_map can we use umbrella directory? Something like:

module "crosstool" [system] {
  export *
  module "system_path_A" {
    export *
    umbrella "<system_path_A>"
  }
  module "system_path_B" {
    export *
    umbrella "<system_path_B>"
  }
  ...
}

And add "-Wno-incomplete-umbrella" to the flags when layering_check is enabled. That's the setup we have internally for Apple, to avoid needing to scan SDKs.

@oquenchil oquenchil removed their request for review March 14, 2023 11:12
@oquenchil oquenchil self-assigned this Mar 14, 2023
@keith
Copy link
Copy Markdown
Member Author

keith commented Mar 14, 2023

@googlewalt could you share the script you use for that 🙃

@googlewalt
Copy link
Copy Markdown
Contributor

I don't have a script. We just have a static copy of a system module map that uses umbrella directory(s) to cover paths to all the system headers. But it shouldn't be too hard to modify generate_system_module_map.sh to generate something like that.

@meteorcloudy
Copy link
Copy Markdown
Member

FYI, #16619 was rollbacked at a50cca5

Using this feature isn't supported by the Xcode based toolchain on
macOS, and generating a modulemap for the entire macOS SDK takes a huge
amount of time. This disables this feature on macOS until there's a
better solution to those performance issues.

Fixes bazelbuild#16619 (comment)
@keith keith force-pushed the ks/remove-layering_check-feature-on-darwin branch from fc17c60 to 635d33a Compare March 22, 2023 17:22
@github-actions github-actions bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Mar 22, 2023
@keith
Copy link
Copy Markdown
Member Author

keith commented Mar 22, 2023

hoping this works instead #17857

treat_warnings_as_errors_feature,
archive_param_file_feature,
] + layering_check_features(ctx.attr.compiler)
]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It looks like this code defines the layering_check feature but does not enable it. Do you know where the feature is actually enabled? One option is to find where the feature is enabled and disabled it there. However, I see that this code does enable the module_maps feature which does have overhead and is not useful without layering check, so perhaps this is ok.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't see off hand where it gets enabled 🤔 but i guess the question is do we want folks to be able to enable it at all right now on macOS even if it was opt in? I haven't ever tested this externally on any platform so I'm not sure how well it works as is

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ideally it would be nice to leave the feature in that state: disabled but functional. We do have it enabled internally by default, but we had to individually opt out lots of rules and packages.

It is unsettling that we don't know how this gets enabled, but I don't have time to hunt that down right now. I'll approve it but make a note that we might want to revisit this in the future.

@meteorcloudy meteorcloudy requested a review from oquenchil May 15, 2023 08:47
@meteorcloudy meteorcloudy added awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally and removed awaiting-review PR is awaiting review from an assigned reviewer labels May 15, 2023
@sgowroji sgowroji removed the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label May 15, 2023
fweikert pushed a commit to fweikert/bazel that referenced this pull request May 25, 2023
Using this feature isn't supported by the Xcode based toolchain on macOS, and generating a modulemap for the entire macOS SDK takes a huge amount of time. This disables this feature on macOS until there's a better solution to those performance issues.

Fixes bazelbuild#16619 (comment)

Closes bazelbuild#17763.

PiperOrigin-RevId: 532080490
Change-Id: I96b77eff884fa965ed20084b90b1e0af5b80b082
@keith keith deleted the ks/remove-layering_check-feature-on-darwin branch June 13, 2023 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team-Rules-CPP Issues for C++ rules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants