-
Notifications
You must be signed in to change notification settings - Fork 422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker Image Error on arm64 Linux EC2 Instance #183
Comments
+1 me too. 25/1/2024
|
this issue happen because it cant find
you need to create class internal class CustomAssemblyLoadContext : AssemblyLoadContext
{
public IntPtr LoadUnmanagedLibrary(string absolutePath)
{
return LoadUnmanagedDll(absolutePath);
}
protected override IntPtr LoadUnmanagedDll(string unmanagedDllName)
{
return LoadUnmanagedDllFromPath(unmanagedDllName);
}
protected override Assembly Load(AssemblyName assemblyName)
{
throw new NotImplementedException();
}
} and in program.cs string libraryPath = "";
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
// Load .dll for Windows
libraryPath = "libwkhtmltox.dll";
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
// Load .so for Linux
libraryPath = "libwkhtmltox.so";
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
// Load .dylib for macOS
libraryPath = "libwkhtmltox.sylib";
}
var loadContext = new CustomAssemblyLoadContext();
var fullpath = Path.Combine(Directory.GetCurrentDirectory(), libraryPath);
IntPtr libraryHandle = loadContext.LoadUnmanagedLibrary(Path.Combine(Directory.GetCurrentDirectory(), libraryPath));
// Pastikan library berhasil dimuat
if (libraryHandle == IntPtr.Zero)
{
Console.WriteLine("Failed to load the library.");
return;
}
Console.WriteLine("Library loaded successfully."); hope you can solve it |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am currently using a package in my application, which functions seamlessly on my system and an x64 Linux server. However, as part of our cost optimization efforts, we are planning to migrate our application to an arm64 EC2 instance.
During the process of running the Docker image on arm64, we encountered the following error:
Unhandled exception. System.DllNotFoundException: Unable to load shared library '/app/libwkhtmltox.so' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: /app/libwkhtmltox.so: cannot open shared object file: No such file or directory
The Dockerfile used in our project is as follows:
We've explored several solutions to resolve this issue without success. Could you please help us identify and address the problem? Is there any commercial support available from your side? We are open to discussing potential solutions that align with our needs.
The text was updated successfully, but these errors were encountered: