Magick.NET
Magick.NET copied to clipboard
Support macOS ARM64 (Apple Silicon)
Is your feature request related to a problem? Please describe
Not a problem. Enhancement.
Describe the solution you'd like
- Generate a build variant for
osx-arm64
.
Describe alternatives you've considered
None available
Additional context
If the build system for the native shared libraries uses the XCode toolchain on macOS, this enhancement should be trivial to produce.
I don't think GitHub currently offers support for managed arm64 builds. Feel free to open up a pull requests in https://github.com/dlemstra/Magick.Native if it is trivial to add support for this.
I don't think GitHub currently offers support for managed arm64 builds. Feel free to open up a pull requests in https://github.com/dlemstra/Magick.Native if it is trivial to add support for this.
@dlemstra Does this mean Magick.Native is built using Github actions?
If so, you're probably right, and I'll hold for that platform support and then submit a PR.
Magick.Native is indeed build with GitHub actions.
Magick.Native is indeed build with GitHub actions.
Looks like the needed image (macOS Big Sur) needed to produce Apple Silicon binaries is on a private preview. https://github.com/actions/virtual-environments/issues/2486
Apparently, you can request early access here: https://github.com/actions/virtual-environments/blob/main/docs/macos-11-onboarding.md
I think your eventual request would be approved because of the value and usage of this library.
@dlemstra GitHub actions seems to officially support macOS 11.
Maybe this would enable native ARM64 builds? I'll submit a PR soon.
https://github.com/actions/virtual-environments
Is it possible to build Magick.NET and Magick.Native locally for arm64?
Maybe? I don't have access to an arm64
machine so I don't know.
Is it possible to build Magick.NET and Magick.Native locally for arm64?
It very much should. Assuming @dlemstra uses "standard" macOS tools to build the native bits, it should be pretty simple to just add the arm64
target and it should build the same.
For building, you don't even need an Apple Silicon machine; just their latest OS (Big Sur).
I may take a stab at it this week.
I'd appreciate the assist on this. I've had a lot of trouble getting the Homebrew-based tooling to collect the dependencies and compile Magick.Native. It's very likely that I simply don't understand the structure of the project very well.
I need this too. Actually, this is the only thing left that prevents me from creating an Apple Silicon version of my .NET 6 app. Let me know if I can help you in any way.
PS: At least the .NET / C# and Swift compilers seem to have no problems creating Apple Silicon binaries on the GitHub Actions infrastructure (macOS x64).
I have an Apple M1 and a project that utilize Magick.NET. I'm getting an error at runtime and was hoping someone can point me to the right direction to resolve.
Please note: we only get the error when running on dotnet 6.0 with Apple M1. Running on dotnet 5.0 with x64 is fine.
In my csproj file, I have the following defined
<PackageReference Include="Magick.NET.Core" Version="8.3.3" />
<PackageReference Include="Magick.NET-Q8-AnyCPU" Version="8.3.3" />
At rumtime, we get this error
Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware: Error: An unhandled exception has occurred while executing the request.
System.TypeInitializationException: The type initializer for 'NativeMagickSettings' threw an exception.
---> System.DllNotFoundException: Unable to load shared library 'Magick.Native-Q8-x64.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(libMagick.Native-Q8-x64.dll, 0x0001): tried: 'libMagick.Native-Q8-x64.dll' (no such file), '/usr/local/lib/libMagick.Native-Q8-x64.dll' (no such file), '/usr/lib/libMagick.Native-Q8-x64.dll' (no such file), '/Users/tiendinh/Projects/oraid/OraIdApi/OraIdApi/libMagick.Native-Q8-x64.dll' (no such file), '/usr/local/lib/libMagick.Native-Q8-x64.dll' (no such file), '/usr/lib/libMagick.Native-Q8-x64.dll' (no such file)
at ImageMagick.Environment.NativeMethods.X64.Environment_Initialize()
at ImageMagick.Environment.NativeEnvironment.Initialize() in /_/src/Magick.NET/Native/Helpers/Environment.cs:line 47
at ImageMagick.Environment.Initialize() in /_/src/Magick.NET/Helpers/Environment.cs:line 19
at ImageMagick.MagickSettings.NativeMagickSettings..cctor() in /_/src/Magick.NET/Native/Settings/MagickSettings.cs:line 230
--- End of inner exception stack trace ---
at ImageMagick.MagickSettings.NativeMagickSettings..ctor() in /_/src/Magick.NET/Native/Settings/MagickSettings.cs:line 246
at ImageMagick.MagickSettings..ctor() in /_/src/Magick.NET/Settings/MagickSettings.cs:line 33
at ImageMagick.MagickImage..ctor() in /_/src/Magick.NET/MagickImage.cs:line 39
at ImageMagick.MagickImage..ctor(Stream stream) in /_/src/Magick.NET/MagickImage.cs:line 187
The line of code that throw the error is
var image = new MagickImage(stream);
It looks like it trying to find the file Magick.Native-Q8-x64.dll
. Not sure why, our project is referencing Magick.NET-Q8-AnyCPU
Maybe Magick.NET needs to be upgraded to target/support .NET 6 first?
For reference, .NET 6 was just released this week and it's the first version to support macOS/ARM64.
This project doesn't support ARM64 and that is why you are getting that exception @timdinhdotcom.
Does anyone know how to complete this lib to run on M1?
ImageMagick is supported native on M1 mac so adding support for this shouldn't be that complicated, right? please correct me if I'm wrong
Feel free to open a pull request in the Magick.Native project to add support for this @fahelmoreira if you think this is not complicated?
I'll be happy to! if someone can send me the documentation for this project since I am not familiar with this project. I pull the code but I'm having some issues building this project. but yeah! I would be glad to help! 🙂
You will need to compile the Magick.Native project with ARM64 support. That project is the native library that is used by this project.
Ok, I'm running this on a mac and it looks like that is the install.sh is incompleted when compared to the install.ps1, there are a lot of methods missing
Has there been any progress on macOS Support? Would be great! 🙏
There is no progress and this probably needs to be done through cross compilation. Let's hope someone picks this up.
I don't need this anymore, moved to ImageSharp because of missing arm64 support. (Hope it is okay to mention it, you seem to be involved in this project also.)
That could be an alternative depending on which formats you need to read so I don't mind you mentioning that. But I now just don't have the time to struggle with the GitHub CI and get a cross compilation to work.
Is there any update on this? Thanks.
If I have followed the the linked threads correctly - apple silicon support has been merged into magick.Native and we are just waiting for the github CI and dotnet wrappers to get this working?
It will become available in the next release of Magick.NET but I am not able to give you an estimate when this will become available.