New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[watchos] Can't deploy with ARMv7k architecture on Series 4 #4864

Open
VincentDondain opened this Issue Sep 21, 2018 · 54 comments

Comments

Projects
None yet
10 participants
@VincentDondain
Copy link
Contributor

VincentDondain commented Sep 21, 2018

Steps to Reproduce

  1. Create a new watchOS project.
  2. Deploy on new Apple Watch Series 4.

Expected Behavior

Should deploy fine.

Actual Behavior

Deploying to Device output:

IncorrectArchitecture: Failed to find matching arch for 32-bit Mach-O input file /private/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.mC7GED/extracted/MySingleAppMyWatchProject.app/PlugIns/MySingleAppMyWatchProjectExtension.appex/MySingleAppMyWatchProjectExtension
error MT1006: Could not install the application '/Users/vince/Projects/MySingleApp/MySingleApp/bin/iPhone/Debug/device-builds/iphone10.6-12.1/MySingleApp.app' on the device 'Vincent’s iPhone X': AMDeviceSecureInstallApplicationBundle returned: 0xe8000087 (kAMDIncorrectArchitectureError).

Environment

=== Visual Studio Enterprise 2017 for Mac ===

Version 7.6.6 (build 17)
Installation UUID: bef2b48b-cfbf-4371-bca9-fa440adab7db
Runtime:
	Mono 5.12.0.301 (2018-02/4fe3280bba1) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)
	Xamarin.Mac 4.4.1.178 (master / eeaeb7e6)

	Package version: 512000301

=== NuGet ===

Version: 4.3.1.4445

=== .NET Core ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	2.1.2
	2.0.5
	2.0.0
SDK: /usr/local/share/dotnet/sdk/2.1.302/Sdks
SDK Versions:
	2.1.302
	2.1.4
	2.0.2
	2.0.0
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.12.0/lib/mono/msbuild/15.0/bin/Sdks

=== Xamarin.Profiler ===

Version: 1.6.3
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 10.1 (14460.20.3)
Build 10O23u

=== Xamarin.Android ===

Version: 9.0.0.20 (Visual Studio Enterprise)
Android SDK: /Users/vince/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
		5.1    (API level 22)
		6.0    (API level 23)
		7.0    (API level 24)
		7.1    (API level 25)
		8.0    (API level 26)
		8.1    (API level 27)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 26.0.2
SDK Build Tools Version: 27.0.0

Java SDK: /usr
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin.Mac ===

Version: 4.6.0.14 (Visual Studio Enterprise)
Hash: 1a6e2786
Branch: 
Build date: 2018-08-28 00:12:06-0400

=== Xamarin.iOS ===

Version: 12.0.0.15 (Visual Studio Enterprise)
Hash: 84552a46
Branch: xcode10
Build date: 2018-09-17 21:54:33-0400

=== Xamarin Inspector ===

Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1

=== Build Information ===

Release ID: 706060017
Git revision: 822323b5f6295b271d4c9bfaca4129f90ec41f38
Build date: 2018-09-18 20:19:40+00
Build branch: release-7.6-xcode10
Xamarin extensions: a83eb4b7ad9174ac2e705f2c4257ecd15688ba97

=== Operating System ===

Mac OS X 10.14.0
Darwin 18.0.0 Darwin Kernel Version 18.0.0
    Wed Aug 22 20:59:21 PDT 2018
    root:xnu-4903.201.2~4/RELEASE_X86_64 x86_64

=== Enabled user installed extensions ===

NuGet Package Explorer 0.2
Internet of Things (IoT) development (Preview) 7.5

Build Logs

https://gist.github.com/VincentDondain/574b4fad1933e6a0c20b8df0c8a7ade9

@VincentDondain VincentDondain added this to the Future milestone Sep 21, 2018

@motoko89

This comment has been minimized.

Copy link

motoko89 commented Sep 22, 2018

could it be related to this? #4810

@rolfbjarne

This comment has been minimized.

Copy link
Member

rolfbjarne commented Sep 24, 2018

@motoko89 no, it's a separate issue.

@t9mike

This comment has been minimized.

Copy link

t9mike commented Sep 25, 2018

