Compiling Fortran code for Python module

Joshua Root jmr at macports.org
Thu May 2 18:32:39 PDT 2013


On 2013-5-3 08:35 , Frank Schima wrote:
> As an update. I added the following line to the Portfile which fixed the
> Fortran code and then goes on to break the C code being compiled later:
> 
>     build.env-append     LDFLAGS=-undefined dynamic_lookup -bundle
> 
> /usr/bin/clang -bundle -undefined dynamic_lookup -L/opt/local/lib
> dynamic_lookup build/temp.macosx-10.8-x86_64-2.7/qutip/cyQ/spmatfuncs.o
> -Lbuild/temp.macosx-10.8-x86_64-2.7 -o
> build/lib.macosx-10.8-x86_64-2.7/qutip/cyQ/spmatfuncs.so
> clang: error: no such file or directory: 'dynamic_lookup'
> 
> 
> Any ideas?

The default LDSHARED command when building C extensions for python
definitely contains "-bundle -undefined dynamic_lookup". For example
this is a link command run by py27-game (which succeeds, of course):

/usr/bin/clang -bundle -undefined dynamic_lookup -L/opt/local/lib -arch
x86_64 -arch x86_64 build/temp.macosx-10.7-x86_64-2.7/src/imageext.o
-L/opt/local/lib -L/opt/local/lib -L/opt/local/lib -L/opt/local/lib
-lSDL -lSDL_image -lpng -ljpeg -o
build/lib.macosx-10.7-x86_64-2.7/pygame/imageext.so

So it's not clear why (a) you would have to add it manually at all, or
(b) why it would fail like that. For (a), I can only guess that maybe
the setup.py is overriding some of the standard distutils behaviour for
handling environment variables, and overwriting something when it should
append. The environment is one of the relevant differences between
running it manually and from a portfile.

- Josh


More information about the macports-dev mailing list