[Pythonmac-SIG] -Wl, -x in distutils module linking causes crashes

Nicholas Riley njriley at uiuc.edu
Mon Sep 22 14:14:50 EDT 2003


On Mon, Sep 22, 2003 at 11:24:21AM +0200, Jack Jansen wrote:

> Are you sure you completely cleaned out any objects from the old
> build?

I removed all the object files corresponding to the Python bindings,
but not those for the underlying Metakit library.  Perhaps this is the
problem?  If so, I'm not sure what to do because we need to preserve
our existing build system for other platforms.

> Because the "-Wl,-bind_at_load -flat_namespace -undefined suppress"
> is bit is really very bad practice.  It basically tells the linker
> "don't worry about any external symbol, and just hack something
> together at runtime".

Right, as I wrote, we're moving away from this GNU libtool-based build
method.  That's just the standard set of flags libtool provides to get
behavior as other Unix platforms provide.  Aha!  I found this comment
in the libtool source:

      case $host in
      *darwin*)
        # Don't allow lazy linking, it breaks C++ global constructors            
        if test "$tagname" = CXX ; then
        compile_command="$compile_command ${wl}-bind_at_load"
        finalize_command="$finalize_command ${wl}-bind_at_load"
        fi
        ;;
      esac

So perhaps that's the problem?

> The "-Wl,-x" shouldn't cause any problems: it only strips non-global
> symbols. While this could hinder debugging it shouldn't have any
> effect on linking. Unless it is somehow C++-related: does anyone
> know whether stripping non-global symbols could cause problems for
> the G++ RTTI stuff or exception handling or something?

I guess so.  I know little about C++ and less about the GNU C++
compiler runtime, but it definitely will not work with -Wl,-x in place.

-- 
=Nicholas Riley <njriley at uiuc.edu> | <http://www.uiuc.edu/ph/www/njriley>



More information about the Pythonmac-SIG mailing list