Is there any work around to this? The only way I can test on real Series 4 device is to compile with #4810 plist hack, submit to app store, and use TestFlight. This is very tedious.

@rolfbjarne

This comment has been minimized.

Copy link
Member

rolfbjarne commented Sep 25, 2018

@t9mike at the moment we don't know any other workaround other than what you're doing (using TestFlight), but we're working hard on figuring something out. This was a not-so-nice surprise from Apple 😒

@VincentDondain

This comment has been minimized.

Copy link
Contributor Author

VincentDondain commented Sep 25, 2018

Alright we found a workaround!

In the watch extension's csproj, after <Import Project="$(MSBuildExtensionsPath)\Xamarin\WatchOS\Xamarin.WatchOS.AppExtension.CSharp.targets" />

Add:

<Target Name="BeforeCodesign" Condition="'$(Configuration)|$(Platform)' == 'Release|iPhone'">
    <Exec Command="mv '$(_NativeExecutable)' '$(_NativeExecutable).armv7k'" />
    <Exec Command="xcrun bitcode-build-tool -j 8 -o '$(_NativeExecutable).arm64_32' --translate-watchos '$(_NativeExecutable).armv7k'" />
    <Exec Command="xcrun lipo -create -output '$(_NativeExecutable)' '$(_NativeExecutable).arm64_32' '$(_NativeExecutable).armv7k'" />
    <Exec Command="rm -f '$(_NativeExecutable).arm64_32' '$(_NativeExecutable).armv7k'" />
</Target>

In short what this does is for the release mode (because we need full bitcode): translate the armv7k code into arm64_32 using Xcode's tooling, make a fat binary and that when deployed to device, works!

@t9mike

This comment has been minimized.

Copy link

t9mike commented Sep 26, 2018

Alright we found a workaround!

Yes! Thank you team. Worked on my project.

@rolfbjarne

This comment has been minimized.

Copy link
Member

rolfbjarne commented Sep 26, 2018

Have in mind that this workaround will not create arm64_32 bitcode, which means the workaround should probably be removed/commented out before trying to publish the app to the app store (alternatively you can add a new Release configuration, say ReleaseWithS4Workaround, and put the workaround in that configuration, so that the Release configuration would still work for archiving).

@VincentDondain

This comment has been minimized.

Copy link
Contributor Author

VincentDondain commented Sep 27, 2018

Also for this hack, make sure your xcode-select -p points to Xcode 10 final and above (xcode-select -s /path/to/Xcode if needed). Xcode 10 GM and before didn't have the translation command.

@t9mike

This comment has been minimized.

Copy link

t9mike commented Oct 1, 2018

Is there any way to run Debug build against real Watch device? When I try adding to Debug|iPhone I get the "Failed to find matching arch for 32-bit Mach-O input file" error. I have a nasty bug that is happening on device and not simulator that I need to debug.

I added:

  <Target Name="BeforeCodesign" Condition="'$(Configuration)|$(Platform)' == 'Debug|iPhone'">
      <Exec Command="mv '$(_NativeExecutable)' '$(_NativeExecutable).armv7k'" />
      <Exec Command="xcrun bitcode-build-tool -j 8 -o '$(_NativeExecutable).arm64_32' --translate-watchos '$(_NativeExecutable).armv7k'" />
      <Exec Command="xcrun lipo -create -output '$(_NativeExecutable)' '$(_NativeExecutable).arm64_32' '$(_NativeExecutable).armv7k'" />
      <Exec Command="rm -f '$(_NativeExecutable).arm64_32' '$(_NativeExecutable).armv7k'" />
  </Target>
@rolfbjarne

This comment has been minimized.

Copy link
Member

rolfbjarne commented Oct 1, 2018

@t9mike no, there's no way to use the Debug configuration, because the hack is using the bitcode from the Release configuration to create the native arm64_32 code the watch requires. The Debug configuration doesn't create bitcode, so it won't work. And yes, I know this means you won't be able to use the debugger. Unfortunately supporting an entirely new architecture is a lot of work (arm64_32 also has characteristics no other architecture has, which makes it even more complicated), so it's quite unlikely that we'll get debugging on the S4 device working in the near future (my guess would be sometime next year).

@t9mike

This comment has been minimized.

Copy link

t9mike commented Oct 2, 2018

Should I be able to symbolicate a crash from the watch extension with the work around? When I do:

/Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash -o "symbolicatedCrash.txt" "SundialWatchAppExtension 10-1-18, 10-00 PM.crash" SundialWatchAppExtension.appex

I don't see SundialWatchAppExtension C# details in stack trace:

Thread 0 name:  tid_303  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib        	0x1c043be4 __abort_with_payload + 8
1   libsystem_kernel.dylib        	0x1c03d590 abort_with_payload_wrapper_internal + 100
2   libsystem_kernel.dylib        	0x1c03d52c abort_with_payload_wrapper_internal + 0
3   libobjc.A.dylib               	0x1b68a958 _objc_fatalv+ 22872 (unsigned long long, unsigned long long, char const*, char*) + 112
4   libobjc.A.dylib               	0x1b68a8b0 __objc_error + 0
5   libobjc.A.dylib               	0x1b695e1c getMethodNoSuper_nolock+ 69148 (objc_class*, objc_selector*) + 0
6   libobjc.A.dylib               	0x1b6a23b8 _objc_msgSend_uncached + 56
7   Foundation                    	0x1cf6d18c _NSDescriptionWithStringProxyFunc + 64
8   CoreFoundation                	0x1c457a4c __CFStringAppendFormatCore + 7800
9   CoreFoundation                	0x1c459530 _CFStringCreateWithFormatAndArgumentsAux2 + 136
10  ClockKit                      	0x2dd095cc -[CLKCompoundTextProvider _processFormat:arguments:] + 148
11  ClockKit                      	0x2dd070bc -[CLKCompoundTextProvider initWithFormat:arguments:] + 208
12  ClockKit                      	0x2dd27918 +[CLKTextProvider textProviderWithFormat:arguments:] + 80
13  ClockKit                      	0x2dd278bc +[CLKTextProvider textProviderWithFormat:] + 36
14  SundialWatchAppExtension      	0x003df2dc 0x38c000 + 340700
15  SundialWatchAppExtension      	0x008aa0bc 0x38c000 + 5365948
16  SundialWatchAppExtension      	0x00ef1cb4 0x38c000 + 11951284
17  SundialWatchAppExtension      	0x00eeeaec 0x38c000 + 11938540
18  SundialWatchAppExtension      	0x00f78104 0x38c000 + 12501252
19  SundialWatchAppExtension      	0x00f7a050 0x38c000 + 12509264
20  SundialWatchAppExtension      	0x003999e4 0x38c000 + 55780
21  SundialWatchAppExtension      	0x00399798 0x38c000 + 55192
22  ClockKit                      	0x2dd2e298 __76-[CLKComplicationServer getCurrentTimelineEntryForComplication:withHandler:]_block_invoke + 236
...
@rolfbjarne

This comment has been minimized.

Copy link
Member

rolfbjarne commented Oct 2, 2018

@t9mike you're right, it seems the workaround removes the symbols, and there doesn't seem to be a way around it either. Do you get something in the Application Output when it crashes like this?

@t9mike

This comment has been minimized.

Copy link

t9mike commented Oct 2, 2018

Do you get something in the Application Output when it crashes like this?

Via Console? No.

Odd crash. Modular Large complication only, unchanged from previous releases:

  • Fine on Series 2 42mm hardware, watchOS 5
  • Fine on Series 4 44m simulator, watchOS 5
  • Crash on Series 4 44m hardware, watchOS 5

It appears to be crashing on one of my TextProviderWithFormat.Create() calls. I don't expect you to debug this, but I'm curious if you notice anything in the unmanaged portion of the stack trace that jumps out as common managed/unmanaged interop issue?

FYI example of some of the Modular Large complication code:

var timespan_provider = CLKRelativeDateTextProvider.FromDate(
   entry.Event.Date.ToNSDate(), CLKRelativeDateStyle.Natural, NSCalendarUnit.Hour |
   NSCalendarUnit.Minute);
var time_provider = CLKTimeTextProvider.FromDate(entry.Event.Date.ToNSDate());

