freetype-py icon indicating copy to clipboard operation
freetype-py copied to clipboard

Mac M1 support please

Open lucasjinreal opened this issue 3 years ago • 13 comments

freetype/raw.py", line 52, in raise RuntimeError('Freetype library not found') RuntimeError: Freetype library not found

lucasjinreal avatar Mar 02 '22 02:03 lucasjinreal

Do you have freetype library installed on your system?

rougier avatar Mar 02 '22 08:03 rougier

I have installed via brew

lucasjinreal avatar Mar 02 '22 09:03 lucasjinreal

Do you know where it has been installed and if it is reachable by ctypes?

rougier avatar Mar 02 '22 11:03 rougier

@rougier if you can do a release, M1 packages will be available on pypi. We've already merged the CI build scripts (#139)!

If you need assistance I can help out.

Korijn avatar Mar 22 '22 07:03 Korijn

I would need help to fill the description of the release, sorry, I lost tracks of all the changes since lase release.

rougier avatar Mar 29 '22 16:03 rougier

Do you know where it has been installed and if it is reachable by ctypes?

brew installed mine in /opt/homebrew/lib instead of /usr/local/lib, not sure when/why that changed or if that's specific to my corporate setup. Also, note I am not using the brew python3, but compiled my own python using pyenv (maybe brew's python can find the brew prefix automatically)

In case it may help anyone, I ended up doing export DYLD_LIBRARY_PATH=/opt/homebrew/lib:$DYLD_LIBRARY_PATH and then I was able to import freetype using the pure-python freetype-py wheel and the brew-installed libfreetype.dylib.

Of course, it'd be better to download and use the universal2/arm64 wheel for M1 macs from #139. Looking forward to the upcoming release :+1

anthrotype avatar Apr 05 '22 13:04 anthrotype

According to https://github.com/rougier/freetype-py/compare/v2.2.0...master, the changes are:

  • Add build rules for ARM 32 and 64 bits (https://github.com/rougier/freetype-py/pull/134).
  • Add ARM64 builds for PyPI (https://github.com/rougier/freetype-py/pull/139)
  • Add aarch64 builds for PyPI (#144)
  • Update bundled FreeType version to 2.11.0 and add support for SDF rendering (https://github.com/rougier/freetype-py/pull/141)
  • Fix bindings for FT_Outline (#142)
  • Expose binding to FT_Outline_EmboldenXY (#143)
  • Fix a Python 2 era print statement into a function call (#147)

madig avatar Apr 05 '22 13:04 madig

@anthrotype found that the bundled library for macOS/ARM64 contains just the x86_64 part, so of course it doesn't work. The build script needs to be updated to also build the ARM part and merge it all, as well as the CI script. I don't have time for this currently and wouldn't even know what exactly needs to be done...

madig avatar Apr 05 '22 15:04 madig

I believe this is solved now?

Korijn avatar May 19 '22 19:05 Korijn

Maybe! I don't have an M1 to test.

madig avatar May 19 '22 20:05 madig

@almarklein you can confirm this is working right?

Korijn avatar May 20 '22 05:05 Korijn

Yes I can!

almarklein avatar May 20 '22 08:05 almarklein

Sorry for coming to this a little late - I think Apple announced that dynamic loader overrides like "export DYLD_LIBRARY_PATH=/opt/homebrew/lib:$DYLD_LIBRARY_PATH" was supposed to stop working one or two OS releases ago? Unless you disable SIP - short for "system integrity protection", I think. What's the verdict on that? (Or does homebrew tell people to disable SIP?)

HinTak avatar Jul 27 '22 16:07 HinTak