Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I ran into the same issue. Even after running <code>make.osx</code>, it still complained about <code>_FT_Attach_File</code> being undefined when I imported <code>ft2font</code> from matplotlib. Here's how I tracked down the problem. Hopefully, it will help someone else.</p> <p>Running <code>otool -L ft2font.so</code> yielded:</p> <pre><code> 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) </code></pre> <p>Note the absence of any mention of libfreetype! How is <code>ft2font.so</code> supposed to locate the symbol if it isn't linked against it?</p> <p>My next step was to capture the commands used during the build:</p> <pre><code> make -f make.osx PREFIX=/usr/local clean fetch deps mpl_build &gt; output.txt </code></pre> <p>Searching this yielded the command that was used to compile the offending python module. I changed the value of the output file to be one in my local directory and ran it:</p> <blockquote> <p>/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</p> <p>ld: warning: ignoring file /opt/local/lib/libfreetype.dylib, file was built for unsupported file format which is not the architecture being linked (x86_64)</p> </blockquote> <p>Bingo! Problem found. I know I have both macports and homebrew installed. Apparently, one of them has a version of <code>libfreetype</code> in <code>/opt/local/lib</code> that isn't compiled for 64-bit.</p> <p>I reran the command with <code>"-L /opt/local/lib"</code> removed which worked without a warning. Copying the resulting <code>ft2font.so</code> into my existing matplotlib installation now allows me to successfully import <code>ft2font</code> from matplotlib.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload