problem building on mac (ppc arch issue)

Hi,

I am having a problem building matplotlib on OS X. It seems it has
come up quite a few times, but I haven't seen an answer. The problem
is that it seems to be trying to build a fat binary (-arch i386 -arch
ppc) but some of the depencies (installed via macports) are i386 only
so I get

Oops.. I'll continue

I am having a problem building matplotlib on OS X. It seems it has
come up quite a few times, but I haven't seen an answer. The problem
is that it seems to be trying to build a fat binary (-arch i386 -arch
ppc) but some of the depencies (installed via macports) are i386 only
so I get a "file is not of required architecture for architecture ppc"
error on linking. (See below)

How can I stop setup.py from trying to build ppc architecture?
I tried
CFLAGS="-Os -arch i386" LDFLAGS="-Os -arch i386" python setup.py build
but it didn't seem to make any difference.

Thanks

Robin

···

============================================================================
BUILDING MATPLOTLIB
            matplotlib: 0.98.5
                python: 2.5.1 (r251:54869, Apr 18 2007, 22:08:04) [GCC
                        4.0.1 (Apple Computer, Inc. build 5367)]
              platform: darwin

REQUIRED DEPENDENCIES
                 numpy: 1.3.0.dev6050
             freetype2: 9.18.3

OPTIONAL BACKEND DEPENDENCIES
                libpng: 1.2.33
               Tkinter: Tkinter: 50704, Tk: 8.4, Tcl: 8.4
              wxPython: 2.8.6.0
                        * WxAgg extension not required for wxPython >= 2.8
                  Gtk+: no
                        * Building for Gtk+ requires pygtk; you must be able
                        * to "import gtk" in your build/install environment
       Mac OS X native: yes
                    Qt: no
                   Qt4: no
                 Cairo: no

OPTIONAL DATE/TIMEZONE DEPENDENCIES
              datetime: present, version unknown
              dateutil: matplotlib will provide
                  pytz: matplotlib will provide
adding pytz

OPTIONAL USETEX DEPENDENCIES
                dvipng: 1.11
           ghostscript: 8.62
                 latex: 3.1415926
               pdftops: 3.02

EXPERIMENTAL CONFIG PACKAGE DEPENDENCIES
             configobj: matplotlib will provide
      enthought.traits: no

[Edit setup.cfg to suppress the above messages]

pymods ['pylab', 'configobj']
packages ['matplotlib', 'matplotlib.backends',
'matplotlib.projections', 'mpl_toolkits', 'matplotlib.numerix',
'matplotlib.numerix.mlab', 'matplotlib.numerix.ma',
'matplotlib.numerix.npyma', 'matplotlib.numerix.linear_algebra',
'matplotlib.numerix.random_array', 'matplotlib.numerix.fft',
'matplotlib.delaunay', 'pytz', 'dateutil', 'dateutil/zoneinfo',
'matplotlib.config']
running build
running build_py
copying lib/matplotlib/mpl-data/matplotlibrc ->
build/lib.macosx-10.3-fat-2.5/matplotlib/mpl-data
copying lib/matplotlib/mpl-data/matplotlib.conf ->
build/lib.macosx-10.3-fat-2.5/matplotlib/mpl-data
running build_ext
building 'matplotlib.ft2font' extension
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/opt/local/lib
-L/usr/local/lib -L/usr/lib -L/usr/X11R6/lib -lfreetype -lz -lz
-lstdc++ -lm -o build/lib.macosx-10.3-fat-2.5/matplotlib/ft2font.so
-Wl,-framework,CoreServices -Wl,-framework,ApplicationServices
ld: warning in build/temp.macosx-10.3-fat-2.5/src/ft2font.o, file is
not of required architecture
ld: warning in build/temp.macosx-10.3-fat-2.5/src/mplutils.o, file is
not of required architecture
ld: warning in build/temp.macosx-10.3-fat-2.5/CXX/cxx_extensions.o,
file is not of required architecture
ld: warning in build/temp.macosx-10.3-fat-2.5/CXX/cxxsupport.o, file
is not of required architecture
ld: warning in build/temp.macosx-10.3-fat-2.5/CXX/IndirectPythonInterface.o,
file is not of required architecture
ld: warning in build/temp.macosx-10.3-fat-2.5/CXX/cxxextensions.o,
file is not of required architecture
ld: warning in /opt/local/lib/libfreetype.dylib, file is not of
required architecture
ld: warning in /opt/local/lib/libz.dylib, file is not of required architecture
ld: in /opt/local/lib/libJPEG.dylib, file is not of required
architecture for architecture ppc
collect2: ld returned 1 exit status
ld: warning, duplicate dylib /opt/local/lib/libz.1.dylib
lipo: can't open input file:
/var/folders/8s/8sR4EeeWGVKm6eizf-nS9U+++TI/-Tmp-//cchTIwch.out (No
such file or directory)
error: command 'g++' failed with exit status 1

