Bug 35562 - mtouch - error MT0000: Unexpected error - System.DllNotFoundException: libc
Summary: mtouch - error MT0000: Unexpected error - System.DllNotFoundException: libc
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: XI 9.0 (iOS9)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2015-11-04 19:17 UTC by Damon Bohls
Modified: 2015-11-10 06:38 UTC (History)
4 users (show)

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

path showing where mtouch is located (165.56 KB, image/png)
2015-11-04 20:43 UTC, Damon Bohls

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Damon Bohls 2015-11-04 19:17:03 UTC
Starting with Xcode 7 (both 7.0.1 and 7.1) and with Xamarin.iOS 9 (I've tried and and it occurs in both) I get the following error:

/Developer/MonoTouch/usr/bin/mtouch --installdev=./objects/export/targets/iphoneos/universal/xcode6.1-clang6.0/enterprise/nisfpguiMonoTouch.app
warning MT0061: No Xcode.app specified (using --sdkroot), using the system Xcode as reported by 'xcode-select --print-path': /Applications/Xcode.app/Contents/Developer
Please ensure your device is connected...
Connected to: MFI's mini black and blue ipad
Installing application bundle
error MT0000: Unexpected error - Please file a bug report at http://bugzilla.xamarin.com
System.DllNotFoundException: libc
at (wrapper managed-to-native) MonoTouch.Installation.InstallationProxyService.dup (int) <0x000d3>
at MonoTouch.Installation.InstallationProxyService.InstallApplicationBundle (string,MonoTouch.MobileDevice.ProgressCallback) <0x0052a>
at MonoTouch.Installation.Installer.InstallApplicationBundle (MonoTouch.Installation.Device,string) <0x0010b>
at MonoTouch.Installation.Installer/<InstallApplicationWithoutSymbols>c__AnonStorey2.<>m__1 (MonoTouch.Installation.Device) <0x0008b>
at MonoTouch.Installation.Installer/<ExecuteWithSession>c__AnonStorey0.<>m__0 (object,System.EventArgs) <0x00128>
at MonoTouch.Installation.Device.NotificationCallback (MonoTouch.MobileDevice.am_device_notification_callback_info&) <0x00090>
at (wrapper native-to-managed) MonoTouch.Installation.Device.NotificationCallback (MonoTouch.MobileDevice.am_device_notification_callback_info&) <0x0008c>
at (wrapper managed-to-native) MonoMac.CoreFoundation.CFRunLoop.CFRunLoopRun () <0x00059>
at MonoMac.CoreFoundation.CFRunLoop.Run () <0x00010>
at MonoTouch.Installation.Installer.ExecuteWithSession (string,MonoTouch.Installation.Installer/Executor) <0x00200>
at MonoTouch.Installation.Installer.InstallApplicationWithoutSymbols (string,string) <0x001e2>
at MonoTouch.Installation.Installer.InstallApplication (string,string,bool) <0x00068>
at MTouch.Main2 (string[]) <0x053b8>
at MTouch.Main (string[]) <0x00024>

Both the warning about Xcode and the error are new.
Comment 1 Sebastien Pouliot 2015-11-04 20:22:43 UTC
Where does that command comes from ? XS ?

> /Developer/MonoTouch/

^ this directory was not used, directly (symlinks exists), for several versions.

The error looks like you're using an old `mtouch` on OSX El Capitan.

Can you

1. Run the following command and paste the result here ?

> /Developer/MonoTouch/usr/bin/mtouch --version

2. Provide all* the version information ?

* The easiest way to get exact version information is to use the "Xamarin Studio" menu, "About Xamarin Studio" item, "Show Details" button and copy/paste the version informations (you can use the "Copy Information" button).
Comment 2 Damon Bohls 2015-11-04 20:37:38 UTC
We have a bash script that runs that command in a shell. I think we are all using OS X 10.10.5 and none of us are using El Capitan.

1. Here's what I get:

damonsmac:~ damonbohls$ /Developer/MonoTouch/usr/bin/mtouch --version
mtouch (xcode7-c5: d8e9592)
damonsmac:~ damonbohls$ 

2. Here's all the information.

=== Xamarin Studio ===

Version 5.9.8 (build 0)
Installation UUID: 101f315c-fe62-4893-9f4e-78a187a6d31a
	Mono 4.0.5 ((detached/1d8d582)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400050001

=== Apple Developer Tools ===

Xcode 7.0.1 (8228)
Build 7A1001

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: d8e9592
Branch: master
Build date: 2015-09-18 23:22:05-0400

=== Xamarin.Mac ===

Version: (Starter Edition)

=== Xamarin.Android ===

Version: (Starter Edition)
Android SDK: /Users/damonbohls/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
Java SDK: /usr
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)

=== Xamarin Android Player ===

Not Installed

=== Build Information ===

Release ID: 509080000
Git revision: cc5f6e5658589ca7f46210c57fad947e75f30abd
Build date: 2015-10-21 19:27:41-04
Xamarin addins: d77f191bd7d3451adf837b85b38f2b7c60004400

=== Operating System ===

Mac OS X 10.10.5
Darwin damonsmac.amer.corp.natinst.com 14.5.0 Darwin Kernel Version 14.5.0
    Tue Sep  1 21:23:09 PDT 2015
    root:xnu-2782.50.1~1/RELEASE_X86_64 x86_64
Comment 3 Damon Bohls 2015-11-04 20:43:00 UTC
Created attachment 13680 [details]
path showing where mtouch is located
Comment 4 Damon Bohls 2015-11-04 20:47:30 UTC
You can see in attachment, /Developer/MonoTouch doesn't appear to be a symlink but bin is.
Comment 5 Damon Bohls 2015-11-04 20:51:52 UTC
I just tried the following command pasted directly into a shell:

damonsmac:15.1.5 damonbohls$ /Developer/MonoTouch/usr/bin/mtouch --installdev=./objects/export/targets/iphoneos/universal/xcode6.1-clang6.0/enterprise/nisfpguiMonoTouch.app
warning MT0061: No Xcode.app specified (using --sdkroot), using the system Xcode as reported by 'xcode-select --print-path': /Applications/Xcode.app/Contents/Developer
Please ensure your device is connected...
Connected to: MFI's mini black and blue ipad
Installing application bundle
Application bundle installed
damonsmac:15.1.5 damonbohls$ 

You can see it worked this time. Usually, we run it as a command from our make. E.g. -

"make installOurApp"

Which should just run the mtouch command in a shell. Not sure what is different.
Comment 6 Sebastien Pouliot 2015-11-04 20:56:18 UTC
I suspect your script changes (or undefine) some environment variables that is used to load the native (libc) library.


$ export

from the terminal and also add a line to print the same from your script, then compare if they are identical.
Comment 9 Damon Bohls 2015-11-05 13:35:24 UTC
We run a shell script that sets up the shell environment for our build tools.

Basically, we have been setting up this environment and then using mtouch to install our app for years with no problems. Now, with Xamarin.iOS 9.X, it doesn't work. I have attached (privately) the export output for both before I run our setup script and after. Now, I am confident that it is something in mtouch that changed that is causing us to fail now. I installed multiple version versions of Xamarin.iOS ( and and mtouch succeeds with those version after running our setup script. Starting with version and onward, mtouch fails. It seems clear to me that something about mtouch changed. Please let me know what else I can provide.
Comment 10 Damon Bohls 2015-11-05 13:46:41 UTC
I'd also like to add that I say it is something about mtouch that changed, I didn't intend that to sound as though I'm pointing fingers. It could be that there was some flaw we've been exploiting and it has now been patched. But the breaking change seems to have occurred in mtouch, and I'd like us to figure out is we need to fix something or if something needs to be fixed in mtouch.
Comment 12 Sebastien Pouliot 2015-11-05 14:09:17 UTC
@Damons np, that's fine :-) I suspect it might be part of the (mono) changes we had to make for El Capitan compatibility.

Like @Rolf said you might want to try adding ":/lib:/usr/lib" to your script's DYLD_FALLBACK_LIBRARY_PATH variable. That should fix it and it can also fix similar issues in other tools you might call.

Let us know if it works, we'll test and fix this for future releases. Thanks
Comment 13 Damon Bohls 2015-11-05 14:11:28 UTC
Hi Rolf.

For $(HOME) I get "command not found". Would ~ suffice there? I don't see a lib
folder with "ls -a" after "cd ~".
Comment 14 Damon Bohls 2015-11-05 14:14:43 UTC
That worked for my issue. I'll work with our build team to get this fixed on our side. I appreciate the help. Thanks Sebastien and Rolf!
Comment 15 Damon Bohls 2015-11-05 14:42:57 UTC
Setting this as answered since we understand the problem.
Comment 16 Rolf Bjarne Kvinge [MSFT] 2015-11-10 06:38:45 UTC

maccore/master: f8eaeeb44a8340f98c470734c537febb63d1eb5f