Search code examples
pythonmacosgdbada

gdb on MacOS Ventura fails with python library not loaded


I have a build of gdb for an Ada toolchain, and it appears there is a reference to a Python dynamic library that does not exist on my system (Intel Mac, Ventura 13.4.1 (c)).

$ which gdb
/opt/gcc-13.1.0/bin/gdb

$ gdb
dyld[19305]: Library not loaded: /Library/Frameworks/Python.framework/Versions/3.9/Python
  Referenced from: <3FCB836C-8BBC-39C7-894C-6F9582FEAE7F> /opt/gcc-13.1.0/bin/gdb
  Reason: tried: '/Library/Frameworks/Python.framework/Versions/3.9/Python' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/Python.framework/Versions/3.9/Python' (no such file), '/Library/Frameworks/Python.framework/Versions/3.9/Python' (no such file), '/System/Library/Frameworks/Python.framework/Versions/3.9/Python' (no such file, not in dyld cache)
Abort trap: 6

$ dyld_info /opt/gcc-13.1.0/bin/gdb
/opt/gcc-13.1.0/bin/gdb [x86_64]:
    -platform:
        platform     minOS      sdk
           macOS     12.0      10.17  
    -segments:
        load-offset   segment section        sect-size  seg-size perm
        0x00000000    __TEXT                              7728KB r.x
        0x00001090             __text           5025114
        0x004CBDF0             __text_startup    23672
        0x004D1A68             __text_cold      125143
        0x004F0340             __stubs            9060
        0x004F26A4             __stub_helper      6276
        0x004F3F28             __cstring        899918
        0x005CFA80             __const          155833
        0x005F5B40             __info_plist        466
        0x005F5D18             __eh_frame       1663704
        0x0078C000    __DATA_CONST                        1088KB rw.
        0x0078C000             __got              5824
        0x0078D6C0             __mod_init_func     800
        0x0078D9E0             __const          1099176
        0x0089C000    __DATA                               304KB rw.
        0x0089C000             __la_symbol_ptr   12080
        0x0089EF30             __gcc_except_tab 118952
        0x008BBFE0             __data            76000
        0x008CE8C0             __bss             91000
        0x008E4C40             __common           9104
    -dependents:
        attributes     load path
                       /usr/lib/libiconv.2.dylib
                       /usr/lib/libncurses.5.4.dylib
                       /Library/Frameworks/Python.framework/Versions/3.9/Python
                       /usr/lib/libexpat.1.dylib
                       /opt/gcc-13.1.0/lib/libmpfr.6.dylib
                       /opt/gcc-13.1.0/lib/libgmp.10.dylib
                       /opt/gcc-13.1.0/lib/libstdc++.6.dylib
                       /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
                       /usr/lib/libSystem.B.dylib

$ ls /Library/Frameworks/Python.framework
ls: /Library/Frameworks/Python.framework: No such file or directory

$ which python3
/usr/bin/python3

$ which python3.9
/usr/local/bin/python3.9

I have installed Python via brew. Where should I look for the required library (so I can set DYLD_LIBRARY_PATH), or how can I install the proper one?


Solution

  • Your best bet is to go here and install the macOS 64-bit universal2 installer (that’s my copy of the link, in case of trouble may be best to go to the original page and download from there, under the Files section, 4th link down). That’s the one I used; next time I’ll go for a more up-to-date Python.