I ran into the same problem. Even after running make.osx he still complained about _FT_Attach_File to undefined when I imported ft2font from matplotlib. This is how I figured out the problem. Hope this helps someone else.
Running otool -L ft2font.so gave:
ft2font.so: /Users/jbenuck/mpl_build/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5) /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
Note the lack of mention of libfreetype! How should ft2font.so find a character if it is not associated with it?
My next step was to capture the commands used during build:
make -f make.osx PREFIX=/usr/local clean fetch deps mpl_build > output.txt
The search resulted in a command that was used to compile the corrupted python module. I changed the value of the output file to one in my local directory and ran it:
/ Developer / usr / bin / llvm-g ++ - 4.2 -bundle - undefined dynamic_lookup -isysroot / -L / opt / local / lib -arch i386 -arch x86_64 -L / usr / local / lib -syslibroot, / Developer / SDKs / MacOSX10.7.sdk -arch i386 -arch x86_64 -I / usr / local / include -I / usr / local / include / freetype2 -isysroot / Developer / SDKs / MacOSX10.7.sdk build / temp. macosx-10.7-x86_64-2.7 / src / ft2font.o build / temp.macosx-10.7-x86_64-2.7 / src / mplutils.o build / temp.macosx-10.7-x86_64-2.7 / CXX / cxx_extensions.o build / temp .macosx-10.7-x86_64-2.7 / CXX / cxxsupport.o build / temp.macosx-10.7-x86_64-2.7 / CXX / IndirectPythonInterface.o build / temp.macosx-10.7-x86_64-2.7 / CXX / cxxextensions.o -L / usr / local / lib -L / usr / local / lib -L / usr / lib -L / usr / X11 / lib -lfreetype -lz -lstdC ++ -lm -o ft2font.so
ld: warning: ignoring file /opt/local/lib/libfreetype.dylib, file was created for an unsupported file format that is not architecture related (x86_64)
Bingo! Problem found. I know that I have both macports and homebrew installed. Apparently, one of them has a version of libfreetype in /opt/local/lib that is not compiled for the 64-bit version.
I restarted the command with the removal of "-L /opt/local/lib" , which worked without warning. Copying the resulting ft2font.so into my existing matplotlib installation now allows me to successfully import ft2font from matplotlib.
Joshua benuck
source share