DIPlib / diplib

Quantitative Image Analysis in C++, MATLAB and Python
https://diplib.org
Apache License 2.0
222 stars 49 forks source link

ImportError: libOpenGL.so.0 with diplib 3.4.2 #148

Closed acycliq closed 6 months ago

acycliq commented 6 months ago

Component DIPviewer and PyDIP 3,4,2

Describe the bug Hi Cris

Has anything changed regarding libOpenGL.so.0 and the latest version of diplib, v3.4.2 please? I am running some pytest unit tests on Github Actions and they are failing with the latest version. When I roll back to v3.4.1 they pass the tests. This is the error message I get please:

    import diplib as dip
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/diplib/__init__.py:60: in <module>
    from . import PyDIPviewer as viewer
E   ImportError: libOpenGL.so.0: cannot open shared object file: No such file or directory
Error: The operation was canceled.

Many thanks

crisluengo commented 6 months ago

Interesting issue. libOpenGL.so.0 is indeed not included in the wheel, but it wasn't included in the wheel for 3.4.1 either. OpenGL is supposed to be part of Linux.

Maybe it's a search path issue? @wcaarls what do you think? I don't have access to a Linux machine to test these wheels on.

emmenlau commented 6 months ago

I think its not mandatory on Linux. For Ubuntu 22.04, I get:

#> find /usr/ -name libOpenGL.so.0
/usr/lib/x86_64-linux-gnu/libOpenGL.so.0
#> dpk -S /usr/lib/x86_64-linux-gnu/libOpenGL.so.0.so.0
libopengl0:amd64: /usr/lib/x86_64-linux-gnu/libOpenGL.so.0

So apt install libopengl0 would fix this issue on Ubuntu 22.04.

crisluengo commented 6 months ago

But the viewer in 3.4.1 also depends on libOpenGL, and also doesn’t include it in the wheel. I fail to see why 3.4.2 gives problems where 3.4.1 doesn’t.

We have changed how we make the package, but the package looks the same. Something went wrong, I just don’t know what.

wcaarls commented 6 months ago

On 18/03/2024 12:38, Cris Luengo wrote:

But the viewer in 3.4.1 also depends on libOpenGL, and also doesn’t include it in the wheel. I fail to see why 3.4.2 gives problems where 3.4.1 doesn’t.

We have changed how we make the package, but the package looks the same. Something went wrong, I just don’t know what.

There is a difference in the libraries required by libDIPviewer.so:

@.***:~/Downloads/dip/341/diplib$ objdump -p libDIPviewer.so | grep NEEDED NEEDED libDIP.so NEEDED libglut-b0f599c2.so.3.10.0 NEEDED libGL.so.1 NEEDED libstdc++.so.6 NEEDED libm.so.6 NEEDED libgcc_s.so.1 NEEDED libpthread.so.0 NEEDED libc.so.6

@.***:~/Downloads/dip/342/diplib$ objdump -p libDIPviewer.so | grep NEEDED NEEDED libDIP.so NEEDED libglut-b0f599c2.so.3.10.0 NEEDED libGLX.so.0 NEEDED libOpenGL.so.0 NEEDED libstdc++.so.6 NEEDED libm.so.6 NEEDED libgcc_s.so.1 NEEDED libpthread.so.0 NEEDED libc.so.6

This is probably related to the new auditwheel, maybe something to do with indirect dependencies. I need to figure that out.

— Reply to this email directly, view it on GitHub https://github.com/DIPlib/diplib/issues/148#issuecomment-2004247220, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUM7I5TTJ2WXEAK7MHASKLYY4C7XAVCNFSM6AAAAABE3P7S4CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBUGI2DOMRSGA. You are receiving this because you were mentioned.Message ID: @.***>

crisluengo commented 6 months ago

Maybe because of a different GL installed on the machine that built 3.4.2 vs 3.4.1?

wcaarls commented 6 months ago

I think this should be fixed by 85ff147. libOpenGL is a new library; previously libGL was referenced directly, and this still works.

crisluengo commented 6 months ago

@wcaarls Neat! Thanks for finding this.

I remember seeing a warning at some point about that policy (CMP0072), but it probably went away with me setting cmake_minimum_required(VERSION 3.5...3.28). I didn't it'd matter!

I'll roll another release, then we can see if it fixes things or not. And we can also see if OpenMP is back in the macOS packages.🤞

crisluengo commented 6 months ago

@wcaarls Actually, before I make the release, could you take a look at the wheel made in CI to see what libraries libDIPviewer.so now depends on? https://github.com/DIPlib/diplib/actions/runs/8365100120/artifacts/1343999714

wcaarls commented 6 months ago

Hmm, the wheel you posted looks like it didn't pass through auditwheel. Apart from that it is OK (no libOpenGL.so.0)

wouter@pcwouter:~/Downloads/dip/diplib$ objdump -p libDIPviewer.so | grep NEEDED NEEDED libDIP.so NEEDED libglut.so.3 NEEDED libGL.so.1 NEEDED libstdc++.so.6 NEEDED libm.so.6 NEEDED libgcc_s.so.1 NEEDED libc.so.6

crisluengo commented 6 months ago

Wonderful! Thanks for checking!

Yes, the CI action doesn't use auditwheel, it just builds the wheel and does nothing with it. I added a step to save that wheel so we can examine it if needed. It's not meant for general use.

crisluengo commented 6 months ago

@acycliq The new release is published, it should fix your issue. Please let us know if you find any other issue!

acycliq commented 6 months ago

Yes, that runs fine now! Thanks so much Cris and @wcaarls for looking into this!