If your goal is to build only for Intel, edit the Makefile inside your
(wherever your python installation is)/lib/python2.5/config directory
and delete "-arch ppc" everywhere you see it. Then try a clean build
of matplotlib. I'd make a backup copy of the original somewhere just
in case something goes wrong in editing the Makefile, though. You
don't need to worry about the -Os optimization flag unless you're
running Leopard, in which case setup.py has a build_osx105 target that
will handle that for you. Given your arch issues, though, I'd edit
setup.py in the matplotlib source and take out the -arch ppc flags
there too if you decide to use the target.

Josh

···

On Sat, Dec 13, 2008 at 12:47 PM, Robin <robince@...287...> wrote:

Oops.. I'll continue

I am having a problem building matplotlib on OS X. It seems it has
come up quite a few times, but I haven't seen an answer. The problem
is that it seems to be trying to build a fat binary (-arch i386 -arch
ppc) but some of the depencies (installed via macports) are i386 only
so I get a "file is not of required architecture for architecture ppc"
error on linking. (See below)

How can I stop setup.py from trying to build ppc architecture?
I tried
CFLAGS="-Os -arch i386" LDFLAGS="-Os -arch i386" python setup.py build
but it didn't seem to make any difference.

Thanks

Robin

============================================================================
BUILDING MATPLOTLIB
           matplotlib: 0.98.5
               python: 2.5.1 (r251:54869, Apr 18 2007, 22:08:04) [GCC
                       4.0.1 (Apple Computer, Inc. build 5367)]
             platform: darwin

REQUIRED DEPENDENCIES
                numpy: 1.3.0.dev6050
            freetype2: 9.18.3

OPTIONAL BACKEND DEPENDENCIES
               libpng: 1.2.33
              Tkinter: Tkinter: 50704, Tk: 8.4, Tcl: 8.4
             wxPython: 2.8.6.0
                       * WxAgg extension not required for wxPython >= 2.8
                 Gtk+: no
                       * Building for Gtk+ requires pygtk; you must be able
                       * to "import gtk" in your build/install environment
      Mac OS X native: yes
                   Qt: no
                  Qt4: no
                Cairo: no

OPTIONAL DATE/TIMEZONE DEPENDENCIES
             datetime: present, version unknown
             dateutil: matplotlib will provide
                 pytz: matplotlib will provide
adding pytz

OPTIONAL USETEX DEPENDENCIES
               dvipng: 1.11
          ghostscript: 8.62
                latex: 3.1415926
              pdftops: 3.02

EXPERIMENTAL CONFIG PACKAGE DEPENDENCIES
            configobj: matplotlib will provide
     enthought.traits: no

[Edit setup.cfg to suppress the above messages]

pymods ['pylab', 'configobj']
packages ['matplotlib', 'matplotlib.backends',
'matplotlib.projections', 'mpl_toolkits', 'matplotlib.numerix',
'matplotlib.numerix.mlab', 'matplotlib.numerix.ma',
'matplotlib.numerix.npyma', 'matplotlib.numerix.linear_algebra',
'matplotlib.numerix.random_array', 'matplotlib.numerix.fft',
'matplotlib.delaunay', 'pytz', 'dateutil', 'dateutil/zoneinfo',
'matplotlib.config']
running build
running build_py
copying lib/matplotlib/mpl-data/matplotlibrc ->
build/lib.macosx-10.3-fat-2.5/matplotlib/mpl-data
copying lib/matplotlib/mpl-data/matplotlib.conf ->
build/lib.macosx-10.3-fat-2.5/matplotlib/mpl-data
running build_ext
building 'matplotlib.ft2font' extension
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/opt/local/lib
-L/usr/local/lib -L/usr/lib -L/usr/X11R6/lib -lfreetype -lz -lz
-lstdc++ -lm -o build/lib.macosx-10.3-fat-2.5/matplotlib/ft2font.so
-Wl,-framework,CoreServices -Wl,-framework,ApplicationServices
ld: warning in build/temp.macosx-10.3-fat-2.5/src/ft2font.o, file is
not of required architecture
ld: warning in build/temp.macosx-10.3-fat-2.5/src/mplutils.o, file is
not of required architecture
ld: warning in build/temp.macosx-10.3-fat-2.5/CXX/cxx_extensions.o,
file is not of required architecture
ld: warning in build/temp.macosx-10.3-fat-2.5/CXX/cxxsupport.o, file
is not of required architecture
ld: warning in build/temp.macosx-10.3-fat-2.5/CXX/IndirectPythonInterface.o,
file is not of required architecture
ld: warning in build/temp.macosx-10.3-fat-2.5/CXX/cxxextensions.o,
file is not of required architecture
ld: warning in /opt/local/lib/libfreetype.dylib, file is not of
required architecture
ld: warning in /opt/local/lib/libz.dylib, file is not of required architecture
ld: in /opt/local/lib/libJPEG.dylib, file is not of required
architecture for architecture ppc
collect2: ld returned 1 exit status
ld: warning, duplicate dylib /opt/local/lib/libz.1.dylib
lipo: can't open input file:
/var/folders/8s/8sR4EeeWGVKm6eizf-nS9U+++TI/-Tmp-//cchTIwch.out (No
such file or directory)
error: command 'g++' failed with exit status 1

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users