temp.Body1TextProvider = CLKSimpleTextProvider.FromText(label + " in");
temp.Body2TextProvider = TextProviderWithFormat.Create("%@ at %@",
   timespan_provider, time_provider);

I'll experiment with no providers in TextProviderWithFormat.Create() to narrow it down I suppose. Ugg.

@rolfbjarne

This comment has been minimized.

Copy link
Member

rolfbjarne commented Oct 2, 2018

Is TextProviderWithFormat something you bound yourself?

Because something looks wrong, you're calling it with three parameters:

TextProviderWithFormat.Create("%@ at %@", timespan_provider, time_provider);

yet the method from the stack trace only takes one:

13  ClockKit        0x2dd278bc +[CLKTextProvider textProviderWithFormat:] + 36
@t9mike

This comment has been minimized.

Copy link

t9mike commented Oct 2, 2018

Is TextProviderWithFormat something you bound yourself?

You are two steps ahead of me @rolfbjarne :-). I had not started reviewing/debugging my text provider calls yet. Yes, looking deeper, I previously had to create a way to call:

(CLKTextProvider *)textProviderWithFormat:(NSString *)format, ...;
https://developer.apple.com/documentation/clockkit/clktextprovider/1627899-textproviderwithformat

I created ticket about this missing API. See https://bugzilla.xamarin.com/show_bug.cgi?id=53271. With the help of @mandel-macaque I used:

    public static class TextProviderWithFormat
    {
        [DllImport("/usr/lib/libobjc.dylib")]
        static extern IntPtr objc_msgSend(IntPtr obj, IntPtr selector, IntPtr format, IntPtr provider0);

        [DllImport("/usr/lib/libobjc.dylib")]
        static extern IntPtr objc_msgSend(IntPtr obj, IntPtr selector, IntPtr format, IntPtr provider0, IntPtr provider1);

        public static CLKTextProvider Create(string format,
                CLKRelativeDateTextProvider provider)
        {
            IntPtr ptr = objc_msgSend(new Class(typeof(CLKTextProvider)).Handle,
                                      Selector.GetHandle("textProviderWithFormat:"), 
                                      new NSString(format).Handle, provider.Handle);
            return Runtime.GetNSObject<CLKTextProvider>(ptr);
        }

        public static CLKTextProvider Create(string format,
            CLKTimeTextProvider timeTextProvider)
        {
            IntPtr ptr = objc_msgSend(new Class(typeof(CLKTextProvider)).Handle,
                                      Selector.GetHandle("textProviderWithFormat:"),
                                      new NSString(format).Handle,
                                      timeTextProvider.Handle);
            return Runtime.GetNSObject<CLKTextProvider>(ptr);
        }

        public static CLKTextProvider Create(string format,
            CLKTextProvider textProvider,
            CLKRelativeDateTextProvider relativeDateTextProvider)
        {
            IntPtr ptr = objc_msgSend(new Class(typeof(CLKTextProvider)).Handle,
                                      Selector.GetHandle("textProviderWithFormat:"),
                                      new NSString(format).Handle, 
                                      textProvider.Handle,
                                      relativeDateTextProvider.Handle);
            return Runtime.GetNSObject<CLKTextProvider>(ptr);
        }

        public static CLKTextProvider Create(string format,
            CLKRelativeDateTextProvider relativeDateTextProvider,
                                             CLKTimeTextProvider timeTextProvider)
        {
            IntPtr ptr = objc_msgSend(new Class(typeof(CLKTextProvider)).Handle,
                                      Selector.GetHandle("textProviderWithFormat:"),
                                      new NSString(format).Handle,
                                      relativeDateTextProvider.Handle,
                                      timeTextProvider.Handle);
            return Runtime.GetNSObject<CLKTextProvider>(ptr);
        }
}

AFAICT no work has been done on the underlying missing API. Is this a 32/64-bit pointer issue?

Any hints on work around? Perhaps https://bugzilla.xamarin.com/show_bug.cgi?id=53271#c14 approach to binding?

FYI, here is the Modular Large complication:

image

@rolfbjarne

This comment has been minimized.

Copy link
Member

rolfbjarne commented Oct 2, 2018

