Skip to content

Apple Silicon M1 Pro: Unable to load shared library 'libdl.so' #39

Open
@pieterdhondt

Description

@pieterdhondt

Using code:

private async Task<string> GetThumbnailBase64(byte[] imageBytes)
{
       using (var b = new ImageJob())
        {
            var r = await b.Decode(imageBytes)
                .ResizerCommands("width=100&height=100&mode=crop")
                .EncodeToBytes(new MozJpegEncoder(50,true))
                .Finish().InProcessAsync();

            var base64thumbnail = r.First.TryGetBytes().HasValue ? Convert.ToBase64String(r.First.TryGetBytes().Value) : null;
            return base64thumbnail;
        }       
}

I am not able to use the library on a Mac with M1 Pro on macOS 12.0.1.
It throws the following exception:

System.DllNotFoundException: Unable to load shared library 'libdl.so' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(liblibdl.so, 0x0001): tried: 'liblibdl.so' (no such file), '/usr/local/lib/liblibdl.so' (no such file), '/usr/lib/liblibdl.so' (no such file), '/Users/pieterdhondt/Git/topics-service/TopicsService.Api/liblibdl.so' (no such file), '/usr/local/lib/liblibdl.so' (no such file), '/usr/lib/liblibdl.so' (no such file)
         at Imageflow.Bindings.UnixLoadLibrary.dlopen(String fileName, Int32 flags)
         at Imageflow.Bindings.UnixLoadLibrary.Execute(String fileName)
         at Imageflow.Bindings.NativeLibraryLoader.LoadLibrary(String fullPath, IntPtr& handle, Nullable`1& errorCode)
         at Imageflow.Bindings.NativeLibraryLoader.TryLoadByBasenameInternal(String basename, ILibraryLoadLogger log, IntPtr& handle, IEnumerable`1 customSearchDirectories)
         at Imageflow.Bindings.NativeLibraryLoader.TryLoadByBasename(String basename, ILibraryLoadLogger log, IntPtr& handle, IEnumerable`1 customSearchDirectories)
         at Imageflow.Bindings.NativeLibraryLoader.FixDllNotFoundException[T](String basename, Func`1 invokingOperation, IEnumerable`1 customSearchDirectories)
         at Imageflow.Bindings.JobContextHandle..ctor()
         at Imageflow.Bindings.JobContext..ctor()
         at Imageflow.Fluent.ImageJob.FinishAsync(JobExecutionOptions executionOptions, SecurityOptions securityOptions, CancellationToken cancellationToken)

The same code runs fine on Windows or within a Linux container.

Any advice?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions