Description
I'm currently using xberg and xberg-html to markdown
No problems with html to markdown. but I noticed in production xberg does not work.
I've tried debugging and fixing it on my own (without changing the package)
inside the docker container
$ ls -al /app | grep berg
-rwxr-xr-x 1 root root 976384 Jul 20 12:30 Xberg.dll
-rwxr-xr-x 1 root root 89831816 Jul 20 12:30 libxberg_ffi.so
Stack trace:
System.DllNotFoundException: Unable to load shared library 'xberg_ffi' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable:
/app/xberg_ffi.so: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/10.0.10/xberg_ffi.so: cannot open shared object file: No such file or directory
libonnxruntime.so.1: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/10.0.10/libxberg_ffi.so: cannot open shared object file: No such file or directory
/app/xberg_ffi: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/10.0.10/xberg_ffi: cannot open shared object file: No such file or directory
/app/libxberg_ffi: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/10.0.10/libxberg_ffi: cannot open shared object file: No such file or directory
at Xberg.NativeMethods.ExtractInputFromBytes(IntPtr bytes, UIntPtr bytesLen, String mimeType, String filename)
at Xberg.ExtractInput.FromBytes(Byte[] bytes, String mimeType, String filename)
Steps to reproduce
# create project to build the docker containers
aspire new aspire-starter --non-interactive --suppress-agent-init
cd aspire-starter
# add package
dotnet package add XbergIo.Xberg --project ./aspire-starter.Web/aspire-starter.Web.csproj --prerelease
# add includes
sed -i '1i using Xberg;' ./aspire-starter.Web/Program.cs
# Create the crashing code block
sed -i '/app.Run();/i var config = new ExtractionConfig\n{\n UseCache = true,\n EnableQualityProcessing = true,\n};\n// Will crash before it does something with the empty array\nvar result = (await XbergConverter.ExtractAsync(\n ExtractInput.FromBytes(new byte[0], "application/pdf",\n "empty.pdf"), config));\nvar textResult = result.Results.FirstOrDefault();' ./aspire-starter.Web/Program.cs
# Add docker
aspire add docker
sed -i '2a builder.AddDockerComposeEnvironment("env")\n .WithDashboard(dashboard =>\n {\n dashboard.WithHostPort(8080)\n .WithForwardedHeaders(enabled: true);\n });' ./aspire-starter.Apphost/Apphost.cs
# Add docker registration
perl -i -0777 -pe 's/(\.\w+\([^)]*\));\s*(\n\s*builder\.Build\(\)\.Run\(\);)/$1.PublishAsDockerComposeService(((resource, service) =>\n {\n service.Name = resource.Name;\n }));\n\n$2/gs' ./aspire-starter.Apphost/Apphost.cs
sed -i '1i using Aspire.Hosting.Docker.Resources.ServiceNodes;' ./aspire-starter.Apphost/Apphost.cs
# run aspire
aspire deploy
# docker logs now contain errors
#Unhandled exception. System.DllNotFoundException: Unable to load shared library 'xberg_ffi' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable:
#/app/xberg_ffi.so: cannot open shared object file: No such file or directory
#/usr/share/dotnet/shared/Microsoft.NETCore.App/10.0.10/xberg_ffi.so: cannot open shared object file: No such file or directory
#libonnxruntime.so.1: cannot open shared object file: No such file or directory
#/usr/share/dotnet/shared/Microsoft.NETCore.App/10.0.10/libxberg_ffi.so: cannot open shared object file: No such file or directory
#/app/xberg_ffi: cannot open shared object file: No such file or directory
#/usr/share/dotnet/shared/Microsoft.NETCore.App/10.0.10/xberg_ffi: cannot open shared object file: No such file or directory
#/app/libxberg_ffi: cannot open shared object file: No such file or directory
#/usr/share/dotnet/shared/Microsoft.NETCore.App/10.0.10/libxberg_ffi: cannot open shared object file: No such file or directory
#at Xberg.NativeMethods.ExtractInputFromBytes(IntPtr bytes, UIntPtr bytesLen, String mimeType, String filename)
#at Xberg.ExtractInput.FromBytes(Byte[] bytes, String mimeType, String filename)
#at Program.<Main>$(String[] args) in C:\testxberg\aspire-starter\aspire-starter.Web\Program.cs:line 51
#at Program.<Main>(String[] args)
Relevant files and configuration
Description
I'm currently using xberg and xberg-html to markdown
No problems with html to markdown. but I noticed in production xberg does not work.
I've tried debugging and fixing it on my own (without changing the package)
inside the docker container
$ ls -al /app | grep berg -rwxr-xr-x 1 root root 976384 Jul 20 12:30 Xberg.dll -rwxr-xr-x 1 root root 89831816 Jul 20 12:30 libxberg_ffi.soStack trace:
Steps to reproduce
Relevant files and configuration