MissionPlanner.exe with Mono on Mac Big Sur fails with System.DllNotFoundException

I’ve tried to get Mission Planner working on my Mac running Big Sur using mono (as recommended on the GitHub project page) and it fails with:
System.DllNotFoundException: libdl.so assembly

The full error output is below. I’ve googled extensively and I can’t figure out how to get it to work. Help!

If your error is about Microsoft.DirectX.DirectInput, please install the latest directx redist from here http://www.microsoft.com/en-us/download/details.aspx?id=35

Debug under mono MONO_LOG_LEVEL=debug mono MissionPlanner.exe
To fix any filename case issues under mono use export MONO_IOMAP=drive:case
Data Dir /Users/tim/Mission Planner/
Log Dir /Users/tim/Mission Planner/logs
Running Dir /Users/tim/arduplane/mono/MissionPlanner-2021-09-02/
User Data Dir /Users/tim/Mission Planner/
WARNING: The Carbon driver has not been ported to 64bits, and very few parts of Windows.Forms will work properly, or at all
INFO MissionPlanner.Program - ******************* Logging Configured *******************
INFO MissionPlanner.Program - /Users/tim/arduplane/mono/MissionPlanner-2021-09-02/x64/libSkiaSharp
ERROR MissionPlanner.Program - System.DllNotFoundException: libdl.so assembly: type: member:(null)
at (wrapper managed-to-native) MissionPlanner.Utilities.NativeLibrary.dlopen(string,int)
at MissionPlanner.Program.Start (System.String[] args) [0x00302] in :0

Native Crash Reporting

Got a segv while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.

Native stacktrace:

0x101b1b7c9 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono : mono_dump_native_crash_info
0x101ab369e - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono : mono_handle_native_crash
0x101b15946 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono : altstack_handle_and_restore
0x7fff24f23eac - /System/Library/PrivateFrameworks/SkyLight.framework/Versions/A/SkyLight : SLDisplayBounds
0x1076ecbc8 - Unknown
0x1064748e6 - Unknown
0x101a10962 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono : mono_jit_runtime_invoke
0x101c21972 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono : mono_runtime_try_invoke
0x101c20598 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono : mono_runtime_class_init_full
0x101a0843c - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono : mono_jit_compile_method_inner
0x101a0beba - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono : mono_jit_compile_method_with_opt
0x101ab61ae - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono : common_call_trampoline
0x101ab5c00 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono : mono_magic_trampoline
0x101eea393 - Unknown
0x10762e00b - Unknown
0x107645c78 - Unknown
0x106b2adcb - Unknown
0x101f690b3 - Unknown
0x101a10962 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono : mono_jit_runtime_invoke
0x101c1ff97 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono : mono_runtime_invoke_checked
0x101c2845e - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono : do_exec_main_checked
0x101a70e1e - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono : mono_jit_exec
0x101a74085 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono : mono_main
0x101a00178 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono : main
0x7fff20473f3d - /usr/lib/system/libdyld.dylib : start
0x2 - Unknown

Telemetry Dumper:

Pkilling 0x123145331355648x from 0x4421520896x
Entering thread summarizer pause from 0x4421520896x
Finished thread summarizer pause from 0x4421520896x.
Failed to create breadcrumb file (null)/crash_hash_0x9f0b05bf4

Waiting for dumping threads to resume

External Debugger Dump:

Basic Fault Address Reporting

Memory around native instruction pointer (0x7fff24f23eac):0x7fff24f23e9c 53 50 48 89 fb 48 8b 05 b0 6d 73 62 48 8b 48 18 SPH…H…msbH.H.
0x7fff24f23eac 48 89 4f 18 48 8b 48 10 48 89 4f 10 48 8b 08 48 H.O.H.H.H.O.H…H
0x7fff24f23ebc 8b 40 08 48 89 47 08 48 89 0f 89 f7 48 89 de e8 .@.H.G.H…H…
0x7fff24f23ecc 58 34 fb ff 48 89 d8 48 83 c4 08 5b 5d c3 55 48 X4…H…H…[].UH

Managed Stacktrace:

  at <unknown> <0xffffffff>
  at System.Windows.Forms.XplatUICarbon:CGDisplayBounds <0x000b7>
  at System.Windows.Forms.XplatUICarbon:get_WorkingArea <0x00072>
  at System.Windows.Forms.XplatUICarbon:get_VirtualScreen <0x00043>
  at System.Windows.Forms.XplatUI:get_VirtualScreen <0x00048>
  at System.Windows.Forms.Screen:.cctor <0x0017a>
  at System.Object:runtime_invoke_void <0x000a5>
  at <unknown> <0xffffffff>
  at System.Windows.Forms.Form:get_CreateParams <0x0062a>
  at System.Windows.Forms.Form:SetClientSizeCore <0x001c7>
  at System.Windows.Forms.Control:set_ClientSize <0x00048>
  at System.Windows.Forms.Form:set_ClientSize <0x00052>
  at System.Windows.Forms.Form:UpdateWindowText <0x00082>
  at System.Windows.Forms.Control:set_Text <0x000ac>
  at System.Windows.Forms.Form:set_Text <0x0004a>
  at MissionPlanner.Splash:InitializeComponent <0x00b10>
  at MissionPlanner.Splash:.ctor <0x0005a>
  at MissionPlanner.Splash:.ctor <0x0006a>
  at MissionPlanner.Program:Start <0x00f42>
  at MissionPlanner.Program:Main <0x00042>
  at <Module>:runtime_invoke_void_object <0x000b0>

