drywetmidi: DllNotFoundException on Apple Silicon chips

Hi! I’ve tried to get list of all MIDI devices on my MacBook m1 with .NET 6 but InputDevice.GetAll() throws

Unhandled exception. System.DllNotFoundException: Unable to load shared library 'Melanchall_DryWetMidi_Native64' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(libMelanchall_DryWetMidi_Native64, 0x0001): tried: 'libMelanchall_DryWetMidi_Native64' (no such file), '/usr/local/lib/libMelanchall_DryWetMidi_Native64' (no such file), '/usr/lib/libMelanchall_DryWetMidi_Native64' (no such file), '/Users/dvorobey/RiderProjects/Piano/Piano/bin/Debug/net6.0/libMelanchall_DryWetMidi_Native64' (no such file) at Melanchall.DryWetMidi.Multimedia.CommonApi64.GetApiType() at Melanchall.DryWetMidi.Multimedia.CommonApi64.Api_GetApiType() at Melanchall.DryWetMidi.Multimedia.MidiDevicesSession.GetSessionHandle() at Melanchall.DryWetMidi.Multimedia.MidiDevice.EnsureSessionIsCreated() at Melanchall.DryWetMidi.Multimedia.InputDevice.GetAll() at InputDeviceExample.Program.Main(String[] args) in /Users/dvorobey/RiderProjects/Piano/Piano/Program.cs:line 11 Here is a code that I tried to launch static void Main(string[] args) { var devices = InputDevice.GetAll(); } What I doing wrong?

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 43 (22 by maintainers)

Commits related to this issue

Most upvoted comments

@melanchall the nativeless version of this project works on Android and iOS great 😉

I have a proper word for the results – AWESOME! Counts of passed tests are correct:

  • Core: 6317
  • Multimedia: 516

As for LoopbackDevice built by me, I built it using universal format, merging x86_64 and arm64 architectures. But maybe it works fine for dylibs, but need a bit different steps for apps. I’ve posted the question on Stack Overflow.

Man, Apple really shot themselves in the foot with this new architecture haha.

Absolutely agreed with you 😃

Well, I’ll build a prerelease NuGet package and let you know.

And many many many thank you, @ThaddeusChristopher. Support of Apple Silicon chips is a critical task in my opinion and I really don’t know how it could be solved without you.

Results:

Build started 7/26/2022 12:53:51 PM.
Test run for /Users/qadept/Documents/drywetmidi/drywetmidi/DryWetMidi.Tests/bin/ReleaseTest/net6.0/Melanchall.DryWetMidi.Tests.dll (.NETCoreApp,Version=v6.0)
Microsoft (R) Test Execution Command Line Tool Version 17.3.0 (arm64)
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
  Skipped CheckInputDevicesEquality_ViaEquals_DifferentDevices_Win [< 1 ms]
  Skipped CheckInputDevicesEquality_ViaEquals_SameDevices_Win [< 1 ms]
  Skipped CheckInputDevicesEquality_ViaOperator_DifferentDevices_Win [< 1 ms]
  Skipped CheckInputDevicesEquality_ViaOperator_SameDevices_Win [< 1 ms]
  Skipped GetInputDeviceProperty_DriverOwner_Win [< 1 ms]
  Skipped GetInputDeviceProperty_DriverVersion_Win [< 1 ms]
  Skipped GetInputDeviceProperty_Manufacturer_Win [< 1 ms]
  Skipped GetInputDeviceProperty_Product_Win [< 1 ms]
  Skipped GetInputDeviceProperty_UniqueId_Win [< 1 ms]
  Skipped GetInputDeviceSupportedProperties_Win [< 1 ms]
  Skipped InputDeviceIsInUse [< 1 ms]
  Skipped CheckOutputDevicesEquality_ViaEquals_DifferentDevices_Win [< 1 ms]
  Skipped CheckOutputDevicesEquality_ViaEquals_SameDevices_Win [< 1 ms]
  Skipped CheckOutputDevicesEquality_ViaOperator_DifferentDevices_Win [< 1 ms]
  Skipped CheckOutputDevicesEquality_ViaOperator_SameDevices_Win [< 1 ms]
  Skipped GetOutputDeviceProperty_Channels_Win [< 1 ms]
  Skipped GetOutputDeviceProperty_DriverOwner_Win [< 1 ms]
  Skipped GetOutputDeviceProperty_DriverVersion_Win [< 1 ms]
  Skipped GetOutputDeviceProperty_Manufacturer_Win [< 1 ms]
  Skipped GetOutputDeviceProperty_NotesNumber_Win [< 1 ms]
  Skipped GetOutputDeviceProperty_Options_Win [< 1 ms]
  Skipped GetOutputDeviceProperty_Product_Win [< 1 ms]
  Skipped GetOutputDeviceProperty_Technology_Win [< 1 ms]
  Skipped GetOutputDeviceProperty_UniqueId_Win [< 1 ms]
  Skipped GetOutputDeviceProperty_VoicesNumber_Win [< 1 ms]
  Skipped GetOutputDeviceSupportedProperties_Win [< 1 ms]
  Skipped OutputDeviceIsInUse [< 1 ms]

Passed!  - Failed:     0, Passed:   516, Skipped:     0, Total:   516, Duration: 21 m 34 s - /Users/qadept/Documents/drywetmidi/drywetmidi/DryWetMidi.Tests/bin/ReleaseTest/net6.0/Melanchall.DryWetMidi.Tests.dll (net6.0)

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:21:36.32

There is a TestResults folder but its output for this run seems to be empty. I’ll take it that’s a good sign?

Glad it was an easy thing, ha. Looks like core tests run fine:

qadept@QAs-Mac-mini drywetmidi % dotnet test DryWetMidi.Tests/Melanchall.DryWetMidi.Tests.csproj --blame --no-build --configuration ReleaseTest --filter "((FullyQualifiedName~Melanchall.DryWetMidi.Tests.Core|FullyQualifiedName~Melanchall.DryWetMidi.Tests.Common|FullyQualifiedName~Melanchall.DryWetMidi.Tests.Composing|FullyQualifiedName~Melanchall.DryWetMidi.Tests.Interaction|FullyQualifiedName~Melanchall.DryWetMidi.Tests.MusicTheory|FullyQualifiedName~Melanchall.DryWetMidi.Tests.Standards|FullyQualifiedName~Melanchall.DryWetMidi.Tests.Tools)&Name!=CheckValidFilesReadingByReferences)" --framework net6.0 --verbosity normal
Build started 7/25/2022 1:19:58 PM.
Test run for /Users/qadept/Documents/drywetmidi/drywetmidi/DryWetMidi.Tests/bin/ReleaseTest/net6.0/Melanchall.DryWetMidi.Tests.dll (.NETCoreApp,Version=v6.0)
Microsoft (R) Test Execution Command Line Tool Version 17.3.0 (arm64)
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.

Passed!  - Failed:     0, Passed:  6317, Skipped:     0, Total:  6317, Duration: 2 m 57 s - /Users/qadept/Documents/drywetmidi/drywetmidi/DryWetMidi.Tests/bin/ReleaseTest/net6.0/Melanchall.DryWetMidi.Tests.dll (net6.0)

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:03:12.18