Bug 45855 - [Xcode 8.1 GM] "Failed to launch the simulator: Could not load the framework 'libswiftos.dylib' (path: /Applications/Xcode.app/Contents/Frameworks/libswiftos.dylib): not found." when attempting to launch iOS 10.1 simulator via `mlaunch`
Summary: [Xcode 8.1 GM] "Failed to launch the simulator: Could not load the framework ...
Status: VERIFIED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: iOS add-in (show other bugs)
Version: 6.1.2 (C8SR1)
Hardware: PC Mac OS
: --- critical
Target Milestone: (C8SR1)
Assignee: Jeffrey Stedfast
URL:
: 46172 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-10-24 21:20 UTC by Brendan Zagaeski (Xamarin Support)
Modified: 2016-12-01 02:49 UTC (History)
7 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Brendan Zagaeski (Xamarin Support) 2016-10-24 21:20:36 UTC
[Xcode 8.1 GM] "Failed to launch the simulator: Could not load the framework 'libswiftos.dylib' (path: /Applications/Xcode.app/Contents/Frameworks/libswiftos.dylib): not found." when attempting to launch iOS 10.1 simulator via `mlaunch`




## Steps to replicate

1. Create a new "iOS > App > Single View App (C#)" in Xamarin Studio.

2. Select the Debug configuration, and select an iOS 9.3 simulator from the configuration menu.

3. Select "Run > Start Debugging".




## Follow-up command line test to minimize the factors involved

Run `mlaunch` by hand in Terminal.app, using a command similar to the following:

"/Applications/Xamarin/Xamarin Studio.app/Contents/Resources/lib/monodevelop/AddIns/MonoDevelop.IPhone/mlaunch.app/Contents/MacOS/mlaunch" --launchsim=/Users/Shared/Projects/UnifiedSingleViewIphone1/UnifiedSingleViewIphone1/bin/iPhoneSimulator/Debug/UnifiedSingleViewIphone1.app




## Results

The deployment to the simulator fails due to a missing dynamic library lookup.

(The results are the same whether the app is launched via the Xamarin Studio IDE or directly on the command line via `mlaunch`.)



### Error message in the Application Output

> Failed to launch the simulator: Could not load the framework
> 'libswiftos.dylib' (path:
> /Applications/Xcode.app/Contents/Frameworks/libswiftos.dylib): not
> found.
>
> error MT1008: Failed to launch the simulator: Could not load the
> framework 'libswiftos.dylib' (path:
> /Applications/Xcode.app/Contents/Frameworks/libswiftos.dylib): not
> found.


### New location of the library as of the Xcode 8.1 GM (Build version 8T61a)?

The old location doesn't exist:

> $ ls /Applications/Xcode.app/Contents/Frameworks/libswiftos.dylib
> ls: /Applications/Xcode.app/Contents/Frameworks/libswiftos.dylib: No such file or directory

But there do appear to be versions of the library for individual target platforms:

> $ find /Applications/Xcode.app -name "libswiftos.dylib"
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/appletvos/libswiftos.dylib
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/appletvsimulator/libswiftos.dylib
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftos.dylib
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/libswiftos.dylib
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/libswiftos.dylib
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/watchos/libswiftos.dylib
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/watchsimulator/libswiftos.dylib



## Additional version info (brief)

Xamarin Studio 6.1.2.38 (8937e51ff879e4062e660a70d13463510a2664c4)
Xamarin.iOS 10.0.2.3 (26328e0)
Mono 4.6.1 (mono-4.6.0-branch/2f4c98b) (64-bit)

Xcode 8.1 (11542), Build 8T61a
Mac OS X 10.11.6
Comment 1 Brendan Zagaeski (Xamarin Support) 2016-10-24 21:23:40 UTC
## Apparent change between Xcode 8.1 beta 3 and Xcode 8.1 GM

For thorough bookkeeping, I will record that testing on the previous Xcode 8.1 preview (Xcode 8.1 beta 3) did not hit this same issue, so this appears to be a change between the last beta and the GM.
Comment 2 Sebastien Pouliot 2016-10-24 21:36:19 UTC
The mentioned framework was removed in GM
Comment 5 Brendan Zagaeski (Xamarin Support) 2016-10-24 22:18:45 UTC
## Additional info for completeness: Deploying to device hits a similar error

> warning MT1043: Failed to launch the application using the instruments
> service. Will try launching the app using gdb service.
> 
> error MT1007: Failed to launch the application
> '/Users/Shared/Projects/UnifiedSingleViewIphone1/UnifiedSingleViewIphone1/
> bin/iPhoneSimulator/Debug/UnifiedSingleViewIphone1.app'
> on the device: Object reference not set to an instance of an
> object. You can still launch the application manually by tapping on
> it.
Comment 6 Brendan Zagaeski (Xamarin Support) 2016-10-24 23:01:26 UTC
## Corrected steps to replicate

