diff --git a/Make.config b/Make.config index 76fd9bc5e5f8..67ef71a53c75 100644 --- a/Make.config +++ b/Make.config @@ -47,10 +47,6 @@ XCODE_VERSION=11.0 XCODE_URL=http://xamarin-storage/bot-provisioning/xcodes/Xcode_11_GM_Seed_2.xip XCODE_DEVELOPER_ROOT=/Applications/Xcode11-GM2.app/Contents/Developer -XCODE94_VERSION=9.4 -XCODE94_URL=http://xamarin-storage/bot-provisioning/xcodes/Xcode_9.4.xip -XCODE94_DEVELOPER_ROOT=/Applications/Xcode94.app/Contents/Developer - # Mono version embedded in XI/XM (NEEDED_MONO_VERSION/BRANCH) are specified in mk/mono.mk include $(TOP)/mk/mono.mk MONO_HASH := $(NEEDED_MONO_VERSION) @@ -136,15 +132,11 @@ APPLETLS_DEFINES = -d:XAMARIN_APPLETLS endif XCODE_MAC_SDKROOT=$(XCODE_DEVELOPER_ROOT)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -XCODE94_MAC_SDKROOT=$(XCODE94_DEVELOPER_ROOT)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk # The MAC_* variables do not contain the -mmacosx-version-min flag on purpose: each usage must specify it separately. MAC_CC=$(CCACHE)$(XCODE_DEVELOPER_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot $(XCODE_MAC_SDKROOT) -stdlib=libc++ MAC_CXX=$(CCACHE)$(XCODE_DEVELOPER_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -isysroot $(XCODE_MAC_SDKROOT) -stdlib=libc++ -MAC32_CC=$(CCACHE)$(XCODE94_DEVELOPER_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot $(XCODE94_MAC_SDKROOT) -stdlib=libc++ -MAC32_CXX=$(CCACHE)$(XCODE94_DEVELOPER_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -isysroot $(XCODE94_MAC_SDKROOT) -stdlib=libc++ - MAC_INSTALL_VERSION ?= git IOS_INSTALL_VERSION ?= git diff --git a/builds/Makefile b/builds/Makefile index 84bef4fe5bcf..233785ac9af6 100644 --- a/builds/Makefile +++ b/builds/Makefile @@ -76,7 +76,7 @@ else # Configuration for the mono sdk makefiles # SDK_ARGS= \ - XCODE_DIR=$(XCODE_DEVELOPER_ROOT) XCODE32_DIR=$(XCODE94_DEVELOPER_ROOT) \ + XCODE_DIR=$(XCODE_DEVELOPER_ROOT) \ IOS_VERSION=$(IOS_SDK_VERSION) IOS_VERSION_MIN=$(MIN_IOS_SDK_VERSION) \ TVOS_VERSION=$(TVOS_SDK_VERSION) TVOS_VERSION_MIN=$(MIN_TVOS_SDK_VERSION) \ WATCHOS_VERSION=$(WATCH_SDK_VERSION) WATCHOS_VERSION_MIN=$(MIN_WATCHOS_SDK_VERSION) \ diff --git a/mk/mono.mk b/mk/mono.mk index 80cf16e1c155..3928969d646e 100644 --- a/mk/mono.mk +++ b/mk/mono.mk @@ -1,4 +1,4 @@ -NEEDED_MONO_VERSION := 29b1ac19c961b959a09097dbc0fe4cd567cc5298 +NEEDED_MONO_VERSION := 70d690305348cb30cf620db0679ba1173dc7adb0 NEEDED_MONO_BRANCH := 2019-08 MONO_DIRECTORY := mono diff --git a/runtime/Makefile b/runtime/Makefile index 59e0d7cefb4e..52b3bfcd05ff 100644 --- a/runtime/Makefile +++ b/runtime/Makefile @@ -418,8 +418,6 @@ MAC_ARCHITECTURES = x86_64 CLANG_ARCH = $(addprefix -arch ,$(MAC_ARCHITECTURES)) MAC_CLANG = DEVELOPER_DIR=$(XCODE_DEVELOPER_ROOT) $(MAC_CC) -mmacosx-version-min=$(MIN_OSX_SDK_VERSION) -MAC32_CLANG = DEVELOPER_DIR=$(XCODE94_DEVELOPER_ROOT) $(MAC32_CC) -mmacosx-version-min=$(MIN_OSX_SDK_VERSION) -MAC64_CLANG = DEVELOPER_DIR=$(XCODE_DEVELOPER_ROOT) $(MAC_CC) -mmacosx-version-min=$(MIN_OSX_SDK_VERSION) MAC_SHIPPED_HEADERS = xamarin/launch.h @@ -469,25 +467,25 @@ STATIC_LAUNCHER$(2)_OBJECTS = $$(foreach src,$$(MAC_SOURCES),.libs/mac/$$(basena SYSTEM_LAUNCHER$(2)_OBJECTS = $$(foreach src,$$(MAC_SOURCES),.libs/mac/$$(basename $$(src))$(3).system.$(1).o) .libs/mac/%$(3).dylib.$(1).o: %.m $$(SHARED_HEADERS) | .libs/mac - $$(call Q_2,OBJC, [mac]) $(MAC$(5)_CLANG) -arch $(1) $(4) -c $$(MAC_OBJC_CFLAGS) $$(MAC_CFLAGS) -DDYNAMIC_MONO_RUNTIME -DDYLIB -o $$@ $$< + $$(call Q_2,OBJC, [mac]) $(MAC_CLANG) -arch $(1) $(4) -c $$(MAC_OBJC_CFLAGS) $$(MAC_CFLAGS) -DDYNAMIC_MONO_RUNTIME -DDYLIB -o $$@ $$< .libs/mac/%$(3).dylib.$(1).o: %.s $$(SHARED_HEADERS) | .libs/mac - $$(call Q_2,ASM, [mac]) $(MAC$(5)_CLANG) -arch $(1) $(4) -c $$(MAC_CFLAGS) -DDYNAMIC_MONO_RUNTIME -DDYLIB -o $$@ $$< + $$(call Q_2,ASM, [mac]) $(MAC_CLANG) -arch $(1) $(4) -c $$(MAC_CFLAGS) -DDYNAMIC_MONO_RUNTIME -DDYLIB -o $$@ $$< .libs/mac/%$(3).static.$(1).o: %.s $$(SHARED_HEADERS) | .libs/mac - $$(call Q_2,ASM, [mac]) $(MAC$(5)_CLANG) -arch $(1) $(4) -c $$(MAC_STATIC_CFLAGS) -o $$@ $$< + $$(call Q_2,ASM, [mac]) $(MAC_CLANG) -arch $(1) $(4) -c $$(MAC_STATIC_CFLAGS) -o $$@ $$< .libs/mac/%$(3).static.$(1).o: %.m $$(SHARED_HEADERS) | .libs/mac - $$(call Q_2,OBJC, [mac]) $(MAC$(5)_CLANG) -arch $(1) $(4) $$(MAC_OBJC_CFLAGS) -c $$(MAC_STATIC_CFLAGS) -o $$@ $$< + $$(call Q_2,OBJC, [mac]) $(MAC_CLANG) -arch $(1) $(4) $$(MAC_OBJC_CFLAGS) -c $$(MAC_STATIC_CFLAGS) -o $$@ $$< .libs/mac/%$(3).system.$(1).o: %.m $$(SHARED_HEADERS) | .libs/mac - $$(call Q_2,OBJC, [mac]) $(MAC$(5)_CLANG) -arch $(1) $(4) $$(MAC_OBJC_CFLAGS) -c $$(MAC_CFLAGS) -DDYNAMIC_MONO_RUNTIME -o $$@ $$< + $$(call Q_2,OBJC, [mac]) $(MAC_CLANG) -arch $(1) $(4) $$(MAC_OBJC_CFLAGS) -c $$(MAC_CFLAGS) -DDYNAMIC_MONO_RUNTIME -o $$@ $$< .libs/mac/%$(3).system.$(1).o: %.s $$(SHARED_HEADERS) | .libs/mac - $$(call Q_2,ASM, [mac]) $(MAC$(5)_CLANG) -arch $(1) $(4) -c $(MAC_CFLAGS) -DDYNAMIC_MONO_RUNTIME -o $$@ $$< + $$(call Q_2,ASM, [mac]) $(MAC_CLANG) -arch $(1) $(4) -c $(MAC_CFLAGS) -DDYNAMIC_MONO_RUNTIME -o $$@ $$< .libs/mac/libxammac$(3).$(1).dylib: $$(DYNAMIC_DYLIB$(2)_OBJECTS) - $$(call Q_2,LD, [mac]) $(MAC$(5)_CLANG) -arch $(1) -dynamiclib $$(MAC_LDFLAGS) -Wl,-install_name,libxammac$(3).dylib -o $$@ $$^ $$(addprefix -Xlinker -U -Xlinker ,$$(ALLOWED_UNDEFINED_SYMBOLS)) + $$(call Q_2,LD, [mac]) $(MAC_CLANG) -arch $(1) -dynamiclib $$(MAC_LDFLAGS) -Wl,-install_name,libxammac$(3).dylib -o $$@ $$^ $$(addprefix -Xlinker -U -Xlinker ,$$(ALLOWED_UNDEFINED_SYMBOLS)) .libs/mac/libxammac$(3).$(1).a: $$(STATIC_LAUNCHER$(2)_OBJECTS) $$(call Q_2,LIB, [mac]) xcrun libtool -no_warning_for_no_symbols -static -o $$@ $$^ diff --git a/system-dependencies.sh b/system-dependencies.sh index cab348a6b6af..1ee4626a65a2 100755 --- a/system-dependencies.sh +++ b/system-dependencies.sh @@ -548,11 +548,6 @@ function check_xcode () { # must have latest Xcode in /Applications/Xcode.app check_specific_xcode install_coresimulator - # Xcode 9,4 does not longer start on catalina - local current_os=$(sw_vers -productVersion) - if test $current_os != "10.15"; then - check_specific_xcode "94" - fi local XCODE_DEVELOPER_ROOT=`grep ^XCODE_DEVELOPER_ROOT= Make.config | sed 's/.*=//'` local IOS_SDK_VERSION=`grep ^IOS_SDK_VERSION= Make.config | sed 's/.*=//'` diff --git a/tests/common/Configuration.cs b/tests/common/Configuration.cs index 140cb8a475ad..eb533d1f26ec 100644 --- a/tests/common/Configuration.cs +++ b/tests/common/Configuration.cs @@ -315,7 +315,7 @@ public static string SourceRoot { // might need tweaking. if (mt_src_root == null) #if MONOMAC - mt_src_root = Path.GetFullPath (Path.Combine (TestAssemblyDirectory, "../../..")); + mt_src_root = RootPath; #else mt_src_root = Path.GetFullPath (Path.Combine (TestAssemblyDirectory, "../../../..")); #endif diff --git a/tests/common/ProductTests.cs b/tests/common/ProductTests.cs index 6dfc3bd3d235..a4a95c701704 100644 --- a/tests/common/ProductTests.cs +++ b/tests/common/ProductTests.cs @@ -70,7 +70,7 @@ public void MinOSVersion (Profile profile, MachO.LoadCommands load_command, Mach foreach (var machoFile in machoFiles) { var fatfile = MachO.Read (machoFile); foreach (var slice in fatfile) { - if (slice.IsDynamicLibrary && slice.Architecture == MachO.Architectures.x86_64 && slice.Parent.size < 10240 /* this is the dummy x86_64 slice to appease Apple's notarization tooling */) + if (slice.IsDynamicLibrary && slice.Architecture == MachO.Architectures.x86_64 && slice.Parent != null && slice.Parent.size < 10240 /* this is the dummy x86_64 slice to appease Apple's notarization tooling */) continue; var any_load_command = false; foreach (var lc in slice.load_commands) { diff --git a/tests/mmptest/mmptest.csproj b/tests/mmptest/mmptest.csproj index 64cc505a8b6f..8da9a3ffcde7 100644 --- a/tests/mmptest/mmptest.csproj +++ b/tests/mmptest/mmptest.csproj @@ -113,6 +113,9 @@ SdkVersions.cs + + MachO.cs + diff --git a/tests/mmptest/src/CodeStrippingTests.cs b/tests/mmptest/src/CodeStrippingTests.cs index aa6f2d57d804..fef5b3fc500a 100644 --- a/tests/mmptest/src/CodeStrippingTests.cs +++ b/tests/mmptest/src/CodeStrippingTests.cs @@ -4,6 +4,7 @@ using NUnit.Framework; using Xamarin.Utils; +using Xamarin.Tests; namespace Xamarin.MMP.Tests { @@ -59,6 +60,10 @@ void StripTestCore (TI.UnifiedTestConfig test, bool debugStrips, bool releaseStr [TestCase (false, false, false)] public void ShouldStripMonoPosixHelper (bool? strip, bool debugStrips, bool releaseStrips) { + var posixHelper = Path.Combine (Configuration.SdkRootXM, "lib", "libMonoPosixHelper.dylib"); + if (Xamarin.MachO.GetArchitectures (posixHelper).Count < 2) + Assert.Ignore ($"libMonoPosixHelper.dylib is not a fat library."); + MMPTests.RunMMPTest (tmpDir => { TI.UnifiedTestConfig test = CreateStripTestConfig (strip, tmpDir); @@ -90,16 +95,21 @@ public void ExplictStripOption_ThirdPartyLibrary_AndWarnsIfSo (bool? strip, bool { MMPTests.RunMMPTest (tmpDir => { - string originalLocation = Path.Combine (TI.FindRootDirectory (), MonoPosixOffset); + string originalLocation = Path.Combine (Configuration.SourceRoot, "tests", "test-libraries", "libtest-fat.macos.dylib"); string newLibraryLocation = Path.Combine (tmpDir, "libTest.dylib"); File.Copy (originalLocation, newLibraryLocation); TI.UnifiedTestConfig test = CreateStripTestConfig (strip, tmpDir, $" --native-reference=\"{newLibraryLocation}\""); test.Release = true; - string buildOutput = TI.TestUnifiedExecutable (test).BuildOutput; + var testOutput = TI.TestUnifiedExecutable (test); + string buildOutput = testOutput.BuildOutput; Assert.AreEqual (shouldStrip, DidAnyLipoStrip (buildOutput), "lipo usage did not match expectations"); - Assert.AreEqual (shouldStrip, buildOutput.Contains ("MM2108"), "Warning did not match expectations"); + if (shouldStrip) { + testOutput.Messages.AssertWarning (2108, "libTest.dylib was stripped of architectures except x86_64 to comply with App Store restrictions. This could break existing codesigning signatures. Consider stripping the library with lipo or disabling with --optimize=-trim-architectures"); + } else { + testOutput.Messages.AssertWarningCount (0); + } }); } diff --git a/tests/test-libraries/libtest-fat.macos.dylib b/tests/test-libraries/libtest-fat.macos.dylib new file mode 100755 index 000000000000..a4d24be5c1e6 Binary files /dev/null and b/tests/test-libraries/libtest-fat.macos.dylib differ diff --git a/tools/common/MachO.cs b/tools/common/MachO.cs index eb95c74fcba8..5061efd8d4e1 100644 --- a/tools/common/MachO.cs +++ b/tools/common/MachO.cs @@ -232,10 +232,19 @@ public static IEnumerable Read (string filename) } } else { var mf = file as MachOFile; - if (mf != null) + if (mf != null) { yield return mf; - else - throw ErrorHelper.CreateError (1604, "File of type {0} is not a MachO file ({1}).", file.GetType ().Name, filename); + yield break; + } + + var sl = file as StaticLibrary; + if (sl != null) { + foreach (var obj in sl.ObjectFiles) + yield return obj; + yield break; + } + + throw ErrorHelper.CreateError (1604, "File of type {0} is not a MachO file ({1}).", file.GetType ().Name, filename); } }