@t9mike variadic functions are tricky :/ Try this instead: https://gist.github.com/rolfbjarne/aab3bbd2b096f830daf4abaa3d25e609 - this will pass the variadic arguments as the 8th and subsequent parameter (see here for a longer explanation). This is how it works for arm64; I don't know how if it works for arm64_32 as well (Apple has released no documentation whatsoever), but it's worth a try.

@t9mike

This comment has been minimized.

Copy link

t9mike commented Oct 3, 2018

Try this instead: https://gist.github.com/rolfbjarne/aab3bbd2b096f830daf4abaa3d25e609

Yes that did the trick @rolfbjarne! Thank you so much. I don't know of a way to check for arm64_32 so I checked for Series 4 (+ not simulator) instead. Would be interested in future proofing a little.

Here is my updated wrapper with conditionalization for Series4 device: https://gist.github.com/t9mike/aff2886c141a26dce1a669de6079df9c.

@rolfbjarne

This comment has been minimized.

Copy link
Member

rolfbjarne commented Oct 3, 2018

Yes that did the trick @rolfbjarne!

Great 😄

I don't know of a way to check for arm64_32 so I checked for Series 4 (+ not simulator) instead. Would be interested in future proofing a little.

I think this is good enough for now, afaik there's no other way to distinguish the S4 from the earlier versions. I've filed #4907 so that we add an API to expose the underlying cpu architecture.

@grantkiwi

This comment has been minimized.

Copy link

grantkiwi commented Oct 16, 2018

Hi when will this fix become available? Workaround did not work for me

@rolfbjarne

This comment has been minimized.

Copy link
Member

rolfbjarne commented Oct 16, 2018

@grantkiwi can you post the build log and the deploy log from the IDE?

@grantkiwi

This comment has been minimized.

Copy link

grantkiwi commented Oct 16, 2018

This is error I get when app watch app is trying to install on series 4.