Abort trap: 6

Would you perhaps give this a go? https://github.com/ArduPilot/MissionPlanner/actions/runs/1190154293
You’ll find a native MacOS executable down as an Artifact.

How wonderful it would be if MP was programmed in QT or any other multiplatform IDE for a world after 1990s , instead of that .NET garbage.
…I can dream…
You can consider AP2 and QGC in the meantime.

Agreed - I’m going with QGroundControl. Downloaded, installed, works.

I’ll give it a go, thanks @james_pattison

Got this error message @james_pattison

Unhandled Exception:
System.DllNotFoundException: Could not find the runtime library libxammac.dylib
at ObjCRuntime.Runtime.LookupInternalFunction[T] (System.String name) [0x000a6] in :0
at ObjCRuntime.Runtime.EnsureInitialized () [0x00036] in :0
at AppKit.NSApplication.Init () [0x00016] in :0
at Xamarin.MacOS.MainClass.Main (System.String[] args) [0x00000] in <0e3a4e7942894b1fbda4c9f79f98298a>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.DllNotFoundException: Could not find the runtime library libxammac.dylib
at ObjCRuntime.Runtime.LookupInternalFunction[T] (System.String name) [0x000a6] in :0
at ObjCRuntime.Runtime.EnsureInitialized () [0x00036] in :0
at AppKit.NSApplication.Init () [0x00016] in :0
at Xamarin.MacOS.MainClass.Main (System.String[] args) [0x00000] in <0e3a4e7942894b1fbda4c9f79f98298a>:0

Ok. I’m not a Mac user, so can’t really help further - Missionplanner Mac builds are still experimental, I was jut hoping it might have worked for you.
As far as I know most Mac users run MissionPlanner in Parallels. Is that an option for you?
QGC is fine for most things but you miss a lot of functionality.

Thanks. In the past I could not find it.

So I tried it on a Mac Mini 2014 with Mojave 10.14.6 with a SITL simulation on another window. It almost works:

So it stops with this window:
and I don’t know how to go on. Occasionally it seems to go further, but I don’t know if there is a difference or luck.

Trying the MP linux version I think the same happened, and there was a way to go on, which I can’t remember.

I can’t find it in my system, and it almost works.

@Michael_Oborne any clues?

i actualy made a change around this recently. also can i get some context around what you are connecting too? ie i see sitl, but looked like udp?

I don’t understand your question @Michael_Oborne. I am trying to run Mission Planner using mono on my Mac running Big Sur. It throws an error out of the gate and won’t even start.

running mission planner under mono directly like you tried hasn’t worked since apple remove xquarts support from osx. you need to use the method webillo is using

I got this directly from the read.me on GitHub https://github.com/ArduPilot/MissionPlanner

Launching Mission Planner on other system

Mission Planner can be use with Mono on non-Windows system. Be aware that all the functionnalities aren’t working.

What method is @Webillo using? I don’t see that he explained that.

I’m very confused. I downloaded the zip file recommended by @james_pattison but I can’t find a file in it called “Artifact”. What I did was just tried to execute the MissionPlanner.exe which is in the osx.zip file, using mono which gave the error I showed. Did I get it wrong? How am I supposed to run this thing?

you’re on a Mac, so I’d try the Mission Planner.APP file/package, not the exe. Forget about Mono. Not relevant for MP on Mac anymore,
As I said above: Mac support hasn’t been released, so no guarantees.

Got it - that seems to run, no errors. I’ll plug in my flight controller tomorrow and see if I can flash it.

What would it take to get it released?

That’s up to Michael, but testing is helpful

The SITL (…sim_vehicle.py…) simulation and MP run on the same machine (Intel Mac Mini). I see that MP connects automatically, and initially I don’t see how to avoid it. I will try TCP on different machines. All seems similar to trying MP on Linux in the past, with SITL on the Mac as here.

You should have this on the artifacts page above. Sign to GitHub and magically osx becomes a link to a file osx.zip, which expands to a directory osx. There you will find Mission Planner.app, so
open “Mission Planner.app”.

BTW1, I suppose you are not trying on M1.

BTW2, I tried the not to follow method:
mono “Mission Planner.exe”
and got:
You are using dlopen without a full path, retrying by prepending /usr/lib
Unhandled Exception:
System.DllNotFoundException: Could not find the runtime library libxammac.dylib

If trying:
MONO_LOG_LEVEL=debug mono MissionPlanner.exe

Mono: AOT: FOUND method System.OutOfMemoryException:.ctor (string) [0x102d83c80 - 0x102d83cbf 0x10320d59b]
Mono: AOT NOT FOUND: (wrapper runtime-invoke) :runtime_invoke_void__this___object (object,intptr,intptr,intptr).

Cannot open assembly ‘MissionPlanner.exe’: No such file or directory.