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

Native binaries collision with libgdiplus #21

Closed
tyaleze opened this issue Jul 13, 2020 · 15 comments
Closed

Native binaries collision with libgdiplus #21

tyaleze opened this issue Jul 13, 2020 · 15 comments
Assignees
Labels
not-a-bug This is intended behavior and not a bug
Milestone

Comments

@tyaleze
Copy link

tyaleze commented Jul 13, 2020

I got the following error when i try to use the library. I have zlib 1.2.11 (latest version) and its dev version installed but i am still getting the same error.

I get success if i use Gdal.Core package and its runtimes. but their version are old.

The detail i got from LD_DEBUG below :

23172: checking for version GLIBC_2.4' in file /lib/x86_64-linux-gnu/libc.so.6 [0] required by file /usr/lib/x86_64-linux-gnu/libgif.so.7 [0] 23172: checking for version GLIBC_2.2.5' in file /lib/x86_64-linux-gnu/libc.so.6 [0] required by file /usr/lib/x86_64-linux-gnu/libgif.so.7 [0]
23172: checking for version GLIBC_2.2.5' in file /lib/x86_64-linux-gnu/libm.so.6 [0] required by file /usr/lib/x86_64-linux-gnu/libpng16.so.16 [0] 23172: checking for version ZLIB_1.2.9' in file /home/tyaleze/Desktop/code/server/teoframework/TeoGIS.Framework/TeoFramework/bin/Debug/netcoreapp3.1/runtimes/linux-x64/native/libz.so.1 [0] required by file /usr/lib/x86_64-linux-gnu/libpng16.so.16 [0]
23172: /home/tyaleze/Desktop/code/server/teoframework/TeoGIS.Framework/TeoFramework/bin/Debug/netcoreapp3.1/runtimes/linux-x64/native/libz.so.1: error: version lookup error: version `ZLIB_1.2.9' not found (required by /usr/lib/x86_64-linux-gnu/libpng16.so.16) (fatal)
23172:
23172: file=/usr/lib/x86_64-linux-gnu/liblibgdiplus.so [0]; destroying link map
23172:
23172: file=/usr/lib/x86_64-linux-gnu/libcairo.so.2 [0]; destroying link map
23172:
23172: file=/usr/lib/x86_64-linux-gnu/libtiff.so.5 [0]; destroying link map

Environment information:

  • OS Ubuntu 18.04 TLS
  • Package 3.0.1.100
    Dotnet Core 3.1
@tyaleze tyaleze added the bug Something isn't working label Jul 13, 2020
@MaxRev-Dev
Copy link
Owner

These packages compiled under and targeting only linux-x64.
Libraries are copied on build from /runtimes/linux-x64/native to output directory.
Are you running on 64-bit machine?
If not - dependencies from the package wont be available on runtime.

Unix packages have their own libz (configured as internal driver) and libc.
Just tested them locally in WSL x64 (Ubuntu 18.04). They are stable.

Screenshots

image
image

@MaxRev-Dev MaxRev-Dev added documentation Improvements or additions to documentation not-a-bug This is intended behavior and not a bug and removed bug Something isn't working labels Jul 13, 2020
@tyaleze
Copy link
Author

tyaleze commented Jul 14, 2020

My system is indeed x64

@tyaleze
Copy link
Author

tyaleze commented Jul 14, 2020

asp.zip

This is a sample app. I got error after creating bitmap.

@MaxRev-Dev
Copy link
Owner

  1. You are calling native GDAL methods without configuring drivers paths. This library has a wrapper-bootstrapper to configure GDAL's startup. See how to use.
  2. You should call them once at startup as registration is expensive operation and objects are static singletons.
    For me libraries are loading successfully after applying changes.

Also, I want to notice that using bitmap in asp.net core is not a good idea, as it has a windows dependency (Microsoft.Win32.SystemEvents). And it also requires libc6-dev and libgdiplus libraries.
Consider to use ImageSharp

@tyaleze
Copy link
Author

tyaleze commented Jul 14, 2020

Yes i know using bitmap is risky but i am porting a huge library to .net core so i should make it work.

I could not make it work. Could you please send me a working sample project?

Thanks.

@MaxRev-Dev
Copy link
Owner

@tyaleze Working sample - asp.zip

@tyaleze
Copy link
Author

tyaleze commented Jul 14, 2020

Sorry but i am still getting the error when i try to create Bitmap

@MaxRev-Dev
Copy link
Owner

@tyaleze GDAL is not dependent on Bitmap and vise versa

@tyaleze
Copy link
Author

tyaleze commented Jul 14, 2020

I know but when i remove the packages it works. If only i add the packages it fails. I tried to use GDAL.Net.Core library and its runtimes it also works.

@MaxRev-Dev MaxRev-Dev added bug-linux-only This bug is only spawns on linux and removed documentation Improvements or additions to documentation not-a-bug This is intended behavior and not a bug labels Jul 14, 2020
@MaxRev-Dev
Copy link
Owner

MaxRev-Dev commented Jul 14, 2020

Then this issue is similar to #9.
In my opinion, It fails because libgdiplus uses libpng16 from system libraries and loads it on startup before gdal.
Currently, I can't find any solution to fix this. Maybe its worth to compile all to separate directory like runtimes/linux-x64/native/gdal.

/home/tyaleze/Desktop/code/server/teoframework/TeoGIS.Framework/TeoFramework/bin/Debug/netcoreapp3.1/runtimes/linux-x64/native/libz.so.1: error: version lookup error: version `ZLIB_1.2.9' not found (required by /usr/lib/x86_64-linux-gnu/libpng16.so.16) (fatal)
23172:
23172: file=/usr/lib/x86_64-linux-gnu/liblibgdiplus.so [0]; destroying link map

@tyaleze
Copy link
Author

tyaleze commented Jul 15, 2020

Thanks for your help. I am using gdal for dynmic tiling. i crop images from big images on runtime. so i understand that if i use ImageSharp or any other cross platform library for creating images, this problem will be solved. right?

@MaxRev-Dev
Copy link
Owner

@tyaleze sorry for late reply. That should be fixed by ImageSharp, because it does not have any binary dependency - it's fully managed.

@MaxRev-Dev MaxRev-Dev changed the title Zlib 1.2.9 library missing Native binaries collision with libgdiplus Aug 6, 2020
@MaxRev-Dev MaxRev-Dev added enhancement New feature or request not-a-bug This is intended behavior and not a bug and removed bug-linux-only This bug is only spawns on linux labels Aug 6, 2020
@MaxRev-Dev
Copy link
Owner

asp.zip

This is a sample app. I got error after creating bitmap.

@tyaleze I've tested your pinned project with packages v3.1.2.100. Everything looks fine.

@MaxRev-Dev MaxRev-Dev added this to the v3.1.2.110 milestone Dec 5, 2020
@tyaleze
Copy link
Author

tyaleze commented Dec 5, 2020

Thanks. i took your advise and change all System.Drawing object into ImageSharp. Everything works fine.

@MaxRev-Dev
Copy link
Owner

@tyaleze One more remark.
I looked through the logs, and there was no collisions with dependencies.
Again, as far as I know our GDAL drivers does not use libgdiplus.
You must install libgdiplus in your environment.
Ubuntu: apt-get install -y libgdiplus
CentOS: yum install -y libgdiplus

@MaxRev-Dev MaxRev-Dev removed the enhancement New feature or request label Dec 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not-a-bug This is intended behavior and not a bug
Projects
None yet
Development

No branches or pull requests

2 participants