I have a new intel powerbook running OS X 10.5 (leopard) which I upgraded via DVD from a factory installed 10.4. I decided to take detailed notes on every step of configuring the box as a development machine for scientific python, figuring it would be useful to others. The install of ipython, numpy and scipy went really well (only one snag in scipy following the wiki, which I updated and is noted in my notes below). But the main problem, sadly, is a strange problem I've hit trying to compile matplotlib. My compile is dying with a mysterious warning about PPC (how did that get in to the compiler flags?) with some strange hybrid of 10.4 and 10.3 stuff in the gcc command. If I manually paste in the g++ command below and remove the -arch ppc part, it compiles fine, so this is the source of my problems. I don't know if this is a feature or a bug (universal binary support?) but if someone could advise me what or where is going wrong and how to fix it, that would be great. Here is the shorted build output with the compiler command and error: BUILDING MATPLOTLIB matplotlib: 0.90.1 python: 2.5 (r25:51918, Sep 19 2006, 08:49:13) [GCC 4.0.1 (Apple Computer, Inc. build 5341)] platform: darwin REQUIRED DEPENDENCIES numpy: 1.0.4.dev4380 freetype2: found, but unknown version (no pkg-config) OPTIONAL DEPENDENCIES Gtk+: no * Building for Gtk+ requires pygtk; you must be able * to "import gtk" in your build/install environment Tkinter: Tkinter: 50704, Tk: 8.4, Tcl: 8.4 wxPython: 2.8.3.0 * WxAgg extension not required for wxPython >= 2.8 Qt: no Qt4: no Cairo: no libpng: found, but unknown version (no pkg-config) [Edit setup.cfg to suppress the above messages] ============================================================================ running build running build_py creating build creating build/lib.macosx-10.3-fat-2.5 copying lib/pylab.py -> build/lib.macosx-10.3-fat-2.5 creating build/lib.macosx-10.3-fat-2.5/matplotlib copying lib/matplotlib/__init__.py -> build/lib.macosx-10.3-fat-2.5/matplotlib copying lib/matplotlib/_cm.py -> build/lib.macosx-10.3-fat-2.5/matplotlib copying lib/matplotlib/_mathtext_data.py -> build/lib.macosx-10.3-fat-2.5/matplotlib copying lib/matplotlib/_pylab_helpers.py -> build/lib.macosx-10.3-fat-2.5/matplotlib copying lib/matplotlib/afm.py -> build/lib.macosx-10.3-fat-2.5/matplotlib copying lib/matplotlib/agg.py -> build/lib.macosx-10.3-fat-2.5/matplotlib copying lib/matplotlib/art3d.py -> build/lib.macosx-10.3-fat-2.5/matplotlib copying lib/matplotlib/artist.py -> build/lib.macosx-10.3-fat-2.5/matplotlib ..snip lots of copying.... running build_ext building 'matplotlib.ft2font' extension C compiler: gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -O3 creating build/temp.macosx-10.3-fat-2.5 creating build/temp.macosx-10.3-fat-2.5/src creating build/temp.macosx-10.3-fat-2.5/CXX compile options: '-I/usr/local/include -I/usr/include -I. -I/usr/local/include/freetype2 -I/usr/include/freetype2 -I./freetype2 -I/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -c' gcc: CXX/cxxextensions.c In file included from /usr/include/math.h:26, from /Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/pyport.h:200, from /Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/Python.h:57, from ./CXX/WrapPython.h:47, from CXX/cxxextensions.c:38: /usr/include/architecture/ppc/math.h:675: warning: conflicting types for built-in function 'scalb' gcc: CXX/cxx_extensions.cxx gcc: src/ft2font.cpp gcc: CXX/IndirectPythonInterface.cxx gcc: src/mplutils.cpp gcc: CXX/cxxsupport.cxx g++ -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g -bundle -undefined dynamic_lookup build/temp.macosx-10.3-fat-2.5/src/ft2font.o build/temp.macosx-10.3-fat-2.5/src/mplutils.o build/temp.macosx-10.3-fat-2.5/CXX/cxx_extensions.o build/temp.macosx-10.3-fat-2.5/CXX/cxxsupport.o build/temp.macosx-10.3-fat-2.5/CXX/IndirectPythonInterface.o build/temp.macosx-10.3-fat-2.5/CXX/cxxextensions.o -L/usr/local/lib -L/usr/lib -lfreetype -lz -lstdc++ -lm -o build/lib.macosx-10.3-fat-2.5/matplotlib/ft2font.so ld: warning in /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libfreetype.dylib, file is not of required architecture ld: warning in /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libgcc_s.10.4.dylib, missing required architecture ppc in file ld: in /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libgcc_s.1.dylib, missing required architecture ppc in file for architecture ppc collect2: ld returned 1 exit status lipo: can't open input file: /var/folders/qT/qTRms9cJHNqoYnbs9+TwVk+++TI/-Tmp-//ccMsnFzZ.out (No such file or directory) ld: warning in /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libfreetype.dylib, file is not of required architecture ld: warning in /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libgcc_s.10.4.dylib, missing required architecture ppc in file ld: in /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libgcc_s.1.dylib, missing required architecture ppc in file for architecture ppc collect2: ld returned 1 exit status lipo: can't open input file: /var/folders/qT/qTRms9cJHNqoYnbs9+TwVk+++TI/-Tmp-//ccMsnFzZ.out (No such file or directory) error: Command "g++ -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g -bundle -undefined dynamic_lookup build/temp.macosx-10.3-fat-2.5/src/ft2font.o build/temp.macosx-10.3-fat-2.5/src/mplutils.o build/temp.macosx-10.3-fat-2.5/CXX/cxx_extensions.o build/temp.macosx-10.3-fat-2.5/CXX/cxxsupport.o build/temp.macosx-10.3-fat-2.5/CXX/IndirectPythonInterface.o build/temp.macosx-10.3-fat-2.5/CXX/cxxextensions.o -L/usr/local/lib -L/usr/lib -lfreetype -lz -lstdc++ -lm -o build/lib.macosx-10.3-fat-2.5/matplotlib/ft2font.so" failed with exit status 1 Macintosh:matplotlib jdhunter$
John Hunter <jdh2358@...> writes: > ld: in /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libgcc_s.1.dylib, > missing required architecture ppc in file for architecture ppc > collect2: ld returned 1 exit status Just a guess: Apple's Python is configured to compile everything as universal, but you have installed a non-universal gcc in /usr/local, perhaps as a result of installing some version of gfortran. -- Jouni
On 11/4/07, Jouni K Sepp=E4nen <jk...@ik...> wrote: > Just a guess: Apple's Python is configured to compile everything as unive= rsal, > but you have installed a non-universal gcc in /usr/local, perhaps as a r= esult > of installing some version of gfortran. Possibly, but 'which gcc' points to the /usr/bin apple version, and the gfortran I installed was fortran only (not the whole gcc suite) and is in /usr/local/ Macintosh:~ jdhunter$ which gcc /usr/bin/gcc Macintosh:~ jdhunter$ ls -ld /usr/bin/gcc lrwxr-xr-x 1 root wheel 7 Nov 3 18:00 /usr/bin/gcc -> gcc-4.0 Macintosh:~ jdhunter$ ls -ld /usr/bin/gcc-4.0 -rwxr-xr-x 1 root wheel 93072 Sep 23 17:37 /usr/bin/gcc-4.0 Macintosh:~ jdhunter$ ls -ld /usr/local/bin/g* -rwxr-xr-x 1 root wheel 160 Mar 22 2007 /usr/local/bin/genaxmodule -rwxr-xr-x@ 1 root wheel 318168 Oct 31 08:27 /usr/local/bin/gfortran mpl should not be invoking gfortran, so I am not sure where the problem is creeping in. JDH JDH
John Hunter <jdh2358@...> writes: > > Just a guess: Apple's Python is configured to compile everything as > > universal, but you have installed a non-universal gcc in /usr/local, > > perhaps as a result of installing some version of gfortran. > > Possibly, but 'which gcc' points to the /usr/bin apple version, and > the gfortran I installed was fortran only (not the whole gcc suite) > and is in /usr/local/ You have -L/usr/local/lib in the compile flags, and ld is finding a libgcc_s.10.4.dylib in /usr/local: > ld: warning in > /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libgcc_s.10.4.dylib, > missing required architecture ppc in file -- Jouni
John Hunter wrote: > On 11/4/07, Jouni K Seppänen <jk...@ik...> wrote: > >> Just a guess: Apple's Python is configured to compile everything as universal, >> but you have installed a non-universal gcc in /usr/local, perhaps as a result >> of installing some version of gfortran. > > Possibly, but 'which gcc' points to the /usr/bin apple version, and > the gfortran I installed was fortran only (not the whole gcc suite) > and is in /usr/local/ > > Macintosh:~ jdhunter$ which gcc > /usr/bin/gcc > Macintosh:~ jdhunter$ ls -ld /usr/bin/gcc > lrwxr-xr-x 1 root wheel 7 Nov 3 18:00 /usr/bin/gcc -> gcc-4.0 > Macintosh:~ jdhunter$ ls -ld /usr/bin/gcc-4.0 > -rwxr-xr-x 1 root wheel 93072 Sep 23 17:37 /usr/bin/gcc-4.0 > Macintosh:~ jdhunter$ ls -ld /usr/local/bin/g* > -rwxr-xr-x 1 root wheel 160 Mar 22 2007 /usr/local/bin/genaxmodule > -rwxr-xr-x@ 1 root wheel 318168 Oct 31 08:27 /usr/local/bin/gfortran > > mpl should not be invoking gfortran, so I am not sure where the > problem is creeping in. Are you using the gfortran from hpc.sf.net? I don't recommend it anymore. I use the binary from http://r.research.att.com/tools/. It is universal. That should help. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
On 11/4/07, Robert Kern <rob...@gm...> wrote: > Are you using the gfortran from hpc.sf.net? I don't recommend it anymore. I use > the binary from http://r.research.att.com/tools/. It is universal. That should help. Yep, I was. That was the binary recommended first on the wiki (at with a note at the end that some have had problems with it that do not appear related to my problem). Using the universal binary at the att site fixed my problem, and I updated the wiki at http://www.scipy.org/Installing_SciPy/Mac_OS_X. Now for my next problem: I built zlib, libpng an freetype from source and I get a ld: warning in /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libpng.dylib, file is not of required architecture error when building mpl. Is there an easy way in the configure/make/make install cycle to tell the compiler to build universal binaries? Alternatively, can I instruct distutils to simply not provide the -arch ppc build? I can see how this will be a problem down the road, since any non universal library I install on my system will potentially break my builds. Thanks, JDH
As a general note, I built MatPlotlib-SVN on Leopard against the Apple Python, using the numpy, libz, freetype, and png that are included with Leopard. It seems to work fine, superficially; I have not run extensive regressions with it yet. I can send along a MacPorts portfile (including patches) tomorrow; (my Leopard problem is that SSH won't respond so I can't get to my office machine from home). I have some opinions about your other questions, the answers are to set specific environment variables. However, my answers MIGHT BE WRONG because I can't test these at the moment (see ssh problem, above) So take these responses with some skepticism. But perhaps they can point you in a helpful direction: On Nov 4, 2007, at 6:29 AM, John Hunter wrote: > Now for my next problem: I built zlib, libpng an freetype from source > and I get a > > ld: warning in /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/ > libpng.dylib, > file is not of required architecture Hmm, what about setting a MACOSX_DEPLOYMENT_TARGET=10.5 > > error when building mpl. Is there an easy way in the > configure/make/make install cycle to tell the compiler to build > universal binaries? I believe that "generic" autoconf would pick up CFLAGS: CFLAGS="-arch ppc -arch i386" > Alternatively, can I instruct distutils to simply not provide the > -arch ppc build? Distutils uses ARCHFLAGS -- if you are using the Python from Apple Leopard: ARCHFLAGS="-arch i386"
On Nov 4, 2007 1:06 PM, Boyd Waters <bw...@nr...> wrote: > I believe that "generic" autoconf would pick up CFLAGS: > > CFLAGS="-arch ppc -arch i386" Worked for zlib and freetype, but failed for libpng with: gcc -DHAVE_CONFIG_H -I. -I. -I. -DPNG_CONFIGURE_LIBPNG -arch ppc -arch i386 -MT libpng12_la-png.lo -MD -MP -MF .deps/libpng12_la-png.Tpo -c png.c -fno-common -DPIC -o .libs/libpng12_la-png.o gcc-4.0: -E, -S, -save-temps and -M options are not allowed with multiple -arch flags But, following your suggestion, I built everything with : 536 export ARCHFLAGS="-arch i386" 537 export MACOSX_DEPLOYMENT_TARGET=10.5 538 export CFLAGS="-arch i386" 543 export LDFLAGS="-arch i386" 546 export CXXFLAGS="-arch i386" but am still getting a failure. command history and build output below. It appears the failure is happening at link time when the build tries to link. The code at http://mail.python.org/pipermail/python-checkins/2006-June/054322.html suggests that both platforms are being unconditionally added in the ARCHLIST but I am not sure if that is relevant here. In any case, if I could fix the libpng problem above, I wouldn't have to worry about it. ============================================================================ BUILDING MATPLOTLIB matplotlib: 0.90.1 python: 2.5 (r25:51918, Sep 19 2006, 08:49:13) [GCC 4.0.1 (Apple Computer, Inc. build 5341)] platform: darwin REQUIRED DEPENDENCIES numpy: 1.0.4.dev4380 freetype2: found, but unknown version (no pkg-config) OPTIONAL BACKEND DEPENDENCIES Gtk+: no * Building for Gtk+ requires pygtk; you must be able * to "import gtk" in your build/install environment Tkinter: Tkinter: 50704, Tk: 8.4, Tcl: 8.4 wxPython: 2.8.3.0 * WxAgg extension not required for wxPython >= 2.8 Qt: no Qt4: no Cairo: no libpng: found, but unknown version (no pkg-config) OPTIONAL DATE/TIMEZONE DEPENDENCIES datetime: present, version unknown dateutil: matplotlib will provide pytz: matplotlib will provide OPTIONAL USETEX DEPENDENCIES dvipng: no ghostscript: /bin/sh: gs: command not found latex: no EXPERIMENTAL CONFIG PACKAGE DEPENDENCIES configobj: matplotlib will provide enthought.traits: matplotlib will provide [Edit setup.cfg to suppress the above messages] ============================================================================ running build running build_py copying lib/matplotlib/mpl-data/matplotlibrc -> build/lib.macosx-10.5-i386-2.5/matplotlib/mpl-data running build_ext building 'matplotlib.backends._tkagg' extension C compiler: gcc -DNDEBUG -g -O3 -arch i386 compile options: '-I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tcl.framework/Versions/Current/PrivateHeaders -I/System/Library/Frameworks/Tk.framework/Headers -I/System/Library/Frameworks/Tk.framework/Versions/Current/PrivateHeaders -I/usr/local/include -I/usr/include -I. -Isrc -Iswig -Iagg23/include -I. -I/usr/local/include -I/usr/include -I. -I/System/Library/Frameworks/Tcl.framework/Headers/freetype2 -I/System/Library/Frameworks/Tcl.framework/Versions/Current/PrivateHeaders/freetype2 -I/System/Library/Frameworks/Tk.framework/Headers/freetype2 -I/System/Library/Frameworks/Tk.framework/Versions/Current/PrivateHeaders/freetype2 -I/usr/local/include/freetype2 -I/usr/include/freetype2 -I./freetype2 -Isrc/freetype2 -Iswig/freetype2 -Iagg23/include/freetype2 -I./freetype2 -I/usr/local/include/freetype2 -I/usr/include/freetype2 -I./freetype2 -I/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -c' extra options: '-framework Tcl -framework Tk' g++ -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g -bundle -undefined dynamic_lookup -arch i386 -arch i386 build/temp.macosx-10.5-i386-2.5/src/_tkagg.o build/temp.macosx-10.5-i386-2.5/CXX/cxx_extensions.o build/temp.macosx-10.5-i386-2.5/CXX/cxxsupport.o build/temp.macosx-10.5-i386-2.5/CXX/IndirectPythonInterface.o build/temp.macosx-10.5-i386-2.5/CXX/cxxextensions.o -L/usr/local/lib -L/usr/lib -L/usr/local/lib -L/usr/lib -lpng -lz -lstdc++ -lm -lfreetype -lz -lstdc++ -lm -o build/lib.macosx-10.5-i386-2.5/matplotlib/backends/_tkagg.so -framework Tcl -framework Tk ld: warning in build/temp.macosx-10.5-i386-2.5/src/_tkagg.o, file is not of required architecture ld: warning in build/temp.macosx-10.5-i386-2.5/CXX/cxx_extensions.o, file is not of required architecture ld: warning in build/temp.macosx-10.5-i386-2.5/CXX/cxxsupport.o, file is not of required architecture ld: warning in build/temp.macosx-10.5-i386-2.5/CXX/IndirectPythonInterface.o, file is not of required architecture ld: warning in build/temp.macosx-10.5-i386-2.5/CXX/cxxextensions.o, file is not of required architecture ld: warning in /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libpng.dylib, file is not of required architecture ld: warning in /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libfreetype.dylib, file is not of required architecture ld: in /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libPng.dylib, file is not of required architecture for architecture ppc collect2: ld returned 1 exit status lipo: can't open input file: /var/folders/qT/qTRms9cJHNqoYnbs9+TwVk+++TI/-Tmp-//ccnIc3Eg.out (No such file or directory) ld: warning in build/temp.macosx-10.5-i386-2.5/src/_tkagg.o, file is not of required architecture ld: warning in build/temp.macosx-10.5-i386-2.5/CXX/cxx_extensions.o, file is not of required architecture ld: warning in build/temp.macosx-10.5-i386-2.5/CXX/cxxsupport.o, file is not of required architecture ld: warning in build/temp.macosx-10.5-i386-2.5/CXX/IndirectPythonInterface.o, file is not of required architecture ld: warning in build/temp.macosx-10.5-i386-2.5/CXX/cxxextensions.o, file is not of required architecture ld: warning in /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libpng.dylib, file is not of required architecture ld: warning in /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libfreetype.dylib, file is not of required architecture ld: in /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libPng.dylib, file is not of required architecture for architecture ppc collect2: ld returned 1 exit status lipo: can't open input file: /var/folders/qT/qTRms9cJHNqoYnbs9+TwVk+++TI/-Tmp-//ccnIc3Eg.out (No such file or directory) error: Command "g++ -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g -bundle -undefined dynamic_lookup -arch i386 -arch i386 build/temp.macosx-10.5-i386-2.5/src/_tkagg.o build/temp.macosx-10.5-i386-2.5/CXX/cxx_extensions.o build/temp.macosx-10.5-i386-2.5/CXX/cxxsupport.o build/temp.macosx-10.5-i386-2.5/CXX/IndirectPythonInterface.o build/temp.macosx-10.5-i386-2.5/CXX/cxxextensions.o -L/usr/local/lib -L/usr/lib -L/usr/local/lib -L/usr/lib -lpng -lz -lstdc++ -lm -lfreetype -lz -lstdc++ -lm -o build/lib.macosx-10.5-i386-2.5/matplotlib/backends/_tkagg.so -framework Tcl -framework Tk" failed with exit status 1
John Hunter wrote: > Now for my next problem: I built zlib, libpng an freetype from source > and I get a William Kyngesburye is building and maintaining a nice set of Universal Frameworks of various libs that are more or less standard on Linux: http://www.kyngchaos.com/software/unixport/frameworks Maybe they would be a good set to use as a standard recommendation for folks building/using MPL on OS-X. I think the Freetype and UnixImageIO Frameworks would cover it for MPL. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no...