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

Unable to get net-vips to work in Windows container #61

Closed
surgicalcoder opened this issue Feb 8, 2020 · 10 comments
Closed

Unable to get net-vips to work in Windows container #61

surgicalcoder opened this issue Feb 8, 2020 · 10 comments
Labels
bug Something isn't working

Comments

@surgicalcoder
Copy link

Trying to get netvips working in a Windows container (image is mcr.microsoft.com/dotnet/core/aspnet:3.1.1-nanoserver-1809),

No matter what I try, it refuses to load the DLLs with the following error:

System.DllNotFoundException: Unable to load DLL 'libvips-42.dll' or one of its dependencies: The specified procedure could not be found. (0x8007007F)
at NetVips.Internal.VipsSourceCustom.New()
at NetVips.SourceCustom..ctor()
at NetVips.SourceStream..ctor(Stream stream)

I've tried including the NetVips.native package, I've also tried copying the entirety of Vips package to a path (c:\vips) and adding that into the PATH, with no luck.

Funnily enough, with just NetVips.native on linux (container is mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim) it works fine.

@surgicalcoder
Copy link
Author

Forgot to add, using NetVips v1.20 and NetVips.Native v8.9.1 from Nuget.

@hey-red
Copy link

hey-red commented Feb 9, 2020

Try place all native dlls along with your app dll(it's default behavior when publish).

@surgicalcoder
Copy link
Author

Tried that, tried putting it into path, it's not complaining that it can't find the file (which is 0X8007007E, The specified module cannot be found), it's unable to load the procedure itself,

I have a feeling this may be because nanoserver does not contain GDI, and vips has dependency on GDI.

@surgicalcoder
Copy link
Author

Running Depwalker, one of the ImageMagick dlls reference GDI, which is unavailable in Nanoserver.

I've build an Asp Net core container against Windows Server Core and that appears to be working - surgicalcoder/windowsservercore-netcore on Docker hub.

Closing this as it's not a Net Vips issue.

@kleisauke
Copy link
Owner

Glad it's resolved!

I have a feeling this may be because nanoserver does not contain GDI, and vips has dependency on GDI.

Note that only the NetVips.Extensions NuGet package depends on GDI (for converting a bitmap to vips and vice versa). libvips itself (and thus the NetVips.Native* packages) does not depend on GDI.

@surgicalcoder
Copy link
Author

@kleisauke I don't think that's entirely accurate from what I've seen - libvips-42.dll has a direct dependency on GDI32.dll according to dependency walker:

image

kleisauke added a commit to libvips/build-win64-mxe that referenced this issue Feb 14, 2020
- Update GLib to 2.63.5.
- Update librsvg to 2.47.3.
- Update ImageMagick to 6.9.10-92.
- Update libheif to 1.6.2.
- Update OpenEXR to 2.4.1.
- Do not link Cairo against -lgdi32 and -lmsimg32 (see kleisauke/net-vips#61).

MXE Updates:
- Update SQLite to 3.31.1.
- Update Poppler to 0.85.0.
@kleisauke kleisauke added blocked-upstream-dependency Upstream dependency needs to be updated bug Something isn't working labels Feb 14, 2020
@kleisauke
Copy link
Owner

kleisauke commented Feb 14, 2020

Ah, you're right. Looks like Cairo is the only one that depends on GDI32.dll. The NetVips.Native* NuGet packages are static linked so it will become a direct dependency of libvips-42.dll.

Fixed with libvips/build-win64-mxe@acc156c, I now see:
after
(checked with https://lucasg.github.io/Dependencies/)

This Dockerfile seems to be working properly now:

FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
WORKDIR /source

COPY *.csproj .
COPY local-packages local-packages/
RUN dotnet restore -r win-x64 -v n

COPY . .
RUN dotnet publish -c release -o /app -r win-x64 --self-contained false --no-restore

FROM mcr.microsoft.com/dotnet/core/runtime:3.1-nanoserver-1909
WORKDIR /app

COPY --from=build /app .
ENTRYPOINT ["dotnet", "NetVips.TestProgram.dll"]

Thanks for reporting this! The fix will be included in the forthcoming NetVips.Native release.

@surgicalcoder
Copy link
Author

@kleisauke Do we have a date for when NetVips.Native will be released with those fixes? Am keen to try it out (and shrink the size of my containers while I'm at it)

@kleisauke
Copy link
Owner

I can't give any dates, unfortunately. I was waiting for libvips 8.9.2, but it hasn't been released yet. In the meantime, you could try testing these binaries:
https://github.com/libvips/build-win64-mxe/releases/tag/v8.9.1-static

I'm reopening this issue to keep track of it.

@kleisauke
Copy link
Owner

NetVips.Native v8.9.2 is now available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants