Using `-undefined dynamic_lookup` ?
Joshua Root
jmr at macports.org
Mon Jan 13 13:13:26 PST 2014
On 2014-1-14 02:04 , Peter Danecek wrote:
>
> Hi MacPorts Developers,
>
> This is related to my last question on building Fortran extensions using `numpy.distutils`. But this one is quite short.
>
> So I figured how to workaround my problem by specifying some extra arguments in the setup.py script. But I have (at least) two option. One is to link against the python library explicitly (using the link in ${prefix}/lib, the other which is actually used by all C extension is the `-undefined dynamic_lookup`. Given the fact that it is used for the C extensions and seems to be usual in the context of Python (e.g. when building manually etc.), I am inclined to use the second one. But I am a bit wondering if this is completely save, or if there might be situations where this would result in using the wrong library, for example the systems python library.
>
> Any thoughts on that?
It's appropriate to use -undefined dynamic_lookup when linking
plugin-type objects that use symbols from the executable that loads
them. The downside is that you defer any errors about missing symbols to
runtime, and I think there's a small performance penalty compared to
linking against the main executable and any needed libs at build time.
There's no real danger of using the wrong libs in this situation since
it will use whatever is in the interpreter that loads the module. (If
python were to use two-level namespace to link with multiple libs
providing the same symbols, it could be an issue, but that seems unlikely.)
<https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/MachOTopics/1-Articles/executing_files.html>
- Josh
More information about the macports-dev
mailing list