sungaila / PDFtoZPL

A .NET library to convert PDF files (and bitmaps) into Zebra Programming Language code.
https://www.sungaila.de/PDFtoZPL/
MIT License
70 stars 12 forks source link

Roadmap For Linux Systems (AWS Lambda) #11

Closed hounddog22030 closed 2 years ago

hounddog22030 commented 2 years ago

We're getting errors using this on AWS Lambda (Linux based).

The error is because of System.Drawing: https://docs.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/6.0/system-drawing-common-windows-only

There seems to be some workarounds, like installing libgdiplus into the docker container (https://aws.amazon.com/blogs/developer/net-5-aws-lambda-support-with-container-images/) and EnableUnixSupport in the runtimeconfig.

Are there any hopes or plans for this library to follow some of the recommendations as outlined in https://docs.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/6.0/system-drawing-common-windows-only ?

hounddog22030 commented 2 years ago

fyi... not sure why, but EnableUnixSupport had no effect. going to try to downgrade System.Drawing.Common to 5.0.3

hounddog22030 commented 2 years ago

downgrade to system.drawing.common 5.0.3 worked

sungaila commented 2 years ago

Hi @hounddog22030,

thank you for bringing this to my attention! PDFtoZPL uses System.Drawing.Common in version 5.0.3 but I wanted to get rid of libgdiplus for a long time now anyway.

There is no compelling reason for GDI+ besides being the easiest solution for Windows (and targeting everything else via libgdiplus).

I am looking into MAUI as a replacement but cannot promise a solution before the end of this year.

Happy holidays and a happy new year!

hounddog22030 commented 2 years ago

I am looking into MAUI as a replacement but cannot promise a solution before the end of this year.

I don't know anything about MAUI, but have a small amount of experience with SixLabors. If you wanted me to take a crack @ it with SixLabors, let me know.

sungaila commented 2 years ago

Hey @hounddog22030, could you please take a look at 3.0.0-preview? I decided on SkiaSharp as a replacement for GDI+ as it is maintained by Microsoft.

Hope this will help with future .NET versions (6.x and newer).

hounddog22030 commented 2 years ago

Hey @hounddog22030, could you please take a look at [3.0.0-preview]

Sorry for the slow response.

We're getting the below exception:

` System.TypeInitializationException: The type initializer for 'PDFtoImage.PdfiumViewer.NativeMethods' threw an exception. ---> System.DllNotFoundException: Unable to load shared library '/var/task/libSkiaSharp.so' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libfontconfig.so.1: cannot open shared object file: No such file or directory

at System.Runtime.InteropServices.NativeLibrary.LoadByName(String libraryName, QCallAssembly callingAssembly, Boolean hasDllImportSearchPathFlag, UInt32 dllImportSearchPathFlag, Boolean throwOnError)

at System.Runtime.InteropServices.NativeLibrary.LoadLibraryByName(String libraryName, Assembly assembly, Nullable'1 searchPath, Boolean throwOnError)

at System.Runtime.InteropServices.NativeLibrary.Load(String libraryName, Assembly assembly, Nullable'1 searchPath)

at PDFtoImage.PdfiumViewer.NativeMethods.LoadNativeLibrary(String path)

at PDFtoImage.PdfiumViewer.NativeMethods..cctor()

--- End of inner exception stack trace ---

at PDFtoImage.PdfiumViewer.NativeMethods.FPDF_InitLibrary()

at PDFtoImage.PdfiumViewer.PdfLibrary..ctor()

at PDFtoImage.PdfiumViewer.PdfLibrary.EnsureLoaded()

at PDFtoImage.PdfiumViewer.PdfFile..ctor(Stream stream, String password)

at PDFtoImage.PdfiumViewer.PdfDocument..ctor(Stream stream, String password)

at PDFtoImage.PdfiumViewer.PdfDocument.Load(Stream stream, String password)

at PDFtoImage.Conversion.ToImages(Stream pdfStream, String password, Int32 dpi, Nullable'1 width, Nullable'1 height, Boolean withAnnotations, Boolean withFormFill)+MoveNext()

at PDFtoZPL.Conversion.ConvertPdf(Stream pdfStream, String password, Int32 dpi, Nullable'1 width, Nullable'1 height, Boolean withAnnotations, Boolean withFormFill)+MoveNext()

at YadaYada.BubbleBoy.WebApi.Controllers.Label.LabelController.GetZpl(Guid orderId) in /codebuild/output/src280698725/src/bbapi/WebApi/Controllers/Label/LabelController.cs:line 106

The type initializer for 'PDFtoImage.PdfiumViewer.NativeMethods' threw an exception. `

hounddog22030 commented 2 years ago

Looks like PDFtoImage requires libgdiplus on linux (see bottom of https://www.nuget.org/packages/PDFtoImage/), which really gets back to the root problem.

I have a branch and deployment with the 3.0.0 version of PDFtoZPL all setup so if there's anything else you want me to try, I can now get to it very quickly.

Thanks

sungaila commented 2 years ago

Looks like PDFtoImage requires libgdiplus on linux (see bottom of https://www.nuget.org/packages/PDFtoImage/), which really gets back to the root problem.

No, 3.0.0-preview has no dependency on libgdiplus anymore. If you check your exception, you will notice it did not find the new SkiaSharp dependency instead.

System.DllNotFoundException: Unable to load shared library '/var/task/libSkiaSharp.so' or one of its dependencies.

I am wondering why your setup is searching for /var/task/libSkiaSharp.so. Do you use dotnet publish with a predefined architecture (e.g. linux-x64)? Otherwise there should be a folder like /var/task/runtimes/linux-x64.

How does your output directory look like? Is there a libpdfium.so? Is there a libSkiaSharp.so? Maybe there is some issue with filename case sensitivity?

Is the PDFtoImage.dll in /var/task as well?

hounddog22030 commented 2 years ago

No, 3.0.0-preview has no dependency on libgdiplus. If you check your exception, you will notice it did not find the new SkiaSharp dependency. You are correct, sorry.

I am wondering why your setup is searching for /var/task/libSkiaSharp.so. Do you use dotnet publish with a predefined architecture (e.g. linux-x64)? Otherwise there should be a folder like /var/task/runtimes/linux-x64.

this is our package command:

dotnet lambda package --framework net5.0 --package-type image --configuration $CONFIGURATION --dockerfile ../../Dockerfile --docker-build-working-dir . --docker-host-build-output-dir bin/linux-x64/publish --project-location bbapi/WebApi --image-tag "${ECRURI}:bbapi-${EXEC_ID}"

Which in turn issues:

dotnet publish "C:\Users\17034\source\repos\bbmono\bbapi/WebApi" --output "C:\Users\17034\source\repos\bbmono\bbapi/WebApi\bin\Release\net5.0\publish" --configuration "Release" --framework "net5.0" /p:GenerateRuntimeConfigurationFiles=true --runtime linux-x64 --self-contained false

How does your output directory look like? Is there a libpdfium.so? Is there a libSkiaSharp.so? Maybe there is some issue with filename case sensitivity?

All three are present and have the same casing.

This is the entire dir from building on Windows:

` Volume in drive C is OS Volume Serial Number is A6C6-B46D

Directory of C:\Users\17034\source\repos\bbmono\bbapi\WebApi\bin\Release\net6.0\publish

01/28/2022 04:46 PM

. 01/28/2022 04:46 PM .. 07/06/2021 01:47 AM 117,376 Amazon.AspNetCore.Identity.Cognito.dll 07/15/2021 05:53 PM 70,272 Amazon.Extensions.CognitoAuthentication.dll 12/03/2020 11:09 PM 36,896 Amazon.Lambda.APIGatewayEvents.dll 10/21/2020 05:29 PM 14,880 Amazon.Lambda.ApplicationLoadBalancerEvents.dll 07/14/2021 02:59 PM 69,248 Amazon.Lambda.AspNetCoreServer.dll 06/02/2021 07:22 PM 41,176 Amazon.Lambda.CloudWatchEvents.dll 03/29/2021 07:02 PM 13,976 Amazon.Lambda.Core.dll 10/21/2020 05:29 PM 23,072 Amazon.Lambda.Logging.AspNetCore.dll 04/05/2021 01:33 PM 17,048 Amazon.Lambda.S3Events.dll 03/29/2021 07:02 PM 20,120 Amazon.Lambda.Serialization.Json.dll 10/21/2020 05:29 PM 18,976 Amazon.Lambda.Serialization.SystemTextJson.dll 03/29/2021 07:02 PM 15,000 Amazon.Lambda.SNSEvents.dll 03/29/2021 07:02 PM 15,000 Amazon.Lambda.SQSEvents.dll 03/29/2021 07:02 PM 16,536 Amazon.Lambda.TestUtilities.dll 12/18/2021 03:29 AM 115 appsettings.Development.json 12/18/2021 03:29 AM 117 appsettings.Development.WithAuthentication.json 01/28/2022 04:42 PM 2,568 appsettings.json 08/31/2021 03:28 PM 67,584 Auth0.AuthenticationApi.dll 08/31/2021 03:28 PM 18,944 Auth0.Core.dll 01/28/2022 04:42 PM 769 aws-lambda-tools-defaults.json 09/10/2021 01:42 PM 372,224 AWSSDK.CloudFormation.dll 09/10/2021 01:41 PM 122,368 AWSSDK.CognitoIdentity.dll 09/10/2021 01:41 PM 495,616 AWSSDK.CognitoIdentityProvider.dll 10/01/2021 01:36 PM 1,139,712 AWSSDK.Core.dll 09/10/2021 01:40 PM 613,888 AWSSDK.DynamoDBv2.dll 09/10/2021 01:41 PM 2,597,888 AWSSDK.EC2.dll 09/10/2021 01:40 PM 235,008 AWSSDK.EventBridge.dll 07/21/2021 05:58 PM 13,824 AWSSDK.Extensions.NETCore.Setup.dll 09/10/2021 01:39 PM 328,192 AWSSDK.Lambda.dll 09/10/2021 01:43 PM 834,560 AWSSDK.RDS.dll 10/01/2021 01:41 PM 637,952 AWSSDK.S3.dll 09/10/2021 01:41 PM 65,536 AWSSDK.SecurityToken.dll 10/01/2021 01:37 PM 110,592 AWSSDK.SQS.dll 10/28/2020 04:37 PM 150,408 Azure.Core.dll 11/13/2020 12:31 AM 213,888 Azure.Identity.dll 09/19/2016 07:30 PM 8,704 Base36.NetStandard.dll 05/06/2020 06:02 AM 279,040 Castle.Core.dll 02/09/2021 08:19 PM 113,152 DotLiquid.dll 09/06/2020 06:08 PM 84,992 DotNetConfig.dll 08/22/2021 11:18 AM 642,048 FluentAssertions.dll 10/22/2021 06:52 AM 63,488 FluentValidation.AspNetCore.dll 10/22/2021 06:52 AM 15,872 FluentValidation.DependencyInjectionExtensions.dll 10/22/2021 06:52 AM 439,808 FluentValidation.dll 01/28/2022 04:46 PM it 10/28/2021 05:44 AM 93,184 JetBrains.Annotations.dll 09/28/2021 07:03 PM 39,424 JWT.dll 11/08/2021 01:13 AM 5,568,952 libpdfium.so 01/02/2022 08:08 AM 8,876,256 libSkiaSharp.so 08/24/2021 01:01 PM 38,288 Microsoft.AspNetCore.Authentication.JwtBearer.dll 08/24/2021 12:59 PM 54,136 Microsoft.AspNetCore.JsonPatch.dll 08/24/2021 01:02 PM 62,840 Microsoft.AspNetCore.Mvc.NewtonsoftJson.dll 11/17/2021 10:38 PM 80,496 Microsoft.AspNetCore.TestHost.dll 12/07/2016 04:37 AM 22,208 Microsoft.Azure.KeyVault.Core.dll 08/19/2020 01:23 PM 420,736 Microsoft.Azure.Storage.Blob.dll 08/19/2020 01:23 PM 369,024 Microsoft.Azure.Storage.Common.dll 09/12/2019 09:28 PM 14,712 Microsoft.Bcl.AsyncInterfaces.dll 09/24/2021 04:13 PM 1,494,512 Microsoft.Data.SqlClient.dll 06/11/2018 05:53 AM 84,352 Microsoft.DiaSymReader.dll 06/11/2018 08:50 AM 95,616 Microsoft.DiaSymReader.PortablePdb.dll 05/15/2018 04:01 PM 24,024 Microsoft.DotNet.PlatformAbstractions.dll 10/13/2021 01:48 PM 28,552 Microsoft.EntityFrameworkCore.Abstractions.dll 08/10/2021 06:33 PM 1,833,864 Microsoft.EntityFrameworkCore.dll 08/10/2021 06:33 PM 190,328 Microsoft.EntityFrameworkCore.InMemory.dll 08/10/2021 06:33 PM 1,257,848 Microsoft.EntityFrameworkCore.Relational.dll 08/10/2021 06:33 PM 354,168 Microsoft.EntityFrameworkCore.SqlServer.dll 05/15/2018 04:01 PM 62,944 Microsoft.Extensions.DependencyModel.dll 10/22/2020 12:46 PM 1,310,152 Microsoft.Identity.Client.dll 10/29/2020 10:40 AM 52,600 Microsoft.Identity.Client.Extensions.Msal.dll 10/12/2020 07:21 PM 62,840 Microsoft.IdentityModel.JsonWebTokens.dll 10/12/2020 07:23 PM 24,952 Microsoft.IdentityModel.Logging.dll 10/12/2020 07:25 PM 32,632 Microsoft.IdentityModel.Protocols.dll 10/12/2020 07:31 PM 108,920 Microsoft.IdentityModel.Protocols.OpenIdConnect.dll 10/12/2020 07:27 PM 870,264 Microsoft.IdentityModel.Tokens.dll 11/15/2019 03:36 AM 23,112 Microsoft.Win32.SystemEvents.dll 02/23/2021 05:16 PM 278,016 Moq.dll 08/06/2021 03:53 AM 56,320 Namotion.Reflection.dll 11/27/2018 06:10 PM 97,720 Newtonsoft.Json.Bson.dll 03/17/2021 03:03 PM 695,336 Newtonsoft.Json.dll 08/06/2021 04:18 AM 56,832 NJsonSchema.CodeGeneration.CSharp.dll 08/06/2021 04:18 AM 33,280 NJsonSchema.CodeGeneration.dll 08/06/2021 04:18 AM 229,888 NJsonSchema.dll 08/06/2021 04:20 AM 13,312 NJsonSchema.Yaml.dll 08/06/2021 08:48 AM 11,264 NSwag.Annotations.dll 08/06/2021 08:48 AM 7,755,264 NSwag.AspNetCore.dll 08/06/2021 08:48 AM 118,784 NSwag.CodeGeneration.CSharp.dll 08/06/2021 08:48 AM 44,032 NSwag.CodeGeneration.dll 08/06/2021 08:48 AM 89,600 NSwag.Core.dll 08/06/2021 08:48 AM 10,752 NSwag.Core.Yaml.dll 08/06/2021 08:48 AM 47,616 NSwag.Generation.AspNetCore.dll 08/06/2021 08:48 AM 51,200 NSwag.Generation.dll 10/23/2020 11:35 PM 97,672 NuGet.Common.dll 10/23/2020 11:35 PM 141,704 NuGet.Configuration.dll 10/23/2020 11:36 PM 108,424 NuGet.Frameworks.dll 11/10/2020 03:27 PM 629,640 NuGet.Packaging.dll 10/23/2020 11:41 PM 48,008 NuGet.Versioning.dll 01/02/2022 08:17 AM 60,040 PDFtoImage.dll 01/02/2022 11:48 AM 35,976 PDFtoZPL.dll 08/02/2017 08:52 PM 7,168 PredicateBuilder.dll 11/17/2020 11:57 AM 124,416 QRCoder.dll 01/28/2022 04:46 PM refs 09/14/2021 04:13 PM 4,608 runtime.osx.10.10-x64.CoreCompat.System.Drawing.dll 01/28/2022 04:42 PM 114 runtimeconfig.template.json 01/24/2019 07:13 PM 27,648 SixLabors.Core.dll 05/20/2021 03:09 PM 169,472 SixLabors.Fonts.dll 09/27/2021 11:02 PM 1,229,824 SixLabors.ImageSharp.dll 05/27/2021 02:51 PM 169,984 SixLabors.ImageSharp.Drawing.dll 12/17/2021 06:10 AM 428,936 SkiaSharp.dll 04/24/2021 10:54 PM 405,504 SleetLib.dll 10/19/2020 01:48 PM 183,176 System.CodeDom.dll 11/15/2019 03:37 AM 375,912 System.Configuration.ConfigurationManager.dll 11/15/2019 03:56 AM 372,840 System.Drawing.Common.dll 10/12/2020 07:20 PM 81,784 System.IdentityModel.Tokens.Jwt.dll 11/17/2021 01:09 PM 78,448 System.IO.Pipelines.dll 10/19/2020 01:52 PM 71,048 System.Management.dll 11/15/2019 03:37 AM 83,528 System.Runtime.Caching.dll 11/15/2019 03:37 AM 17,784 System.Security.Cryptography.ProtectedData.dll 11/15/2019 03:56 AM 92,536 System.Security.Permissions.dll 11/15/2019 03:56 AM 25,976 System.Windows.Extensions.dll 11/08/2021 01:09 PM 125,952 Telerik.DataSource.dll 01/28/2022 04:45 PM 8,704 Web.Support.dll 01/28/2022 04:45 PM 11,624 Web.Support.pdb 01/28/2022 04:45 PM 140,800 YadaYada.Aces.dll 01/28/2022 04:45 PM 74,412 YadaYada.Aces.pdb 01/28/2022 04:45 PM 8,192 YadaYada.Advertising.Entity.dll 01/28/2022 04:45 PM 11,984 YadaYada.Advertising.Entity.pdb 01/28/2022 04:45 PM 49,664 YadaYada.Amazon.Data.dll 01/28/2022 04:45 PM 36,456 YadaYada.Amazon.Data.pdb 01/28/2022 04:45 PM 257,024 YadaYada.Amazon.Entity.dll 01/28/2022 04:45 PM 70,804 YadaYada.Amazon.Entity.pdb 01/28/2022 04:45 PM 501,248 YadaYada.Amazon.Mws.dll 01/28/2022 04:45 PM 240,024 YadaYada.Amazon.Mws.pdb 01/28/2022 04:45 PM 33,792 YadaYada.Amazon.Mws.Runtime.dll 01/28/2022 04:45 PM 21,888 YadaYada.Amazon.Mws.Runtime.pdb 01/28/2022 04:45 PM 103,936 YadaYada.AutoCare.Vcdb.Data.dll 01/28/2022 04:45 PM 26,432 YadaYada.AutoCare.Vcdb.Data.pdb 01/28/2022 04:45 PM 249,344 YadaYada.AutoCare.Vcdb.Entity.dll 01/28/2022 04:45 PM 30,788 YadaYada.AutoCare.Vcdb.Entity.pdb 01/28/2022 04:45 PM 615,424 YadaYada.AutoParts.Data.dll 01/28/2022 04:45 PM 54,196 YadaYada.AutoParts.Data.pdb 01/28/2022 04:45 PM 250,880 YadaYada.AutoParts.Entity.dll 01/28/2022 04:45 PM 66,672 YadaYada.AutoParts.Entity.pdb 01/25/2022 03:07 PM 15,872 YadaYada.Bisque.Annotations.dll 01/25/2022 03:07 PM 7,543,296 YadaYada.Bisque.Aws.dll 01/28/2022 04:46 PM 29,102,080 YadaYada.BubbleBoy.Data.dll 01/28/2022 04:46 PM 2,114,772 YadaYada.BubbleBoy.Data.pdb 01/28/2022 04:45 PM 15,872 YadaYada.BubbleBoy.Imaging.dll 01/28/2022 04:45 PM 15,216 YadaYada.BubbleBoy.Imaging.pdb 01/28/2022 04:45 PM 18,944 YadaYada.BubbleBoy.Support.dll 01/28/2022 04:45 PM 18,276 YadaYada.BubbleBoy.Support.pdb 01/28/2022 04:46 PM 142,840 YadaYada.BubbleBoy.WebApi 01/28/2022 04:45 PM 1,097,216 YadaYada.BubbleBoy.WebApi.Client.dll 01/28/2022 04:45 PM 308,480 YadaYada.BubbleBoy.WebApi.Client.pdb 01/28/2022 04:46 PM 404,199 YadaYada.BubbleBoy.WebApi.deps.json 01/28/2022 04:46 PM 800,256 YadaYada.BubbleBoy.WebApi.dll 01/28/2022 04:46 PM 199,076 YadaYada.BubbleBoy.WebApi.pdb 01/28/2022 04:46 PM 609 YadaYada.BubbleBoy.WebApi.runtimeconfig.json 01/28/2022 04:45 PM 30,208 YadaYada.Data.Library.dll 01/28/2022 04:45 PM 40,084 YadaYada.Data.Library.dll.config 01/28/2022 04:45 PM 21,652 YadaYada.Data.Library.pdb 01/28/2022 04:45 PM 8,704 YadaYada.Ebay.Data.dll 01/28/2022 04:45 PM 24,448 YadaYada.Ebay.Data.pdb 01/28/2022 04:45 PM 14,336 YadaYada.Ebay.Entity.dll 01/28/2022 04:45 PM 14,252 YadaYada.Ebay.Entity.pdb 01/28/2022 04:45 PM 7,680 YadaYada.Entity.Annotations.dll 01/28/2022 04:45 PM 11,800 YadaYada.Entity.Annotations.pdb 01/28/2022 04:45 PM 11,776 YadaYada.Entity.Library.dll 01/28/2022 04:45 PM 11,932 YadaYada.Entity.Library.pdb 01/28/2022 04:45 PM 9,216 YadaYada.Imaging2.dll 01/28/2022 04:45 PM 13,252 YadaYada.Imaging2.pdb 01/28/2022 04:45 PM 8,192 YadaYada.LabelMaker.Configuration.dll 01/28/2022 04:45 PM 11,444 YadaYada.LabelMaker.Configuration.pdb 01/28/2022 04:45 PM 12,800 YadaYada.LabelMaker.Data.dll 01/28/2022 04:45 PM 25,452 YadaYada.LabelMaker.Data.pdb 01/28/2022 04:45 PM 12,288 YadaYada.LabelMaker.Library.dll 01/28/2022 04:45 PM 14,840 YadaYada.LabelMaker.Library.pdb 01/28/2022 04:45 PM 450,560 YadaYada.LabelMaker.RestClient.dll 01/28/2022 04:45 PM 125,776 YadaYada.LabelMaker.RestClient.pdb 01/28/2022 04:45 PM 89,088 YadaYada.Lambda.dll 01/28/2022 04:45 PM 44,708 YadaYada.Lambda.pdb 01/28/2022 04:45 PM 6,656 YadaYada.Library.Client.dll 01/28/2022 04:45 PM 11,040 YadaYada.Library.Client.pdb 01/28/2022 04:45 PM 18,432 YadaYada.Library.Extensions.dll 01/28/2022 04:45 PM 15,108 YadaYada.Library.Extensions.pdb 01/28/2022 04:45 PM 14,336 YadaYada.Marketplace.Data.dll 01/28/2022 04:45 PM 24,524 YadaYada.Marketplace.Data.pdb 01/28/2022 04:45 PM 13,824 YadaYada.Marketplace.Entity.dll 01/28/2022 04:45 PM 14,328 YadaYada.Marketplace.Entity.pdb 01/28/2022 04:45 PM 22,528 YadaYada.Metadata.Data.dll 01/28/2022 04:45 PM 16,848 YadaYada.Metadata.Data.pdb 01/28/2022 04:45 PM 71,168 YadaYada.Metadata.Entity.dll 01/28/2022 04:45 PM 20,360 YadaYada.Metadata.Entity.pdb 01/28/2022 04:45 PM 24,064 YadaYada.Orders.Data.dll 01/28/2022 04:45 PM 26,016 YadaYada.Orders.Data.pdb 01/28/2022 04:45 PM 55,808 YadaYada.Orders.Entity.dll 01/28/2022 04:45 PM 25,772 YadaYada.Orders.Entity.pdb 01/28/2022 04:45 PM 20,480 YadaYada.Printing.dll 01/28/2022 04:45 PM 15,992 YadaYada.Printing.pdb 01/28/2022 04:45 PM 9,216 YadaYada.Security.dll 01/28/2022 04:45 PM 4,096 YadaYada.Security.Entity.dll 01/28/2022 04:45 PM 10,268 YadaYada.Security.Entity.pdb 01/28/2022 04:45 PM 22,872 YadaYada.Security.pdb 01/28/2022 04:45 PM 7,168 YadaYada.Shipping.Data.dll 01/28/2022 04:45 PM 14,484 YadaYada.Shipping.Data.pdb 01/28/2022 04:45 PM 12,288 YadaYada.Shipping.Entity.dll 01/28/2022 04:45 PM 12,952 YadaYada.Shipping.Entity.pdb 01/28/2022 04:45 PM 12,800 YadaYada.Tenancy.Data.dll 01/28/2022 04:45 PM 24,592 YadaYada.Tenancy.Data.pdb 01/28/2022 04:45 PM 35,840 YadaYada.Tenancy.Entity.dll 01/28/2022 04:45 PM 18,560 YadaYada.Tenancy.Entity.pdb 01/28/2022 04:45 PM 58,880 YadaYada.TestUtilities.dll 01/28/2022 04:45 PM 33,880 YadaYada.TestUtilities.pdb 01/28/2022 04:45 PM 5,632 YadaYada.Upc.Entity.dll 01/28/2022 04:45 PM 10,660 YadaYada.Upc.Entity.pdb 01/28/2022 04:45 PM 6,144 YadaYada.Walmart.Data.dll 01/28/2022 04:45 PM 15,040 YadaYada.Walmart.Data.pdb 01/28/2022 04:45 PM 36,352 YadaYada.Walmart.Entity.dll 01/28/2022 04:45 PM 21,812 YadaYada.Walmart.Entity.pdb 01/28/2022 04:46 PM 35,840 YadaYada.Web.dll 01/28/2022 04:46 PM 32,284 YadaYada.Web.pdb 01/15/2021 12:19 PM 213,504 YamlDotNet.dll 218 File(s) 95,245,935 bytes 4 Dir(s) 291,773,517,824 bytes free `

sungaila commented 2 years ago

dotnet publish ... --runtime linux-x64

Ok, this causes dotnet to to include the Linux assemblies only. This means that the publish directory shouldn't have a runtimes folder, libpdfium.so and libSkiaSharp.so must be in the root folder next to PDFtoZPL.dll. Your file list looks correct.

I am wondering about your output directory C:\Users\17034\source\repos\bbmono\bbapi\WebApi\bin\Release\net6.0\publish.

Because your lambda package command uses an other directory.

dotnet lambda package ... --docker-host-build-output-dir bin/linux-x64/publish

Shouldn't it be --docker-host-build-output-dir bin/Release/net6.0/publish?

hounddog22030 commented 2 years ago

Shouldn't it be --docker-host-build-output-dir bin/Release/net6.0/publish?

The docker stuff is all voodoo magic to me, I don't understand it, but I using a pattern shown by AWS to publish/package and we don't have any problems with any of it. Even the PdfToZpl is working correctly using the 5.0 version of System.Drawing.Common.

Our docker file is pretty simple:

` FROM public.ecr.aws/lambda/dotnet:latest AS base

WORKDIR /var/task

COPY "bin/linux-x64/publish" .
`

sungaila commented 2 years ago

Can you look up the content of the folder bin/linux-x64/publish? Is it structured just like C:\Users\17034\source\repos\bbmono\bbapi\WebApi\bin\Release\net6.0\publish (all 3 files found at its root)?

Maybe the natives libs aren't copied properly in this case.

hounddog22030 commented 2 years ago

Can you look up the content of the folder bin/linux-x64/publish? Is it structured just like C:\Users\17034\source\repos\bbmono\bbapi\WebApi\bin\Release\net6.0\publish (all 3 files found at its root)?

Maybe the natives libs aren't copied properly in this case.

Already had that in process....

` [Container] 2022/01/28 22:48:48 Running command ls bbapi/WebApi/bin/linux-x64/publish

775 | AWSSDK.CloudFormation.dll 776 | AWSSDK.CognitoIdentity.dll 777 | AWSSDK.CognitoIdentityProvider.dll 778 | AWSSDK.Core.dll 779 | AWSSDK.DynamoDBv2.dll 780 | AWSSDK.EC2.dll 781 | AWSSDK.EventBridge.dll 782 | AWSSDK.Extensions.NETCore.Setup.dll 783 | AWSSDK.Lambda.dll 784 | AWSSDK.RDS.dll 785 | AWSSDK.S3.dll 786 | AWSSDK.SQS.dll 787 | AWSSDK.SecurityToken.dll 788 | Amazon.AspNetCore.Identity.Cognito.dll 789 | Amazon.Extensions.CognitoAuthentication.dll 790 | Amazon.Lambda.APIGatewayEvents.dll 791 | Amazon.Lambda.ApplicationLoadBalancerEvents.dll 792 | Amazon.Lambda.AspNetCoreServer.dll 793 | Amazon.Lambda.CloudWatchEvents.dll 794 | Amazon.Lambda.Core.dll 795 | Amazon.Lambda.Logging.AspNetCore.dll 796 | Amazon.Lambda.S3Events.dll 797 | Amazon.Lambda.SNSEvents.dll 798 | Amazon.Lambda.SQSEvents.dll 799 | Amazon.Lambda.Serialization.Json.dll 800 | Amazon.Lambda.Serialization.SystemTextJson.dll 801 | Amazon.Lambda.TestUtilities.dll 802 | Auth0.AuthenticationApi.dll 803 | Auth0.Core.dll 804 | Azure.Core.dll 805 | Azure.Identity.dll 806 | Base36.NetStandard.dll 807 | Castle.Core.dll 808 | DotLiquid.dll 809 | DotNetConfig.dll 810 | FluentAssertions.dll 811 | FluentValidation.AspNetCore.dll 812 | FluentValidation.DependencyInjectionExtensions.dll 813 | FluentValidation.dll 814 | JWT.dll 815 | JetBrains.Annotations.dll 816 | Microsoft.AspNetCore.Authentication.JwtBearer.dll 817 | Microsoft.AspNetCore.JsonPatch.dll 818 | Microsoft.AspNetCore.Mvc.NewtonsoftJson.dll 819 | Microsoft.AspNetCore.TestHost.dll 820 | Microsoft.Azure.KeyVault.Core.dll 821 | Microsoft.Azure.Storage.Blob.dll 822 | Microsoft.Azure.Storage.Common.dll 823 | Microsoft.Bcl.AsyncInterfaces.dll 824 | Microsoft.Data.SqlClient.dll 825 | Microsoft.DiaSymReader.PortablePdb.dll 826 | Microsoft.DiaSymReader.dll 827 | Microsoft.DotNet.PlatformAbstractions.dll 828 | Microsoft.EntityFrameworkCore.Abstractions.dll 829 | Microsoft.EntityFrameworkCore.InMemory.dll 830 | Microsoft.EntityFrameworkCore.Relational.dll 831 | Microsoft.EntityFrameworkCore.SqlServer.dll 832 | Microsoft.EntityFrameworkCore.dll 833 | Microsoft.Extensions.DependencyModel.dll 834 | Microsoft.Identity.Client.Extensions.Msal.dll 835 | Microsoft.Identity.Client.dll 836 | Microsoft.IdentityModel.JsonWebTokens.dll 837 | Microsoft.IdentityModel.Logging.dll 838 | Microsoft.IdentityModel.Protocols.OpenIdConnect.dll 839 | Microsoft.IdentityModel.Protocols.dll 840 | Microsoft.IdentityModel.Tokens.dll 841 | Microsoft.Win32.SystemEvents.dll 842 | Moq.dll 843 | NJsonSchema.CodeGeneration.CSharp.dll 844 | NJsonSchema.CodeGeneration.dll 845 | NJsonSchema.Yaml.dll 846 | NJsonSchema.dll 847 | NSwag.Annotations.dll 848 | NSwag.AspNetCore.dll 849 | NSwag.CodeGeneration.CSharp.dll 850 | NSwag.CodeGeneration.dll 851 | NSwag.Core.Yaml.dll 852 | NSwag.Core.dll 853 | NSwag.Generation.AspNetCore.dll 854 | NSwag.Generation.dll 855 | Namotion.Reflection.dll 856 | Newtonsoft.Json.Bson.dll 857 | Newtonsoft.Json.dll 858 | NuGet.Common.dll 859 | NuGet.Configuration.dll 860 | NuGet.Frameworks.dll 861 | NuGet.Packaging.dll 862 | NuGet.Versioning.dll 863 | PDFtoImage.dll 864 | PDFtoZPL.dll 865 | PredicateBuilder.dll 866 | QRCoder.dll 867 | SixLabors.Core.dll 868 | SixLabors.Fonts.dll 869 | SixLabors.ImageSharp.Drawing.dll 870 | SixLabors.ImageSharp.dll 871 | SkiaSharp.dll 872 | SleetLib.dll 873 | System.CodeDom.dll 874 | System.Configuration.ConfigurationManager.dll 875 | System.Drawing.Common.dll 876 | System.IO.Pipelines.dll 877 | System.IdentityModel.Tokens.Jwt.dll 878 | System.Management.dll 879 | System.Runtime.Caching.dll 880 | System.Security.Cryptography.ProtectedData.dll 881 | System.Security.Permissions.dll 882 | System.Windows.Extensions.dll 883 | Telerik.DataSource.dll 884 | Web.Support.dll 885 | Web.Support.pdb 886 | YadaYada.Aces.dll 887 | YadaYada.Aces.pdb 888 | YadaYada.Advertising.Entity.dll 889 | YadaYada.Advertising.Entity.pdb 890 | YadaYada.Amazon.Data.dll 891 | YadaYada.Amazon.Data.pdb 892 | YadaYada.Amazon.Entity.dll 893 | YadaYada.Amazon.Entity.pdb 894 | YadaYada.Amazon.Mws.Runtime.dll 895 | YadaYada.Amazon.Mws.Runtime.pdb 896 | YadaYada.Amazon.Mws.dll 897 | YadaYada.Amazon.Mws.pdb 898 | YadaYada.AutoCare.Vcdb.Data.dll 899 | YadaYada.AutoCare.Vcdb.Data.pdb 900 | YadaYada.AutoCare.Vcdb.Entity.dll 901 | YadaYada.AutoCare.Vcdb.Entity.pdb 902 | YadaYada.AutoParts.Data.dll 903 | YadaYada.AutoParts.Data.pdb 904 | YadaYada.AutoParts.Entity.dll 905 | YadaYada.AutoParts.Entity.pdb 906 | YadaYada.Bisque.Annotations.dll 907 | YadaYada.Bisque.Aws.dll 908 | YadaYada.BubbleBoy.Data.dll 909 | YadaYada.BubbleBoy.Data.pdb 910 | YadaYada.BubbleBoy.Imaging.dll 911 | YadaYada.BubbleBoy.Imaging.pdb 912 | YadaYada.BubbleBoy.Support.dll 913 | YadaYada.BubbleBoy.Support.pdb 914 | YadaYada.BubbleBoy.WebApi 915 | YadaYada.BubbleBoy.WebApi.Client.dll 916 | YadaYada.BubbleBoy.WebApi.Client.pdb 917 | YadaYada.BubbleBoy.WebApi.deps.json 918 | YadaYada.BubbleBoy.WebApi.dll 919 | YadaYada.BubbleBoy.WebApi.pdb 920 | YadaYada.BubbleBoy.WebApi.runtimeconfig.json 921 | YadaYada.Data.Library.dll 922 | YadaYada.Data.Library.dll.config 923 | YadaYada.Data.Library.pdb 924 | YadaYada.Ebay.Data.dll 925 | YadaYada.Ebay.Data.pdb 926 | YadaYada.Ebay.Entity.dll 927 | YadaYada.Ebay.Entity.pdb 928 | YadaYada.Entity.Annotations.dll 929 | YadaYada.Entity.Annotations.pdb 930 | YadaYada.Entity.Library.dll 931 | YadaYada.Entity.Library.pdb 932 | YadaYada.Imaging2.dll 933 | YadaYada.Imaging2.pdb 934 | YadaYada.LabelMaker.Configuration.dll 935 | YadaYada.LabelMaker.Configuration.pdb 936 | YadaYada.LabelMaker.Data.dll 937 | YadaYada.LabelMaker.Data.pdb 938 | YadaYada.LabelMaker.Library.dll 939 | YadaYada.LabelMaker.Library.pdb 940 | YadaYada.LabelMaker.RestClient.dll 941 | YadaYada.LabelMaker.RestClient.pdb 942 | YadaYada.Lambda.dll 943 | YadaYada.Lambda.pdb 944 | YadaYada.Library.Client.dll 945 | YadaYada.Library.Client.pdb 946 | YadaYada.Library.Extensions.dll 947 | YadaYada.Library.Extensions.pdb 948 | YadaYada.Marketplace.Data.dll 949 | YadaYada.Marketplace.Data.pdb 950 | YadaYada.Marketplace.Entity.dll 951 | YadaYada.Marketplace.Entity.pdb 952 | YadaYada.Metadata.Data.dll 953 | YadaYada.Metadata.Data.pdb 954 | YadaYada.Metadata.Entity.dll 955 | YadaYada.Metadata.Entity.pdb 956 | YadaYada.Orders.Data.dll 957 | YadaYada.Orders.Data.pdb 958 | YadaYada.Orders.Entity.dll 959 | YadaYada.Orders.Entity.pdb 960 | YadaYada.Printing.dll 961 | YadaYada.Printing.pdb 962 | YadaYada.Security.Entity.dll 963 | YadaYada.Security.Entity.pdb 964 | YadaYada.Security.dll 965 | YadaYada.Security.pdb 966 | YadaYada.Shipping.Data.dll 967 | YadaYada.Shipping.Data.pdb 968 | YadaYada.Shipping.Entity.dll 969 | YadaYada.Shipping.Entity.pdb 970 | YadaYada.Tenancy.Data.dll 971 | YadaYada.Tenancy.Data.pdb 972 | YadaYada.Tenancy.Entity.dll 973 | YadaYada.Tenancy.Entity.pdb 974 | YadaYada.TestUtilities.dll 975 | YadaYada.TestUtilities.pdb 976 | YadaYada.Upc.Entity.dll 977 | YadaYada.Upc.Entity.pdb 978 | YadaYada.Walmart.Data.dll 979 | YadaYada.Walmart.Data.pdb 980 | YadaYada.Walmart.Entity.dll 981 | YadaYada.Walmart.Entity.pdb 982 | YadaYada.Web.dll 983 | YadaYada.Web.pdb 984 | YamlDotNet.dll 985 | appsettings.Development.WithAuthentication.json 986 | appsettings.Development.json 987 | appsettings.json 988 | aws-lambda-tools-defaults.json 989 | it 990 | libSkiaSharp.so 991 | libpdfium.so 992 | refs 993 | runtime.osx.10.10-x64.CoreCompat.System.Drawing.dll 994 | runtimeconfig.template.json 995 |   996 | [Container] 2022/01/28 22:48:48 Phase complete: BUILD State: SUCCEEDED

`

sungaila commented 2 years ago

Sorry for following this false trail, @hounddog22030. I just double checked the exception above and noticed the following error:

libfontconfig.so.1: cannot open shared object file: No such file or directory

This is a dependency needed by SkiaSharp which might not be included in the lightweight AWS lambda container.

You can change the dockerfile to install this missing dependency:

FROM public.ecr.aws/lambda/dotnet:latest AS base

WORKDIR /var/task

COPY "bin/linux-x64/publish" .

RUN apt-get update && apt-get install -y libfontconfig1

I should add this to the NuGet readme. Other containers like the Linux agents on Azure Pipelines have this dependency out-of-the-box. That's why I am hesitant to include it into the NuGet package.

hounddog22030 commented 2 years ago

Got it working with the below

`FROM public.ecr.aws/lambda/dotnet:latest AS base

WORKDIR /var/task

COPY "bin/linux-x64/publish" .

RUN yum install -y amazon-linux-extras RUN amazon-linux-extras install epel -y RUN yum -y install fontconfig freetype ` Can I assume that 3.0.0-preview will not be updated? If so, I am going to roll this to production.

Thanks!

sungaila commented 2 years ago

Hey @hounddog22030, glad to hear you got the docker container running!

If you have some time for further testing left, could you please take a look at 3.0.0-preview2? This release has no dependency to libfontconfig.so.1 and you shouldn't need the packages fontconfig and freetype anymore.

I will build a stable PDFtoZPL 3.0.0 release once SkiaSharp 2.88 is finalized.

hounddog22030 commented 2 years ago

Seems to still work... here's the publish dir from the CodeBuild log:

ls bbapi/WebApi/bin/linux-x64/publish 775 | AWSSDK.CloudFormation.dll 776 | AWSSDK.CognitoIdentity.dll 777 | AWSSDK.CognitoIdentityProvider.dll 778 | AWSSDK.Core.dll 779 | AWSSDK.DynamoDBv2.dll 780 | AWSSDK.EC2.dll 781 | AWSSDK.EventBridge.dll 782 | AWSSDK.Extensions.NETCore.Setup.dll 783 | AWSSDK.Lambda.dll 784 | AWSSDK.RDS.dll 785 | AWSSDK.S3.dll 786 | AWSSDK.SQS.dll 787 | AWSSDK.SecurityToken.dll 788 | Amazon.AspNetCore.Identity.Cognito.dll 789 | Amazon.Extensions.CognitoAuthentication.dll 790 | Amazon.Lambda.APIGatewayEvents.dll 791 | Amazon.Lambda.ApplicationLoadBalancerEvents.dll 792 | Amazon.Lambda.AspNetCoreServer.dll 793 | Amazon.Lambda.CloudWatchEvents.dll 794 | Amazon.Lambda.Core.dll 795 | Amazon.Lambda.Logging.AspNetCore.dll 796 | Amazon.Lambda.S3Events.dll 797 | Amazon.Lambda.SNSEvents.dll 798 | Amazon.Lambda.SQSEvents.dll 799 | Amazon.Lambda.Serialization.Json.dll 800 | Amazon.Lambda.Serialization.SystemTextJson.dll 801 | Amazon.Lambda.TestUtilities.dll 802 | Auth0.AuthenticationApi.dll 803 | Auth0.Core.dll 804 | Azure.Core.dll 805 | Azure.Identity.dll 806 | Base36.NetStandard.dll 807 | Castle.Core.dll 808 | DotLiquid.dll 809 | DotNetConfig.dll 810 | FluentAssertions.dll 811 | FluentValidation.AspNetCore.dll 812 | FluentValidation.DependencyInjectionExtensions.dll 813 | FluentValidation.dll 814 | JWT.dll 815 | JetBrains.Annotations.dll 816 | Microsoft.AspNetCore.Authentication.JwtBearer.dll 817 | Microsoft.AspNetCore.JsonPatch.dll 818 | Microsoft.AspNetCore.Mvc.NewtonsoftJson.dll 819 | Microsoft.AspNetCore.TestHost.dll 820 | Microsoft.Azure.KeyVault.Core.dll 821 | Microsoft.Azure.Storage.Blob.dll 822 | Microsoft.Azure.Storage.Common.dll 823 | Microsoft.Bcl.AsyncInterfaces.dll 824 | Microsoft.Data.SqlClient.dll 825 | Microsoft.DiaSymReader.PortablePdb.dll 826 | Microsoft.DiaSymReader.dll 827 | Microsoft.DotNet.PlatformAbstractions.dll 828 | Microsoft.EntityFrameworkCore.Abstractions.dll 829 | Microsoft.EntityFrameworkCore.InMemory.dll 830 | Microsoft.EntityFrameworkCore.Relational.dll 831 | Microsoft.EntityFrameworkCore.SqlServer.dll 832 | Microsoft.EntityFrameworkCore.dll 833 | Microsoft.Extensions.DependencyModel.dll 834 | Microsoft.Identity.Client.Extensions.Msal.dll 835 | Microsoft.Identity.Client.dll 836 | Microsoft.IdentityModel.JsonWebTokens.dll 837 | Microsoft.IdentityModel.Logging.dll 838 | Microsoft.IdentityModel.Protocols.OpenIdConnect.dll 839 | Microsoft.IdentityModel.Protocols.dll 840 | Microsoft.IdentityModel.Tokens.dll 841 | Microsoft.Win32.SystemEvents.dll 842 | Moq.dll 843 | NJsonSchema.CodeGeneration.CSharp.dll 844 | NJsonSchema.CodeGeneration.dll 845 | NJsonSchema.Yaml.dll 846 | NJsonSchema.dll 847 | NSwag.Annotations.dll 848 | NSwag.AspNetCore.dll 849 | NSwag.CodeGeneration.CSharp.dll 850 | NSwag.CodeGeneration.dll 851 | NSwag.Core.Yaml.dll 852 | NSwag.Core.dll 853 | NSwag.Generation.AspNetCore.dll 854 | NSwag.Generation.dll 855 | Namotion.Reflection.dll 856 | Newtonsoft.Json.Bson.dll 857 | Newtonsoft.Json.dll 858 | NuGet.Common.dll 859 | NuGet.Configuration.dll 860 | NuGet.Frameworks.dll 861 | NuGet.Packaging.dll 862 | NuGet.Versioning.dll 863 | PDFtoImage.dll 864 | PDFtoZPL.dll 865 | PredicateBuilder.dll 866 | QRCoder.dll 867 | SixLabors.Core.dll 868 | SixLabors.Fonts.dll 869 | SixLabors.ImageSharp.Drawing.dll 870 | SixLabors.ImageSharp.dll 871 | SkiaSharp.dll 872 | SleetLib.dll 873 | System.CodeDom.dll 874 | System.Configuration.ConfigurationManager.dll 875 | System.Drawing.Common.dll 876 | System.IO.Pipelines.dll 877 | System.IdentityModel.Tokens.Jwt.dll 878 | System.Management.dll 879 | System.Runtime.Caching.dll 880 | System.Security.Cryptography.ProtectedData.dll 881 | System.Security.Permissions.dll 882 | System.Windows.Extensions.dll 883 | Telerik.DataSource.dll 884 | Web.Support.dll 885 | Web.Support.pdb 886 | YadaYada.Aces.dll 887 | YadaYada.Aces.pdb 888 | YadaYada.Advertising.Entity.dll 889 | YadaYada.Advertising.Entity.pdb 890 | YadaYada.Amazon.Data.dll 891 | YadaYada.Amazon.Data.pdb 892 | YadaYada.Amazon.Entity.dll 893 | YadaYada.Amazon.Entity.pdb 894 | YadaYada.Amazon.Mws.Runtime.dll 895 | YadaYada.Amazon.Mws.Runtime.pdb 896 | YadaYada.Amazon.Mws.dll 897 | YadaYada.Amazon.Mws.pdb 898 | YadaYada.AutoCare.Vcdb.Data.dll 899 | YadaYada.AutoCare.Vcdb.Data.pdb 900 | YadaYada.AutoCare.Vcdb.Entity.dll 901 | YadaYada.AutoCare.Vcdb.Entity.pdb 902 | YadaYada.AutoParts.Data.dll 903 | YadaYada.AutoParts.Data.pdb 904 | YadaYada.AutoParts.Entity.dll 905 | YadaYada.AutoParts.Entity.pdb 906 | YadaYada.Bisque.Annotations.dll 907 | YadaYada.Bisque.Aws.dll 908 | YadaYada.BubbleBoy.Data.dll 909 | YadaYada.BubbleBoy.Data.pdb 910 | YadaYada.BubbleBoy.Imaging.dll 911 | YadaYada.BubbleBoy.Imaging.pdb 912 | YadaYada.BubbleBoy.Support.dll 913 | YadaYada.BubbleBoy.Support.pdb 914 | YadaYada.BubbleBoy.WebApi 915 | YadaYada.BubbleBoy.WebApi.Client.dll 916 | YadaYada.BubbleBoy.WebApi.Client.pdb 917 | YadaYada.BubbleBoy.WebApi.deps.json 918 | YadaYada.BubbleBoy.WebApi.dll 919 | YadaYada.BubbleBoy.WebApi.pdb 920 | YadaYada.BubbleBoy.WebApi.runtimeconfig.json 921 | YadaYada.Data.Library.dll 922 | YadaYada.Data.Library.dll.config 923 | YadaYada.Data.Library.pdb 924 | YadaYada.Ebay.Data.dll 925 | YadaYada.Ebay.Data.pdb 926 | YadaYada.Ebay.Entity.dll 927 | YadaYada.Ebay.Entity.pdb 928 | YadaYada.Entity.Annotations.dll 929 | YadaYada.Entity.Annotations.pdb 930 | YadaYada.Entity.Library.dll 931 | YadaYada.Entity.Library.pdb 932 | YadaYada.Imaging2.dll 933 | YadaYada.Imaging2.pdb 934 | YadaYada.LabelMaker.Configuration.dll 935 | YadaYada.LabelMaker.Configuration.pdb 936 | YadaYada.LabelMaker.Data.dll 937 | YadaYada.LabelMaker.Data.pdb 938 | YadaYada.LabelMaker.Library.dll 939 | YadaYada.LabelMaker.Library.pdb 940 | YadaYada.LabelMaker.RestClient.dll 941 | YadaYada.LabelMaker.RestClient.pdb 942 | YadaYada.Lambda.dll 943 | YadaYada.Lambda.pdb 944 | YadaYada.Library.Client.dll 945 | YadaYada.Library.Client.pdb 946 | YadaYada.Library.Extensions.dll 947 | YadaYada.Library.Extensions.pdb 948 | YadaYada.Marketplace.Data.dll 949 | YadaYada.Marketplace.Data.pdb 950 | YadaYada.Marketplace.Entity.dll 951 | YadaYada.Marketplace.Entity.pdb 952 | YadaYada.Metadata.Data.dll 953 | YadaYada.Metadata.Data.pdb 954 | YadaYada.Metadata.Entity.dll 955 | YadaYada.Metadata.Entity.pdb 956 | YadaYada.Orders.Data.dll 957 | YadaYada.Orders.Data.pdb 958 | YadaYada.Orders.Entity.dll 959 | YadaYada.Orders.Entity.pdb 960 | YadaYada.Printing.dll 961 | YadaYada.Printing.pdb 962 | YadaYada.Security.Entity.dll 963 | YadaYada.Security.Entity.pdb 964 | YadaYada.Security.dll 965 | YadaYada.Security.pdb 966 | YadaYada.Shipping.Data.dll 967 | YadaYada.Shipping.Data.pdb 968 | YadaYada.Shipping.Entity.dll 969 | YadaYada.Shipping.Entity.pdb 970 | YadaYada.Tenancy.Data.dll 971 | YadaYada.Tenancy.Data.pdb 972 | YadaYada.Tenancy.Entity.dll 973 | YadaYada.Tenancy.Entity.pdb 974 | YadaYada.TestUtilities.dll 975 | YadaYada.TestUtilities.pdb 976 | YadaYada.Upc.Entity.dll 977 | YadaYada.Upc.Entity.pdb 978 | YadaYada.Walmart.Data.dll 979 | YadaYada.Walmart.Data.pdb 980 | YadaYada.Walmart.Entity.dll 981 | YadaYada.Walmart.Entity.pdb 982 | YadaYada.Web.dll 983 | YadaYada.Web.pdb 984 | YamlDotNet.dll 985 | appsettings.Development.WithAuthentication.json 986 | appsettings.Development.json 987 | appsettings.json 988 | aws-lambda-tools-defaults.json 989 | it 990 | libSkiaSharp.so 991 | libpdfium.so 992 | refs 993 | runtime.osx.10.10-x64.CoreCompat.System.Drawing.dll 994 | runtimeconfig.template.json

sungaila commented 2 years ago

Great! Thanks for helping in getting rid of System.Drawing.Common! 😄

hounddog22030 commented 2 years ago

Great! Thanks for helping in getting rid of System.Drawing.Common! 😄

Thanks for getting rid of it! 😄

hounddog22030 commented 2 years ago

Hi. I updated to 3.2.2 from 3.0.0-preview3 and I am receiving the below error.

This is running on AWS Lambda linux arm64

I have examined the publish output, libpdfium.so is present in the zip (from the subdirectory linux-arm64 - same size at least).

There is no GLIBC

Thoughts?

The type initializer for 'PDFtoImage.PdfiumViewer.NativeMethods' threw an exception.","status":500,"detail":"System.TypeInitializationException: The type initializer for 'PDFtoImage.PdfiumViewer.NativeMethods' threw an exception.
 ---> System.DllNotFoundException: Unable to load shared library '/var/task/libpdfium.so' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by /var/task/libpdfium.so)
   at System.Runtime.InteropServices.NativeLibrary.LoadByName(String libraryName, QCallAssembly callingAssembly, Boolean hasDllImportSearchPathFlag, UInt32 dllImportSearchPathFlag, Boolean throwOnError)
   at System.Runtime.InteropServices.NativeLibrary.LoadLibraryByName(String libraryName, Assembly assembly, Nullable`1 searchPath, Boolean throwOnError)
   at System.Runtime.InteropServices.NativeLibrary.Load(String libraryName, Assembly assembly, Nullable`1 searchPath)
   at PDFtoImage.PdfiumViewer.NativeMethods.LoadLibrary(String path, String runtimeIdentifier, String pdfiumLibName)
   at PDFtoImage.PdfiumViewer.NativeMethods.LoadNativeLibraryNetCore(String path)
   at PDFtoImage.PdfiumViewer.NativeMethods..cctor()
   --- End of inner exception stack trace ---
   at PDFtoImage.PdfiumViewer.NativeMethods.FPDF_InitLibrary()
   at PDFtoImage.PdfiumViewer.PdfLibrary.EnsureLoaded()
   at PDFtoImage.PdfiumViewer.PdfFile..ctor(Stream stream, String password, Boolean disposeStream)
   at PDFtoImage.PdfiumViewer.PdfDocument..ctor(Stream stream, String password, Boolean disposeStream)
   at PDFtoImage.PdfiumViewer.PdfDocument.Load(Stream stream, String password, Boolean disposeStream)
   at PDFtoImage.Conversion.ToImages(Stream pdfStream, Boolean leaveOpen, String password, Int32 dpi, Nullable`1 width, Nullable`1 height, Boolean withAnnotations, Boolean withFormFill)+MoveNext()
   at PDFtoZPL.Conversion.ConvertPdf(Stream pdfStream, Boolean leaveOpen, String password, Int32 dpi, Nullable`1 width, Nullable`1 height, Boolean withAnnotations, Boolean withFormFill, BitmapEncodingKind encodingKind, Boolean graphicFieldOnly)+MoveNext()
   at Api.Controllers.Label.LabelController.GetZpl(Guid orderId)
hounddog22030 commented 2 years ago

FYI: Converting back from AWS Lambda arm64 to linux-x64 seems to be a workaround....

Thoughts?

Thanks

sungaila commented 2 years ago

Hi @hounddog22030,

PDFtoZPL 3.0.0-preview3 did not include Linux AArch64/arm64 binaries for libpdfium.so but PDFtoZPL 3.2.2 does. How did preview3 work on AWS Lambda Linux arm64 in the first place?

Anyway, searching the internet it looks like AWS Lambda ships with Glibc 2.26 but pdfium needs Glibc 2.27.

Best option is to wait for Amazon to update their distribution, I guess. I don't unterstand why x64 is working and arm64 is not, though.

hounddog22030 commented 2 years ago

Hi. I updated to 3.2.2 from 3.0.0-preview3 and I am receiving the below error.

Sorry, I should have said "I updated to 3.2.2 from 3.0.0-preview3 AND switched from x64 to arm64". Btw, not my typical way of doing things, I had another integration crash out on me and figured if it's already broken, I can't break it more.

Thanks for that link. Maybe the x64 AWS Lambda image is newer than the arm64?