Magick.NET does not copy libraries to the correct location on macOS (or Linux)
See original GitHub issueMagick.NET version
10.1.0
Environment (Operating system, version and so on)
macOS Big Sur 11.6.3
Description
Magick.NET does not copy libraries to the correct location on macOS (or Linux).
When running I get the following error:
Magick.NET-Q8-AnyCPU: The type initializer for 'ImageMagick.MagickFormatInfo' threw an exception.
Magick.NET-Q8-AnyCPU: The type initializer for 'NativeMagickFormatInfo' threw an exception.
Magick.NET-Q8-AnyCPU: 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, 1): image not found.
It can be solved by (with the output directory as current directory) copying runtimes/osx-x64/native/Magick.Native-Q8-x64.dll.dylib
to bin/Magick.Native-Q8-x64.dll
.
In my Azure Function Dockerfile that uses this library I have the following in the runtime image which solves the problem there:
RUN cp /home/site/wwwroot/bin/runtimes/linux-x64/native/Magick.Native-Q8-x64.dll.so \
/home/site/wwwroot/bin/Magick.Native-Q8-x64.dll
This has been an issue for years now, it would be great if a real fix could be implemented. If the project maintainers do not wish to do this, please give me some pointers on where the logic that fixes this should be introduced and I’ll give it a whack.
Steps to Reproduce
Use the Magick.NET package on anything that isn’t Windows.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:13 (3 by maintainers)
Top Results From Across the Web
CrossPlatform.md
Getting Magick.NET working on Mono sometimes requires an extra step. The Magick.NET.Native library is not always automatically copied to the output directory ...
Read more >Calling ImageMagick from C# (.net 6) on OSX
Im trying to use ImageMagick in a C# application on OSX. My constraint is that I'm not allowed to install IM on the...
Read more >Exception thrown on Linux - Magick.NET
I have the Magick.NET.Native library loading, but the underlying ImageMagick libraries are still failing with 'ImageMagick.
Read more >ImageMagick – Convert, Edit, or Compose Digital Images
Use ImageMagick® to create, edit, compose, and convert digital images. Resize an image, crop it, change its shades and colors, add captions, and...
Read more >The magick package: Advanced Image-Processing in R
The magick package provide a modern and simple toolkit for image processing in R. It wraps the ImageMagick STL which is the most ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I should add an explanation about this to the documentation. You can now do the following in your
.csproj
file:And then it should copy the binaries.
Well I have issues on my Mac. I use this package in a subproject to an Azure Function, whenever I try to debug the Azure function using the Azure Functions runtime utilities I have to quickly copy the
bin/output/runtimes/osx-x64/native/Magick.Native-Q8-x64.dll.dylib
to thebin/output/
directory otherwise .NET doesn’t find it.