perey / pegl

A Python 3 wrapper for the EGL library.
GNU General Public License v3.0
14 stars 5 forks source link

More robust EGL library loading on a range of platforms #14

Open rayzchen opened 2 years ago

rayzchen commented 2 years ago

Installed pegl from source. Seems that libEGL.dll is expected to be put under pegl/egl/common/lib. Windows 10 supplies libEGL.dll under C:\WINDOWS\system32\libEGL.dll as declared by ctypes.util.find_library("libEGL"). Maybe first check find_library first and then try the pegl/egl/common/lib directory?

perey commented 2 years ago

Thanks for the report. More robust DLL loading is certainly needed, and I'm sure you're right that find_library is the way to go. Looking in a package-local directory is fine for testing, but it will only work for release versions if the EGL library (probably Google's ANGLE) is bundled with a Windows package.

But maybe that's the best strategy? I'm not sure that Microsoft supplies libEGL.dll with Windows. (At least, not as standard; maybe it comes with WSL or something?)

Could you check the file info on C:\WINDOWS\system32\libEGL.dll (right click, Properties, Details)?

rayzchen commented 2 years ago

Not on my computer right now, but I dont have WSL installed anyways. How are you planning to bundle libEGL.dll in the wheels though?

perey commented 2 years ago

I haven't tested out any particular approach, but there's lots of prior discussion, e.g.:

rayzchen commented 2 years ago

Seems that it doesn't appear to be on my old laptop, though my new one has it.

rayzchen commented 2 years ago

Looking in a package-local directory is fine for testing, but it will only work for release versions if the EGL library (probably Google's ANGLE) is bundled with a Windows package.

Where are you currently getting the library from? I've looked at google/angle but it seems to be source-only. Of course, many general purpose DLL files are out there, but I don't trust them enough.

rayzchen commented 2 years ago

Funny, seems that Python can access a C:\Windows\System32\libEGL.dll but even using cmd with dir yields nothing.

EDIT: C:\Windows\SysWOW64\libEGL.dll exists... The created date is around when I got the laptop.

image

perey commented 2 years ago

Where are you currently getting the library from? I've looked at google/angle but it seems to be source-only. Of course, many general purpose DLL files are out there, but I don't trust them enough.

I grabbed it from a Google Chrome installation, but I’m not positive that’s the only place I’ve gotten the DLL; I recall looking up some other projects that bundle ANGLE.

C:\Windows\SysWOW64\libEGL.dll exists... The created date is around when I got the laptop.

Hmm. Very peculiar that it doesn’t list a product name. That in itself suggests that it’s not an official Microsoft DLL, which answers my question… but I’m still curious, if you’re willing to do a bit more digging? Is there any vendor info under the Digital Signatures tab? What about if you load it in pegl, like so:

>>> import pegl
>>> dpy = pegl.Display()
>>> dpy.vendor
'Google Inc. (adapter LUID: 000000000000b56d)'
>>> dpy.version
(1, 5, '(ANGLE 2.1.0.ea8043b73f93)')
rayzchen commented 2 years ago

Running dpy = pegl.Display() raises pegl.errors.NotInitializedError