OS X Leopard install, snag

John Hunter <jdh2358@...552...> 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

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

···

On 11/4/07, Jouni K Seppänen <jks@...278...> 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.

John Hunter wrote:

···

On 11/4/07, Jouni K Seppänen <jks@...278...> 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

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

···

On 11/4/07, Robert Kern <robert.kern@...149...> 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.

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:

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, at 6:29 AM, John Hunter wrote:

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

Chris.Barker@...236...

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.

···

On Nov 4, 2007 1:06 PM, Boyd Waters <bwaters@...451...> wrote:

I believe that "generic" autoconf would pick up CFLAGS:

CFLAGS="-arch ppc -arch i386"

============================================================================
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