-
Notifications
You must be signed in to change notification settings - Fork 88
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
libfreetype.so when system == Emscripten #155
Comments
i'm not even sure that loading dynamic libraries via cytpes is supported with emscripten python.. |
since pyodide/pyodide#1656 was merged, ctypes is supposedly supported in pyodide. I also found pyodide/pyodide#2338 while searching for "synchronous loading of external files is not available" error. I've never used emscripten python, maybe other maintainers know more. |
Are you on mac os x or windows (where it would be libfreetype.dylib or freetype6.dll)?
|
I am on MacOs, but that shouldn't influence Pyodide, right? Thanks for pointing out the issue on Pyodide. Sorry, I am not that knowledgeable. I think my comment has nothing to do with this library, but rather with Pyodide. This wrapper relies on the FreeType installed by the OS, like via brew, right? I guess the browser won't be able to access it anyway, even after the fix. Then I need to compile FreeType to |
we do provide precompiled wheels for most platforms/py-versions already, they are published on the Python Packaging Index (PyPI), it's what gets normally installed when you do |
ok you're on mac so you should find the library under the name "libfreetype.dylib".. but instead of "Darwin" you get "Emscripten" from |
how did you install freetype-py in pyodide? Using not sure, but maybe we need to build a custom Pyodide package where the freetype library itself is converted to webassembly? https://pyodide.org/en/stable/development/new-packages.html#c-library-dependencies |
You don't really need to build freetype - you just need to duplicate libfreetype.dylib as libfreetype.so, right next to wherever it is on your system, or modify that line of freetype-py code to look for dylib instead of so. Assuming you have libfreetype.dylib on your machine. If not, download one of the binaries...
|
pyodide is cpython compiled to webassembly, it runs in a special vm inside the browser, it doesn't have access to external libraries. We need to make a pyodide package as explained in the pyodide docs link I posted above. We're lucky in that there's already an emscripten port for the freetype library itself, so it's a matter of doing something similar to what they do for the pyodide package for "matplotlib" module (which also depends on the freetype library): |
Argh yes. The emscripten port of freetype is really old though.
|
yeah, 2.6 is quite old. Some user of the emscripten port reported success in building freetype with the
emscripten-ports/FreeType#4 (comment) So it's technically feasible, only need someone to take the time to understand how to build a pyodide package and make a PR upstream to include in pyodide's own built-in packages. |
in pyodide
system = platform.system()
is equal toEmscripten
, which results tolibrary_name = 'libfreetype.so'
, lib file (if I understand correctly) which can't be found. Is it something on your side or is it my incompetency?The text was updated successfully, but these errors were encountered: