python / cpython

The Python programming language
https://www.python.org/
Other
59.68k stars 28.93k forks source link

Fix dynamic module linking on Mac OSX/OSXS #33464

Closed ebd80758-eb43-4a34-86bb-a2b2a2196e69 closed 23 years ago

ebd80758-eb43-4a34-86bb-a2b2a2196e69 commented 23 years ago
BPO 402354
Nosy @gvanrossum, @loewis
Files
  • None: None
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields: ```python assignee = 'https://github.com/gvanrossum' closed_at = created_at = labels = ['build'] title = 'Fix dynamic module linking on Mac OSX/OSXS' updated_at = user = 'https://bugs.python.org/bbum' ``` bugs.python.org fields: ```python activity = actor = 'gvanrossum' assignee = 'gvanrossum' closed = True closed_date = None closer = None components = ['Build'] creation = creator = 'bbum' dependencies = [] files = ['2915'] hgrepos = [] issue_num = 402354 keywords = ['patch'] message_count = 6.0 messages = ['34778', '34779', '34780', '34781', '34782', '34783'] nosy_count = 3.0 nosy_names = ['gvanrossum', 'loewis', 'bbum'] pr_nums = [] priority = 'normal' resolution = 'rejected' stage = None status = 'closed' superseder = None type = None url = 'https://bugs.python.org/issue402354' versions = [] ```

    ebd80758-eb43-4a34-86bb-a2b2a2196e69 commented 23 years ago
    gvanrossum commented 23 years ago

    Looks to me like a newer version of this patch is submitted as bpo-102362, so I'm rejecting this one.

    61337411-43fc-4a9c-b8d5-4060aede66d0 commented 23 years ago

    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?

    ebd80758-eb43-4a34-86bb-a2b2a2196e69 commented 23 years ago

    *** /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";;

    ebd80758-eb43-4a34-86bb-a2b2a2196e69 commented 23 years ago

    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.

    ebd80758-eb43-4a34-86bb-a2b2a2196e69 commented 23 years ago

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