Skip to content

Building macOS from Xcode doesn't redirect all build output #32494

Closed

Description

@stuartmorgan-g

Overriding just SYMROOT (or even SYMROOT+OBJROOT) isn't enough to give the same behavior as xcodebuild invocation with -derivedDataPath. The result is that dependent projects end up with build output in weird locations (build folders relative to their projects), and dependencies on their outputs fail.

STR:

  • In FDE, flutter run in testbed once, then try to build from within Xcode
  • See build failures
  • Run git status and see unexpected folders

I'll see if I can find the right combination of things to override in current versions of Xcode to make all build output go where we want it (which has traditionally been quite a bit harder than it seems like it should be). If we can't do that, I think we should remove the SYMROOT line from Generated.xcconfig; that will mean that the build that's done in Xcode will be completely separate from the flutter build version, but internally consistent. Other than being inefficient if frequently switching between CLI and Xcode UI builds (which seems like an unlikely use case), I don't think that should be an issue.

/cc @jonahwilliams

Activity

  1. added
    tool
    platform-macos
    a: desktop
    on May 10, 2019
  2. added a commit that references this issue on May 11, 2019
    84ef8fa
  3. stuartmorgan-g commented on May 11, 2019

    @stuartmorgan-g
    ContributorAuthor

    I couldn't find a viable solution for getting all build output for both the project and all sub-projects into one location using in-UI overrides (unlike xcodebuild), so I opted for removing SYMROOT. If we eventually find a compelling need to set that for macOS, we can revisit how to handle building from Xcode.

    Documenting this for posterity, both because it might hit some people who have used example or testbed before, and because it took me far too long to figure out what was going on and made me think I might be going crazy at one point, so maybe this will help someone hitting this problem in a different context searching the internet for clues:

    • Recent versions of Xcode (at least 10.x; not sure about 9) have a new concept called "Per-User Project Settings". It used to be the case that there was only an Xcode-level user setting for build output locations, and if you hadn't explicitly changed that, it would do whatever was in the Xcode project; now, however, there's a version of that that's per project.
    • By default it uses the setting called "Xcode Default", which uses the ~/Library/.../DerivedData/... output directory for the project and all sub-projects.
    • If you build a project that has a SYMROOT override (I assume OBJROOT would do it as well, and maybe others), it will silently and automatically change that setting to "Legacy", which uses a build folder next to each Xcode project by default. Anything not overridden (e.g., subprojects) will start using that.
    • This setting is sticky. So if you have ever built that project with a SYMROOT override, that project will, for you, stay in Legacy mode, even if you remove the override again. This means it will have different build behavior than the exact same project had with the exact same settings before adding SYMROOT.

    I haven't figured out where this setting is stored (not xcuserdata or Xcode's preferences file in Preferences as far as I can tell), nor am I entirely confident how it's tracked (renaming the project doesn't reset it, but it did seem to follow copies). You can manually change it back to "Xcode Default" from File > Project Settings... > Advanced.... The downside is that setting it back (rather than finding where it's stored and clearing it) seems to itself be sticky, in that if you add SYMROOT overrides later they will be ignored rather than triggering a change back to Legacy.

  4. added a commit that references this issue on May 12, 2019
    710a0cb
  5. github-actions commented on Aug 30, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  6. locked as resolved and limited conversation to collaborators on Aug 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

a: desktopplatform-macostool

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions