[Numpy-discussion] f2py from numpy 1.0.5 on OSX 10.4.11/QuadPPC fails with undefined symbols

Robert Kern robert.kern@gmail....
Sun Mar 30 21:46:21 CDT 2008


On Sun, Mar 30, 2008 at 9:20 PM, Harry Mangalam <harry.mangalam@uci.edu> wrote:
> On Sunday 30 March 2008, Robert Kern wrote:
>  > On Sun, Mar 30, 2008 at 8:16 PM, Harry Mangalam
>  <harry.mangalam@uci.edu> wrote:
>  > > Answering part of my own question, one missing lib is (not
>  > >  surprisingly) libpython2.5 (add -lpython2.5) so that the link
>  > > command is:
>  >
>  > No, it isn't. They are "-undefined dynamic_lookup -bundle", most
>  > likely. This is a deficiency of the g95 FCompiler implementation.
>  > No one has bothered to get it to work on OS X; I'm not sure if g95
>  > even supports these flags. They were added to gcc (and accordingly
>  > gfortran) by Apple; I don't know if the g95 guy has kept up.
>
>  Hi Robert,
>
>  I don't understand the "No, it isn't." part.  Adding '-lpython2.5'
>  certainly removed that long list of undefined symbols - are you
>  saying it really had no effect and that should be:
>  "-undefined dynamic_lookup -bundle"

First, you need the "-bundle" in order to tell the linker to create a
.so bundle. Otherwise, it tries to make an executable and (correctly)
warns you that you do not have a main() function.

The "-undefined dynamic_lookup" tells the linker to ignore undefined
symbols and assume that they will be found when the bundle is
dynamically loaded, as is the case for all of the Python symbols when
the extension module gets loaded. Adding -lpython2.5 silences those
error messages, but does not actually address the underlying problem.

>  That had little effect, so I think I've misunderstood you.

Show me the link command that got executed and the error messages
which followed.

>   The link command that has come closest to working is:
>
> /usr/local/bin/g95 \
>  -L/opt/local/lib/ \
>  -L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib \
>   /tmp/tmp5Ef8uL/tmp/tmp5Ef8uL/src.macosx-10.3-ppc-2.5/fd_rrt1dmodule.o\
>   /tmp/tmp5Ef8uL/tmp/tmp5Ef8uL/src.macosx-10.3-ppc-2.5/fortranobject.o\
>   /tmp/tmp5Ef8uL/CQZ.o /tmp/tmp5Ef8uL/Umatrix1D.o\
>   /tmp/tmp5Ef8uL/fd_rrt1d.o\
>   /tmp/tmp5Ef8uL/tmp/tmp5Ef8uL/src.macosx-10.3-ppc-2.5/fd_rrt1d-f2pywrappers.o\
>   -lpython2.5 \
>   -lSystemStubs\
>   -llapack\
>   -lblas\
>
>   -o ./fd_rrt1d.so\
>   -Wl,-framework -Wl,Accelerate
>  ld: Undefined symbols:
>  _MAIN_
>
>  Altho there is a requirement for g95 to support the other platforms,
>  I'm willing to try another free compiler - do you have a
>  recommendation?

gfortran. Get the binary from here:

  http://r.research.att.com/tools/

The MacPorts gfortran may also work, but I haven't tested it.

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


More information about the Numpy-discussion mailing list