There were a couple of typos in what I wrote in Comment 0.  Here are the corrected steps in case they might be needed during verification:

1. Create a new "iOS > App > Single View App (C#)" in Xamarin Studio.  For the purposes of this bug, please select "iOS 9.3" as the Target.

2. Select the Debug configuration, and select an iOS 10.1 simulator from the configuration menu.

3. Select "Run > Start Debugging".
Comment 7 Vincent Dondain [MSFT] 2016-10-24 23:29:55 UTC
*** Bug 45856 has been marked as a duplicate of this bug. ***
Comment 8 Brendan Zagaeski (Xamarin Support) 2016-10-24 23:35:57 UTC
Correction for Comment 4 (and Comment 4 now marked non-public since it's obsolete):

## One indelicate temporary workaround (in case any users come looking for this before the fix in Comment 3 is published)

As I understand it, the candidate fix for this issue simply skips attempting to load the library.  Accordingly, I tried creating an empty "dummy" dynamic library by running the following command in a Terminal.app command prompt (be sure to skip the ``` delimiters when copy-pasting these lines into Terminal):

```
FILE="`mktemp`" &&
mv -n "$FILE" "$FILE.c" &&
clang -dynamiclib "$FILE.c" -o /tmp/libswiftos.dylib &&
mv -n /tmp/libswiftos.dylib /Applications/Xcode.app/Contents/Frameworks/
```

That allowed me to deploy to the simulator and device.  As a quick additional sanity check, I was also able to hit breakpoints in the simulator and device with that setup.
Comment 9 Mohit Kheterpal 2016-10-26 14:23:55 UTC
I have checked this issue and observed that now XS is able to open iOS simulator 10.1.

Hence closing this issue by marking it as verified fixed.

Environment info :
=== Xamarin Studio Enterprise ===

Version 6.1.1 (build 17)
Installation UUID: fd96f29c-8917-44db-ad82-5331551e9d03
Runtime:
	Mono 4.6.1 (mono-4.6.0-branch-c8sr0/ef43c15) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 406010005

=== NuGet ===

Version: 3.4.3.0

=== Xamarin.Profiler ===

Not Installed

=== Apple Developer Tools ===

Xcode 8.1 (11542)
Build 8T61a

=== Xamarin.iOS ===

Version: 10.2.0.4 (Xamarin Enterprise)
Hash: b638977
Branch: xcode8.1
Build date: 2016-10-25 14:38:48-0400

=== Xamarin.Android ===

Version: 7.0.1.3 (Xamarin Enterprise)
Android SDK: /Users/xamarin77/Desktop/android-sdk-macosx_êèéæâàçéè€ÿëïœ_a
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		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)

SDK Tools Version: 25.2.2
SDK Platform Tools Version: 24.0.3
SDK Build Tools Version: 24.0.3

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 Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: 2.10.0.105 (Xamarin Enterprise)

=== Build Information ===

Release ID: 601010017
Git revision: 44d481a9be9cf2bf7c01bfb99c59b77dfa08e712
Build date: 2016-10-25 14:27:24-04
Xamarin addins: 19cdb28081bf28d9688698030abb96e04e391f69
Build lane: monodevelop-lion-cycle8-sr0

=== Operating System ===

Mac OS X 10.12.0
Darwin Xamarin77Macmini.local 16.0.0 Darwin Kernel Version 16.0.0
    Mon Aug 29 17:56:20 PDT 2016
    root:xnu-3789.1.32~3/RELEASE_X86_64 x86_64

=== Enabled user installed addins ===

Gist Ide Information 1.0.2
Addin Maker 1.3.2
NuGet Package Management Extensions 0.11.1
Manifest.addin 0.0.0.0
Comment 10 Brendan Zagaeski (Xamarin Support) 2016-11-01 21:35:24 UTC
*** Bug 46172 has been marked as a duplicate of this bug. ***
Comment 11 adrianknight89 2016-12-01 02:32:23 UTC
I'm running into this exact issue even though it says it's fixed.
Comment 12 Brendan Zagaeski (Xamarin Support) 2016-12-01 02:43:44 UTC Comment hidden (obsolete)
Comment 13 Brendan Zagaeski (Xamarin Support) 2016-12-01 02:45:54 UTC
(Typo correction for Comment 12)

By default the best option in a case like Comment 11 (especially on a bug that has been marked "verified fixed" for a little while) is to file a new bug report, being sure to include your detailed version information.  Thanks in advance!

As a quick point of comparison, I can successfully deploy to iOS 10.1 simulators today using Xcode 8.1, Build version 8B62 and the current Stable channel of Xamarin on Mac OS 10.11.6.  (And to be extra careful in my observations, that is _without_ applying the hack from Comment 8.)
Comment 14 adrianknight89 2016-12-01 02:49:52 UTC
Thanks Brendan. Updating Xamarin fixed the issue.

Note You need to log in before you can comment on or make changes to this bug.