[Patches] [Patch #102354] Fix dynamic module linking on Mac OSX/OSXS

noreply@sourceforge.net noreply@sourceforge.net
Sun, 12 Nov 2000 08:22:10 -0800


Patch #102354 has been updated. 

Project: python
Category: Build
Status: Open
Summary: Fix dynamic module linking on Mac OSX/OSXS

Follow-Ups:

Date: 2000-Nov-11 11:05
By: bbum

Comment:
*** /tmp/Python-2.0/configure.in        Mon Oct 16 17:50:06 2000
--- configure.in        Sat Nov 11 13:54:43 2000
***************
*** 573,581 ****
          Darwin/*|next/*) 
                if test "$ns_dyld"
                then 
!                 if test "$ac_sys_system" = Darwin
!                 then LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined suppress'
!                 else LDSHARED='$(CC) $(LDFLAGS) -bundle -prebind'
                  fi
                else LDSHARED='$(CC) $(CFLAGS) -nostdlib -r';
                fi
--- 573,579 ----
          Darwin/*|next/*) 
                if test "$ns_dyld"
                then 
!                 LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined suppress'
                  fi
                else LDSHARED='$(CC) $(CFLAGS) -nostdlib -r';
                fi
***************
*** 646,652 ****
        # in System.framework; otherwise, __objcInit (referenced in
        # crt1.o) gets erroneously defined as common, which breaks dynamic
        # loading of any modules which reference it in System.framework
!       next/4*|next/5*) LINKFORSHARED="-u __dummy -framework System" ;;
        Darwin/*) LINKFORSHARED="-framework System" ;;
        SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
        ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
--- 644,650 ----
        # in System.framework; otherwise, __objcInit (referenced in
        # crt1.o) gets erroneously defined as common, which breaks dynamic
        # loading of any modules which reference it in System.framework
!       next/4*|next/5*) LINKFORSHARED="-u __dummy -framework System -framework Foundation" ;;
        Darwin/*) LINKFORSHARED="-framework System" ;;
        SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
        ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;

-------------------------------------------------------

Date: 2000-Nov-11 11:07
By: bbum

Comment:
The addition of -framework Foundation is required to allow dynamically loaded modules to have access to the Objective-C runtiem under OSXS.

This *may* also be required under Darwin/OSX, but-- if that is the case-- it will be submitted as a separate patch once I restore my OSX work environment and can verify that it is the case.
-------------------------------------------------------

Date: 2000-Nov-12 02:07
By: loewis

Comment:
If you add an option that is required for something, then it would be good to add a comment to indicate what the something is. Also, are you sure that linking with the Foundation framework is absolutely necessary? Would it be possible for extension modules to link with the framework themselves if they need it?
-------------------------------------------------------

Date: 2000-Nov-12 08:22
By: bbum

Comment:
(It isn't clear where one can actually document a patch when uploading the first version.   I'll have to make sure and add a comment after the initial upload-- or document the code better.  Sorry about that.)

The Foundation framework must be linked into the python executable if any dynamically loaded module is to ever use the Objective-C runtime.   At least, I haven't found a workaround that allows one to link it into the loadable module.

If it isn't, then the load dies with one of two erros depending on platform:

OSX:   dies with a duplicate symbol error on __objcInit.

OSXS:  dies with a "objc: link required classes into application"



-------------------------------------------------------

-------------------------------------------------------
For more info, visit:

http://sourceforge.net/patch/?func=detailpatch&patch_id=102354&group_id=5470