@@ -63,9 +63,11 @@ func platformOS(platform string) string {
63
63
case "macos" , "maccatalyst" :
64
64
// For "maccatalyst", Go packages should be built with GOOS=darwin,
65
65
// not GOOS=ios, since the underlying OS (and kernel, runtime) is macOS.
66
+ // But, using GOOS=darwin with build-tag ios leads to corrupt builds: https://go.dev/issue/52299
67
+ // => So we use GOOS=ios for now.
66
68
// We also apply a "macos" or "maccatalyst" build tag, respectively.
67
69
// See below for additional context.
68
- return "darwin "
70
+ return "ios "
69
71
default :
70
72
panic (fmt .Sprintf ("unexpected platform: %s" , platform ))
71
73
}
@@ -82,17 +84,17 @@ func platformTags(platform string) []string {
82
84
case "maccatalyst" :
83
85
// Mac Catalyst is a subset of iOS APIs made available on macOS
84
86
// designed to ease porting apps developed for iPad to macOS.
85
- // See https://developer.apple.com/mac-catalyst/.
86
- // Because of this, when building a Go package targeting maccatalyst,
87
- // GOOS=darwin (not ios). To bridge the gap and enable maccatalyst
88
- // packages to be compiled, we also specify the "ios" build tag.
87
+ // See
88
+ // https://developer.apple.com/mac-catalyst/.
89
+ // https://stackoverflow.com/questions/12132933/preprocessor-macro-for-os-x-targets/49560690#49560690
90
+ //
91
+ // Historically gomobile used GOOS=darwin with build tag ios when
92
+ // targeting Mac Catalyst. However, this configuration is not officially
93
+ // supported and leads to corrupt builds after go1.18: https://go.dev/issues/52299
94
+ // Use GOOS=ios.
89
95
// To help discriminate between darwin, ios, macos, and maccatalyst
90
96
// targets, there is also a "maccatalyst" tag.
91
- // Some additional context on this can be found here:
92
- // https://stackoverflow.com/questions/12132933/preprocessor-macro-for-os-x-targets/49560690#49560690
93
- // TODO(ydnar): remove tag "ios" when cgo supports Catalyst
94
- // See golang.org/issues/47228
95
- return []string {"ios" , "macos" , "maccatalyst" }
97
+ return []string {"macos" , "maccatalyst" }
96
98
default :
97
99
panic (fmt .Sprintf ("unexpected platform: %s" , platform ))
98
100
}
@@ -217,17 +219,11 @@ func envInit() (err error) {
217
219
cflags += " -mios-simulator-version-min=" + buildIOSVersion
218
220
cflags += " -fembed-bitcode"
219
221
case "maccatalyst" :
220
- // Mac Catalyst is a subset of iOS APIs made available on macOS
221
- // designed to ease porting apps developed for iPad to macOS.
222
- // See https://developer.apple.com/mac-catalyst/.
223
- // Because of this, when building a Go package targeting maccatalyst,
224
- // GOOS=darwin (not ios). To bridge the gap and enable maccatalyst
225
- // packages to be compiled, we also specify the "ios" build tag.
226
- // To help discriminate between darwin, ios, macos, and maccatalyst
227
- // targets, there is also a "maccatalyst" tag.
228
- // Some additional context on this can be found here:
229
- // https://stackoverflow.com/questions/12132933/preprocessor-macro-for-os-x-targets/49560690#49560690
230
- goos = "darwin"
222
+ // See the comment about maccatalyst's GOOS, build tags configuration
223
+ // in platformOS and platformTags.
224
+ // Using GOOS=darwin with build-tag ios leads to corrupt builds: https://go.dev/issue/52299
225
+ // => So we use GOOS=ios for now.
226
+ goos = "ios"
231
227
sdk = "macosx"
232
228
clang , cflags , err = envClang (sdk )
233
229
// TODO(ydnar): the following 3 lines MAY be needed to compile
0 commit comments