Time Device Name Type PID Tag Message
Oct 16 12:15:34 Grants-iPhone-X Notice 111 appconduitd(MobileSystemServices) 0x16b8c3000 -[ACXCompanionSyncConnection _installWatchAppWithBundleID:withProvisioningProfileInfo:installationPendingBlock:completionWithError:]_block_invoke_3: Failed to install app com.timefiler.timefileruipunchclock.watchkitapp : Error Domain=ACXErrorDomain Code=17 "Got error 17 in install done from remote side (MI error IncorrectArchitecture ; Extended 0x0 ; Desc Failed to find matching arch for 32-bit Mach-O input file /private/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.ibRG0e/extracted/Payload/TimeFilerUIPunchClockWatch.WatchOSApp.app/PlugIns/TimeFilerUIPunchClockWatch.WatchOSExtension.appex/TimeFilerUIPunchClockWatch.WatchOSExtension)" UserInfo={SourceFileLine=591, NSLocalizedDescription=Got error 17 in install done from remote side (MI error IncorrectArchitecture ; Extended 0x0 ; Desc Failed to find matching arch for 32-bit Mach-O input file /private/var/installd/Library/Caches/com.apple.mobile.in

@rolfbjarne

This comment has been minimized.

Copy link
Member

rolfbjarne commented Oct 17, 2018

@grantkiwi and the build log?

@grantkiwi

This comment has been minimized.

Copy link

grantkiwi commented Oct 17, 2018

@grantkiwi

This comment has been minimized.

Copy link

grantkiwi commented Oct 23, 2018

@grantkiwi

This comment has been minimized.

Copy link

grantkiwi commented Oct 23, 2018

log file attached sorry for delay have been away

@grantkiwi

This comment has been minimized.

Copy link

grantkiwi commented Oct 23, 2018

Any updates? No one else reproduce this?

@rolfbjarne

This comment has been minimized.

Copy link
Member

rolfbjarne commented Oct 23, 2018

@grantkiwi:

Rebuild All started: Project: TimeFilerUIPunchClockWatch.WatchOSExtension, Configuration: Debug iPhone ------

This workaround only works for the Release configuration, not the Debug configuration.

See also #4864 (comment)

@grantkiwi

This comment has been minimized.

Copy link

grantkiwi commented Oct 23, 2018

I get this error in release configuration:

Severity Code Description Project File Line Suppression State
Error The command "mv 'bin\iPhone\Release\TimeFilerUIPunchClockWatch.WatchOSExtension.appex\TimeFilerUIPunchClockWatch.WatchOSExtension' 'bin\iPhone\Release\TimeFilerUIPunchClockWatch.WatchOSExtension.appex\TimeFilerUIPunchClockWatch.WatchOSExtension.armv7k'" exited with code 9009. TimeFilerUIPunchClockWatch.WatchOSExtension C:\VSS\picassomobile\TimeFilerUIPunchClock\TimeFilerUIPunchClock\TimeFilerUIPunchClockWatch\TimeFilerUIPunchClockWatch.WatchOSExtension\TimeFilerUIPunchClockWatch.WatchOSExtension.csproj 122

@rolfbjarne

This comment has been minimized.

Copy link
Member

rolfbjarne commented Oct 24, 2018

@grantkiwi it seems the workaround will only work when building from macOS, not Windows.

@emaf @kzu do you know how this: #4864 (comment) can be done so that it works from Windows?

@emaf

This comment has been minimized.

Copy link
Contributor

emaf commented Oct 24, 2018

@rolfbjarne @grantkiwi to make it work from Windows you'll need to include SessionId="$(BuildSessionId)" on each command.

Like this:

<Target Name="BeforeCodesign" Condition="'$(Configuration)|$(Platform)' == 'Release|iPhone'">
    <Exec SessionId="$(BuildSessionId)" Command="mv '$(_NativeExecutable)' '$(_NativeExecutable).armv7k'" />
    <Exec SessionId="$(BuildSessionId)" Command="xcrun bitcode-build-tool -j 8 -o '$(_NativeExecutable).arm64_32' --translate-watchos '$(_NativeExecutable).armv7k'" />
    <Exec SessionId="$(BuildSessionId)" Command="xcrun lipo -create -output '$(_NativeExecutable)' '$(_NativeExecutable).arm64_32' '$(_NativeExecutable).armv7k'" />
    <Exec SessionId="$(BuildSessionId)" Command="rm -f '$(_NativeExecutable).arm64_32' '$(_NativeExecutable).armv7k'" />
</Target>
@grantkiwi

This comment has been minimized.

Copy link

grantkiwi commented Oct 25, 2018

@emaf

This comment has been minimized.

Copy link
Contributor

emaf commented Oct 26, 2018

@grantkiwi, sorry about that, here you have an example:

<Target Name="BeforeCodesign" Condition="'$(Configuration)|$(Platform)' == 'Release|iPhone'">
    <Exec SessionId="$(BuildSessionId)" Command="mv '$(_NativeExecutable)' '$(_NativeExecutable).armv7k'" />
    <Exec SessionId="$(BuildSessionId)" Command="xcrun bitcode-build-tool -j 8 -o '$(_NativeExecutable).arm64_32' --translate-watchos '$(_NativeExecutable).armv7k'" />
    <Exec SessionId="$(BuildSessionId)" Command="xcrun lipo -create -output '$(_NativeExecutable)' '$(_NativeExecutable).arm64_32' '$(_NativeExecutable).armv7k'" />
    <Exec SessionId="$(BuildSessionId)" Command="rm -f '$(_NativeExecutable).arm64_32' '$(_NativeExecutable).armv7k'" />
</Target>
@grantkiwi

This comment has been minimized.

Copy link

grantkiwi commented Oct 28, 2018

Severity Code Description Project File Line Suppression State
Error "Exec" task received an invalid value for the "StdErrEncoding" parameter. TimeFilerUIPunchClockWatch.WatchOSExtension C:\VSS\picassomobile\TimeFilerUIPunchClock\TimeFilerUIPunchClock\TimeFilerUIPunchClockWatch\TimeFilerUIPunchClockWatch.WatchOSExtension\TimeFilerUIPunchClockWatch.WatchOSExtension.csproj 121

@grantkiwi

This comment has been minimized.

Copy link

grantkiwi commented Oct 28, 2018

Do we have an ETA for a fix??

@rolfbjarne

This comment has been minimized.

Copy link
Member

rolfbjarne commented Oct 29, 2018

@grantkiwi can you gist your entire build log?

Unfortunately a proper fix requires a lot of work, so it will take a while (probably sometime next year).

@DevAndArtist

This comment has been minimized.

Copy link

DevAndArtist commented Nov 15, 2018

Hi @rolfbjarne, I'm completely unrelated to this github project but I'm investigating this issue for three days already. I noticed it completely differently though.

Devices:

  • iPhone 6 Plus with iOS 12.1
  • Apple Watch Series 4 with watchOS 5.1.1 (now 5.1.2 beta)

I wanted to install multiple apps from the phone onto the watch but a lot of them simply fail. I tried a lot to get it working, but nothing helped. However when I tried to installed from a different iPhone (7 to be precise) it just worked.
Today I hooked up Console app and found similar logs when the installation from the phone to the watch failed by observing the installd keyword.

I'm currently chatting with Apple Support regarding this issue and there is also a different GitHub issue where I'm investigating this.


Do you have an understanding what the error 17 means in general? Could it be that the App Store is re-compiling the Watch Apps wrongly? I mean, I have a 64-bit iPhone and a 64-bit watch but I get an error related to a 32-bit arch when installing.

@rolfbjarne

This comment has been minimized.

Copy link
Member

rolfbjarne commented Nov 15, 2018

@DevAndArtist my guess would be that the App Store has a bug that when serving apps to iPhone 6 Plus + Apple Watch S4 it creates a broken app bundle with the wrong architecture(s). This is something you need to contact Apple to get them to have a look at it (as you've already done).

@DevAndArtist

This comment has been minimized.

Copy link

DevAndArtist commented Nov 15, 2018

@rolfbjarne great, this is also the conclusion I came to after spending days trying different solutions and observing the logs in the Console app. I will forward this thread to Apple as well. Thank you for sharing your thoughts.

@t9mike

This comment has been minimized.

Copy link

t9mike commented Nov 15, 2018

I have also received a report from an iPhone 6+ user about watch app install issues on his Series 4. My app is Sundial (Xamarin). He also has the install issue w/ RadarScope and Shazam. He went as far as to schedule Genius Bar appointment. As you would expect, they ultimately tried to blame the app.

@DevAndArtist

This comment has been minimized.

Copy link

DevAndArtist commented Nov 15, 2018

I just don't think it's the fault of any apps but rather the App Store, since in the linked project (GitHawk) everything is hooked up correctly an I can even compile it to my watch, but the same version through the App Store simply fails to install. Interesting fact is that I previously installed Shazam on my Series 4 watch, but then when Spotify came out and failed to install, I remove Shazam from the watch and now fail to install it with the same error.

Any chance you can contact your user and ask him to connect his phone to a mac then open Console app, select the iPhone, filter the logs just by the keyword installd and let him try to install an app that always fails on his device. It probably will fail with the same Error 17. This would provide us more evidence that there is an issue builds served by the App Store.

bildschirmfoto 2018-11-15 um 14 21 34

@t9mike

This comment has been minimized.

Copy link

t9mike commented Nov 15, 2018

I'll give it a shot @DevAndArtist.

@DevAndArtist

This comment has been minimized.

Copy link

DevAndArtist commented Nov 15, 2018

Talked to the Apple Support, we really need more iPhone 6 Plus users to confirm the issue so it get's some priority for further investigation and hopefully a fix. Would be great if you manage to contact your customer, no rush though. I will try to get another iPhone 6 Plus tomorrow and check the symptoms there.

@t9mike

This comment has been minimized.

Copy link

t9mike commented Nov 15, 2018

My user does not have a Mac to debug. But he said he opened another ticket with Spple support.

@t9mike

This comment has been minimized.

Copy link

t9mike commented Nov 17, 2018

@DevAndArtist has done a writeup regarding the iPhone 6 Plus / Series 4 install issue at https://devandartist.com/posts/apps-not-installing-on-the-apple-watch-or-error-17.

@DevAndArtist

This comment has been minimized.

Copy link

DevAndArtist commented Nov 19, 2018

I really now think it's the App Store that sends corrupted builds because if you download a generic IPA from the App Store of an app that fail to install and install it using Apple Configurator 2, it will finally install on the watch as well. I updated my post with this workaround.

@ammoman

This comment has been minimized.

Copy link

ammoman commented Jan 17, 2019

We're trying to release a build to the App Store that will work with Series 4. We used the workaround provided above, which successfully creates an archived build. We can sign the archive for submission, but every time we submit it via the Application Loader we get the following error:

ERROR ITMS-90209: "Invalid Segment Alignment. The app binary '....WatchExtension' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version.

We are running the latest version of Visual Studio for Mac along with all the latest updates for Xcode. If we remove the workaround code from the project file, the application loads fine. Does this workaround no longer work with the latest versions of Visual Studio?

@rolfbjarne

This comment has been minimized.

Copy link
Member

rolfbjarne commented Jan 18, 2019

@ammoman is this the first time you're trying this workaround, or did it work before and now it doesn't anymore?

@ammoman

This comment has been minimized.

Copy link

ammoman commented Jan 23, 2019

This is the first time we’ve attempted the workaround. Once the issue was discovered a few months ago we postponed all iOS development. (until now)

@rolfbjarne

This comment has been minimized.

Copy link
Member

rolfbjarne commented Jan 23, 2019

@ammoman can you enable diagnostic build output in VIsual Studio for Mac (as explained here: https://docs.microsoft.com/en-us/visualstudio/mac/compiling-and-building), and attach the build log here? This should be a clean build log.

@AlejandroRuiz

This comment has been minimized.

Copy link

AlejandroRuiz commented Feb 1, 2019

Im trying using an iPhone XS Max and I got the same error while trying to debug the app, so seems that is not only an iPhone 6+ issue

Info (112) / appconduitd(MobileSystemServices): 0x16f1fb000 -[ACXInstallQueue _onQueue_deQueueNextOperation]_block_invoke_2: Failed to install app (p = N, ui = Y) : Error Domain=ACXErrorDomain Code=17 "Got error 17 in install done from remote side (MI error IncorrectArchitecture ; Extended 0x0 ; Desc Failed to find matching arch for 32-bit Mach-O input file" UserInfo={SourceFileLine=591, NSLocalizedDescription=Got error 17 in install done from remote side (MI error IncorrectArchitecture ; Extended 0x0 ; Desc Failed to find matching arch for 32-bit Mach-O input file

@thetechrasta

This comment has been minimized.

Copy link

thetechrasta commented Feb 4, 2019

iPhone X + Apple Watch 4th Gen trying to deploy on Mac:

IncorrectArchitecture: Failed to find matching arch for 32-bit Mach-O input file /private/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.UEFgYz/extracted/TestAppWatch.app/PlugIns/TestAppWatchExtension.appex/TestAppWatchExtension
error MT1006: Could not install the application '/Users/Shaunn/Projects/TestApp/TestApp/bin/iPhone/Debug/device-builds/iphone10.3-12.1.3/TestApp.app' on the device 'iSpark': AMDeviceSecureInstallApplicationBundle returned: 0xe8000087 (kAMDIncorrectArchitectureError).

@rolfbjarne you had a fix above however I am not sure how to utilise it? Can you provide details? In the interim I will provision a Windows VM and see if I can make use of the other fix (adding line to csproj file). Would really rather not provision a Windows VM but these are desperate times!

@rolfbjarne

This comment has been minimized.

Copy link
Member

rolfbjarne commented Feb 4, 2019

@thetechrasta this is the workaround: #4864 (comment). If that doesn't work, please attach a complete diagnostic build log.

@thetechrasta

This comment has been minimized.

Copy link

thetechrasta commented Feb 16, 2019

Thanks @rolfbjarne. I still cannot deploy to a series 4 watch yet I can with a series 3 watch.. I have attached logs to this post. If you have any further input please let me know.

ApplicationOutput.txt
BuildLog.txt

@rolfbjarne

This comment has been minimized.

Copy link
Member

rolfbjarne commented Feb 18, 2019

@thetechrasta

The workaround above only works in release mode:

Building solution AlarmSim (Debug|iPhone)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment