Friction building for iOS on fresh Sonoma install
- Dominant language
- Python
- Stars
- 3.3k
- Forks
- 549
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 40
Description
### Describe the bug
I set up a brand new VM for macOS Sonoma today and `briefcase build iOS` hit a few issues.
To start, Briefcase did detect the need to run `xcode-select`.
From there, `setuptools_scm` got in front of Briefcase to tell the user to run `sudo xcodebuild -license`:
```
❯ briefcase run ios
[01/23/24 17:44:57] ERROR Command 'git' returned non-zero. This is stderr: _run_cmd.py:185
ERROR You have not agreed to the Xcode license agreements. Please run 'sudo xcodebuild -license' from within a Terminal window to _run_cmd.py:186
review and agree to the Xcode and Apple SDKs license.
ERROR command git not found while parsing the scm, using fallbacks _get_version_impl.py:41
Traceback (most recent call last):
File "/Users/user/.pyenv/versions/briefcase-3.12/lib/python3.12/site-packages/setuptools_scm/_get_version_impl.py",
line 35, in parse_scm_version
return _entrypoints.version_from_entrypoint(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/.pyenv/versions/briefcase-3.12/lib/python3.12/site-packages/setuptools_scm/_entrypoints.py", line
55, in version_from_entrypoint
maybe_version: version.ScmVersion | None = fn(root, config=config)
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/.pyenv/versions/briefcase-3.12/lib/python3.12/site-packages/setuptools_scm/git.py", line 208, in
parse
_require_command("git")
File "/Users/user/.pyenv/versions/briefcase-3.12/lib/python3.12/site-packages/setuptools_scm/_run_cmd.py", line 207,
in require_command
raise CommandNotFoundError(name)
setuptools_scm._run_cmd.CommandNotFoundError: git
Use of Xcode and the iOS developer tools are covered by a license that must be
accepted before you can use those tools.
You can accept these licenses by starting Xcode and clicking "Accept"; or, you
can run this command and accept the license when prompted:
$ sudo xcodebuild -license
Briefcase will try to run this command now. You will need to enter your
password (Briefcase will not store this password anywhere).
You have not agreed to the Xcode and Apple SDKs license. You must agree to the license below in order to use Xcode.
Press enter to display the license:
```
I'm not too worried about this since most users won't have `setuptools_scm` installed but the output definitely caught me off-guard.
After accepting the license, the build starts but fails here:
```
[helloworld] Building Xcode project...
2024-01-23 17:46:13.634 xcodebuild[2284:15945] [MT] DVTPlugInLoading: Failed to load code for plug-in com.apple.dt.IDESimulatorAvailability (/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin), error = Error Domain=NSCocoaErrorDomain Code=3588 "dlopen(/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin/Contents/MacOS/IDESimulatorAvailability, 0x0109): Library not loaded: /Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/CoreSimulator
Referenced from: <9C6D5AD4-D311-3F49-BCF3-1159133EB0A9> /Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin/Contents/MacOS/IDESimulatorAvailability
Reason: tried: '/Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/CoreSimulator' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/CoreSimulator' (no such file), '/Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/CoreSimulator' (no such file)" UserInfo={NSLocalizedFailureReason=The bundle couldn’t be loaded., NSLocalizedRecoverySuggestion=Try reinstalling the bundle., NSFilePath=/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin/Contents/MacOS/IDESimulatorAvailability, NSDebugDescription=dlopen(/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin/Contents/MacOS/IDESimulatorAvailability, 0x0109): Library not loaded: /Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/CoreSimulator
Referenced from: <9C6D5AD4-D311-3F49-BCF3-1159133EB0A9> /Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin/Contents/MacOS/IDESimulatorAvailability
Reason: tried: '/Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/CoreSimulator' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/CoreSimulator' (no such file), '/Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/CoreSimulator' (no such file), NSBundlePath=/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin, NSLocalizedDescription=The bundle “IDESimulatorAvailability” couldn’t be loaded.}, dyldError = dlopen(/Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin/Contents/MacOS/IDESimulatorAvailability, 0x0000): Library not loaded: /Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/CoreSimulator
Referenced from: <9C6D5AD4-D311-3F49-BCF3-1159133EB0A9> /Applications/Xcode.app/Contents/PlugIns/IDESimulatorAvailability.ideplugin/Contents/MacOS/IDESimulatorAvailability
Reason: tried: '/Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/CoreSimulator' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/CoreSimulator' (no such file), '/Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/CoreSimulator' (no such file)
A required plugin failed to load. Please ensure system content is up-to-date — try running 'xcodebuild -runFirstLaunch'.
Building...
Unable to build app helloworld.
```
After running `xcodebuild -runFirstLaunch`, I attempt the build again but it fails again:
```
[helloworld] Building Xcode project...
>>> Running Command:
>>> xcodebuild build -project '/Users/user/tmp/beeware/helloworld/build/helloworld/ios/xcode/Hello World.xcodeproj' -destination 'platform="iOS Simulator"' -configuration Debug -arch x86_64 -sdk iphonesimulator -quiet
>>> Working Directory:
>>> /Users/user/tmp/beeware/helloworld
/* com.apple.ibtool.errors */
/Users/user/tmp/beeware/helloworld/build/helloworld/ios/xcode/HelloWorld/Launch Screen.storyboard: error: iOS 17.2 Platform Not Installed.
note: Run script build phase 'Sign Python Binary Modules' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Hello World' from project 'Hello World')
note: Run script build phase 'Purge Python Binary Modules for Non-Target Platforms' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Hello World' from project 'Hello World')
** BUILD FAILED **
>>> Return code: 65
Building...
Unable to build app helloworld.
```
This error is much more ambiguous....but I eventually figure out I need to run `xcodebuild -downloadPlatform iOS`.
```
❯ xcodebuild -downloadPlatform iOS
Downloading iOS 17.2 Simulator (21C62): Done.
```
### Steps to reproduce
Run `briefcase build iOS` on a fresh macOS install.
### Expected behavior
Given the current attempts by Briefcase to provide meaningful feedback to help users get to a working state, Briefcase should run these commands for the user or ask the user to run them.
### Screenshots
_No response_
### Environment
- Operating System: Sonoma
- Python version: 3.12.1
- Software versions:
- Briefcase: `0.3.17.dev236+g7d8fd58e`
### Logs
[briefcase.2024_01_23-17_47_18.build.log](https://github.com/beeware/briefcase/files/14030682/briefcase.2024_01_23-17_47_18.build.log)
[briefcase.2024_01_23-17_50_14.build.log](https://github.com/beeware/briefcase/files/14030683/briefcase.2024_01_23-17_50_14.build.log)
[briefcase.2024_01_23-17_47_04.run.log](https://github.com/beeware/briefcase/files/14030679/briefcase.2024_01_23-17_47_04.run.log)
### Additional context
_No response_
Contributor guide
Research direction
Start by reproducing `briefcase build iOS` on a fresh Sonoma installation and compare the reported `xcode-select`, Xcode license, `xcodebuild -runFirstLaunch`, and `xcodebuild -downloadPlatform iOS` steps. Trace the iOS build entry point to determine where these prerequisite failures surface; done means users are guided to run or approve the required commands before the build fails ambiguously.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100