strange problem building non-pure wheel for apple M1 arm64
Christian Gollwitzer
auriocus at gmx.de
Tue Mar 8 11:08:19 EST 2022
Am 07.03.22 um 17:22 schrieb Robin Becker:
>
> I use brew to install freetype version 2.11.1.
> gcc -bundle -undefined dynamic_lookup -g -arch arm64
> build/temp.macosx-11.0-arm64-3.9/src/rl_addons/renderPM/_renderPM.o
> build/temp.macosx-11.0-arm64-3.9/src/rl_addons/renderPM/gt1/gt1-dict.o
> build/temp.macosx-11.0-arm64-3.9/src/rl_addons/renderPM/gt1/gt1-namecontext.o
> '''''''other compiled code
> build/temp.macosx-11.0-arm64-3.9/src/rl_addons/renderPM/libart_lgpl/art_vpath_dash.o
> -L/usr/local/lib
> -L/usr/lib
> -L/Library/Frameworks/Python.framework/Versions/3.9/lib
> -lfreetype -o
> build/lib.macosx-11.0-arm64-3.9/reportlab/graphics/_renderPM.cpython-39-darwin.so
>
>
> ld: warning: ignoring file /usr/local/lib/libfreetype.dylib, building
> for macOS-arm64 but attempting to link with file built for macOS-x86_64
>
> The above message seems bizarre; everything is compiled for arm64, but
> gcc doesn't want to use an arm64 dylib.
I would interpret this as: the host is runnig in intel, by doing the
"brew install" it installs the intel version of freetype into
/usr/local/lib/ ; then you cross-compile the python extension for ARM,
but -lfreetype picks up the host version.
On macOS it is not mandatory that all symbols in a .dylib are resolved.
I would guess that the resulting file will not work on M1 macs. YOu can
check by
otool -L /path/toyour.dylib
which libraries are referenced. If you use freetype functions in your C
code and do not see it referenced, then the lib will not work.
Maybe you can install an ARM-version of freetype, or compile it from
source during your build process?
Christian
More information about the Python-list
mailing list