You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unable to use OpenCvSharp4.official.runtime.linux-x64 on Amazon Linux 2023 AMI. The error is that The type initializer for 'OpenCvSharp.Internal.NativeMethods' threw an exception.
#1724
Open
dawnwjj opened this issue
Nov 22, 2024
· 1 comment
dotnet is 8.0.107 .
OS is the last Amazon Linux 2023 AMI and Architecture is 64-bit(x86).
What did you do when you faced the problem?
Just tried to run dotnet application to check the OpenCvSharp4.official.runtime.linux-x64 can be used on Amazon Linux 2023 or not.
Example code:
using OpenCvSharp;
using System;
class Program
{
static void Main()
{
try
{
File.AppendAllText("log.txt", $"Before new Mat " + Environment.NewLine);
using var src = new Mat("a.jpg", ImreadModes.Grayscale);
File.AppendAllText("log.txt", $"After {src} is ok!" + Environment.NewLine);
File.AppendAllText("log.txt", $"src {src.Size()}" + Environment.NewLine);
}
catch (Exception e)
{
File.AppendAllText("log.txt", $"Error : Exception is {e.Message}" + Environment.NewLine);
}
}
}
Output:
Before new Mat
Error : Exception is The type initializer for 'OpenCvSharp.Internal.NativeMethods' threw an exception.
I checked the libOpenCvSharpExtern.so like that.
# ldd libOpenCvSharpExtern.so
./libOpenCvSharpExtern.so: /lib64/libm.so.6: version `GLIBC_2.35' not found (required by ./libOpenCvSharpExtern.so)
linux-vdso.so.1 (0x00007fff821fc000)
libtesseract.so.4 => not found
libgtk-x11-2.0.so.0 => not found
libgdk-x11-2.0.so.0 => not found
libcairo.so.2 => not found
libgdk_pixbuf-2.0.so.0 => not found
libgobject-2.0.so.0 => /lib64/libgobject-2.0.so.0 (0x00007fd8fbf22000)
libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00007fd8f7ebd000)
libdc1394.so.25 => not found
libavcodec.so.58 => not found
libavformat.so.58 => not found
libavutil.so.56 => not found
libswscale.so.5 => not found
libjpeg.so.8 => not found
libpng16.so.16 => not found
libtiff.so.5 => not found
libopenjp2.so.7 => not found
libIlmImf-2_5.so.25 => not found
libz.so.1 => /lib64/libz.so.1 (0x00007fd8fbf04000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fd8f7c00000)
libm.so.6 => /lib64/libm.so.6 (0x00007fd8f7b25000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fd8f7ea3000)
libc.so.6 => /lib64/libc.so.6 (0x00007fd8f7800000)
/lib64/ld-linux-x86-64.so.2 (0x00007fd8fbf8c000)
libffi.so.8 => /lib64/libffi.so.8 (0x00007fd8fbef8000)
libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007fd8f7a87000)
What did you intend to be?
To compile and run ok.
The text was updated successfully, but these errors were encountered:
I also tried it on Amazon's Red Hat Enterprise Linux version 9 (HVM), EBS General Purpose (SSD) Volume Type AIM, but it didn't work.
I also ran this command “ldd libOpenCvSharpExtern.so” on Red Hat Enterprise Linux.
ldd libOpenCvSharpExtern.so
./libOpenCvSharpExtern.so: /lib64/libm.so.6: version `GLIBC_2.35' not found (req uired by ./libOpenCvSharpExtern.so)
linux-vdso.so.1 (0x00007ffdcb9fa000)
libtesseract.so.4 => not found
libgtk-x11-2.0.so.0 => not found
libgdk-x11-2.0.so.0 => not found
libcairo.so.2 => not found
libgdk_pixbuf-2.0.so.0 => not found
libgobject-2.0.so.0 => /lib64/libgobject-2.0.so.0 (0x00007f2d83407000)
libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00007f2d7f2c5000)
libdc1394.so.25 => not found
libavcodec.so.58 => not found
libavformat.so.58 => not found
libavutil.so.56 => not found
libswscale.so.5 => not found
libjpeg.so.8 => not found
libpng16.so.16 => not found
libtiff.so.5 => not found
libopenjp2.so.7 => not found
libIlmImf-2_5.so.25 => not found
libz.so.1 => /lib64/libz.so.1 (0x00007f2d833e9000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f2d7f000000)
libm.so.6 => /lib64/libm.so.6 (0x00007f2d8330e000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f2d832f3000)
libc.so.6 => /lib64/libc.so.6 (0x00007f2d7ec00000)
/lib64/ld-linux-x86-64.so.2 (0x00007f2d8346b000)
libffi.so.8 => /lib64/libffi.so.8 (0x00007f2d7f2b9000)
libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f2d7f23f000)
Summary of your issue
dotnet new console -n TestOpenCvSharp
cd TestOpenCvSharp
dotnet add package OpenCvSharp4 --version 4.10.0.20241108
dotnet add package OpenCvSharp4.official.runtime.linux-x64 --version 4.10.0.20241108
Environment
dotnet is 8.0.107 .
OS is the last Amazon Linux 2023 AMI and Architecture is 64-bit(x86).
What did you do when you faced the problem?
Just tried to run dotnet application to check the OpenCvSharp4.official.runtime.linux-x64 can be used on Amazon Linux 2023 or not.
Example code:
Output:
What did you intend to be?
To compile and run ok.
The text was updated successfully, but these errors were encountered: