Skip to content
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

.NETCore 2.2, docker 1.13.1 Gdip #203

Closed
BingoRoom opened this issue Aug 27, 2019 · 10 comments
Closed

.NETCore 2.2, docker 1.13.1 Gdip #203

BingoRoom opened this issue Aug 27, 2019 · 10 comments

Comments

@BingoRoom
Copy link

BingoRoom commented Aug 27, 2019

System.TypeInitializationException: The type initializer for 'Gdip' threw an exception. ---> System.DllNotFoundException: Unable to load shared library 'libdl' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibdl: cannot open shared object file: No such file or directory
at Interop.Libdl.dlopen(String fileName, Int32 flag)
at System.Drawing.SafeNativeMethods.Gdip.LoadNativeLibrary()
at System.Drawing.SafeNativeMethods.Gdip..cctor()
--- End of inner exception stack trace ---
at System.Drawing.SafeNativeMethods.Gdip.GdipCreateBitmapFromScan0(Int32 width, Int32 height, Int32 stride, Int32 format, HandleRef scan0, IntPtr& bitmap)
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
at QRCoder.QRCode.GetGraphic(Int32 pixelsPerModule, Color darkColor, Color lightColor, Bitmap icon, Int32 iconSizePercent, Int32 iconBorderWidth, Boolean drawQuietZones)

Your Environment

Include as many relevant details about the environment you experienced the bug in.

  • Version used:

  • NuGet package: 1.3.6

  • Used payload generator: PayloadGenerator.Url

  • Used ECC-level: default

  • Used renderer class: default

  • Environment ( .NETCore 2.2, docker 1.13.1):

@csturm83
Copy link
Contributor

Might be an issue with System.Drawing.Common? Similar issue reported in corefx:
https://github.com/dotnet/corefx/issues/40642

@raboud
Copy link

raboud commented Sep 4, 2019

I am assuming you are using a linux container not a windows container.

you might change that over to ImageSharp nuget package...its platform agnostic (linux or windows containers)

or there is a package to install on linux for image apis to work.

# install System.Drawing native dependencies
RUN apt-get update \
    && apt-get install -y --allow-unauthenticated \
        libc6-dev \
        libgdiplus \
        libx11-dev \
     && rm -rf /var/lib/apt/lists/*

@ps30
Copy link

ps30 commented Sep 26, 2019

@raboud
Copy link

raboud commented Sep 26, 2019

@ps30

I am not a lawyer...but they state

ImageSharp, ImageSharp.Drawing, and ImageSharp.Web will all be dual licensed under a AGPLv3/Commercial license. The AGPLv3 license will come with exceptions which allow bundling the code alongside all well known open source licenses (Apache 2.0, MIT etc). Any projects seen as direct competition (Imaging SDKs) will not be able to utilize that exception.

Since QRCoder is licensed under MIT, I take the statement to mean you can bundle ImageSharp with it.

@csturm83
Copy link
Contributor

@ps30

This project depends on System.Drawing.Common, which I believe leverages the native libgdiplus library on Linux. ImageSharp licensing shouldn't affect QRCoder (it's not currently using it).

@bestlane
Copy link

bestlane commented Nov 7, 2019

install System.Drawing native dependencies

RUN apt-get update
&& apt-get install -y --allow-unauthenticated
libc6-dev
libgdiplus
libx11-dev
&& rm -rf /var/lib/apt/lists/*

@raboud I tried running this within Azure Web SSH and it seemed that the installation worked, but when I tried loading the qrcode on the website, I still get the same error. I'm using Azure Linux App Service with NETCore 3.0 .

@jol64
Copy link

jol64 commented Feb 1, 2020

I am not a lawyer either, but my take of "The AGPLv3 license will come with exceptions which allow bundling the code alongside all well known open source licenses (Apache 2.0, MIT etc). Any projects seen as direct competition (Imaging SDKs) will not be able to utilize that exception."

  • you qualify in general as you are open source under MIT
  • "any project seen as direct competition" is always subject to judgement by sixlabor, i.e. you should ask them to provide their opinion in writing (or publicly as part of this discussion)

I am interested in the outcome as I do have a use case of generating QR with .NET Core preferably running in docker...
Thanks, Joachim

@jol64
Copy link

jol64 commented Feb 2, 2020

I compiled a copy of QRCoder.NETCore20 into a .NET CORE 3.1 application and tried with Docker on linux. Then googling for the error message I got, I discovered dotnet/dotnet-docker#618, and that did the trick - at least for what I tried.
Joachim

@codebude
Copy link
Owner

Since it is possible to run QRCoder even in a Linux-based Docker environment, I'll close this issue and point out the following issue, which shows up possible solutions, to problems that might occur, when running QRCoder in docker: #227

@dscaravaggi
Copy link

Just for knowledge:
this library contains explicit dependency on on native graphics gdiplus
I got a strange error:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants