GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — "dyld: Library not loaded: /lib/libpython3.13.dylib" in 3.13.0a4 MacOS non-framework build with custom prefix · Issue #115737 · python/cpython

"dyld: Library not loaded: /lib/libpython3.13.dylib" in 3.13.0a4 MacOS non-framework build with custom prefix #115737

New issue
Copy link
New issue
Copy link
Closed
Closed
"dyld: Library not loaded: /lib/libpython3.13.dylib" in 3.13.0a4 MacOS non-framework build with custom prefix#115737
Copy link
Labels
OS-macbuildThe build process and cross-buildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@native-api
native-api
opened on Feb 20, 2024
Issue body actions

Bug report

Bug description:

The above error was discovered in Pyenv CI check (logs are on the link).

See pyenv/pyenv#2903 (comment) for diagnostics and probable cause.

CPython versions tested on:

3.13

Operating systems tested on:

macOS

Linked PRs

  • gh-115737: Correct the install name for non-framework macOS libPython builds. #115750
Reacted by Edgar Ramírez Mondragón

Activity

Next
  1. native-api
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Feb 20, 2024
  2. Eclips4
    added
    OS-mac
    buildThe build process and cross-buildThe build process and cross-build
    on Feb 20, 2024
  3. ronaldoussoren commented on Feb 20, 2024

    @ronaldoussoren
    ronaldoussoren
    on Feb 20, 2024
    Contributor
    More actions

    How can we reproduce this? In particular, what is the command-line for configure and any additional customization of the build process?

  4. ned-deily commented on Feb 20, 2024

    @ned-deily
    ned-deily
    on Feb 20, 2024
    Member
    More actions

    From a quick look at the linked pyenv issue, it looks like this may be related to the changes for iOS frameworks builds (gh-114099). @freakboy3742?

    Reacted by Erlend E. Aasland and Edgar Ramírez Mondragón
  5. ronaldoussoren commented on Feb 20, 2024

    @ronaldoussoren
    ronaldoussoren
    on Feb 20, 2024
    Contributor
    More actions

    I'd still like to know how to reproduce this without having to hunt through the pyenv GitHub. The linked issue seems to use -rpath somehow, which is not something we explicitly support.

    Reacted by Erlend E. Aasland and Ned Deily
  6. freakboy3742 commented on Feb 20, 2024

    @freakboy3742
    freakboy3742
    on Feb 20, 2024
    Contributor
    More actions

    @ned-deily As with @ronaldoussoren, I'm trying to work out what the reproduction instructions are... I'll dig in and see if I can reverse engineer the problem.

    Reacted by Erlend E. Aasland
  7. native-api commented on Feb 21, 2024

    @native-api
    native-api
    on Feb 21, 2024
    ContributorAuthor
    More actions

    Attached a Bash trace log from the Pyenv invocation which contains configure/make calls and ennvar assignments. That's what I usually use to diagnose Pyenv issues.
    out.txt
    If you need a more distilled view, I'll be able to compose it when I return from work in about 10 hours.

    Setting rpaths is required in MacOS to find dylibs outside of the default search path -- in Homebrew and under the custom installation prefix.

  8. freakboy3742 commented on Feb 21, 2024

    @freakboy3742
    freakboy3742
    on Feb 21, 2024
    Contributor
    More actions

    @native-api Thanks for that detail - based on that, I've been able work out the reproduction case is:

    ./configure --prefix=$(pwd)/root --enable-shared --libdir=$(pwd)/root/lib && make -j4 all install && $(pwd)/root/bin/python3.13 -m test.pythoninfo
    
    Reacted by native-api
  9. freakboy3742 commented on Feb 21, 2024

    @freakboy3742
    freakboy3742
    on Feb 21, 2024
    Contributor
    More actions

    FWIW: it looks like the problem slipped in because while I did test non-framework builds, and non-framework builds in a non-default location, I didn't check a shared (i.e. ,--enable-shared) non-framework, non-default location build.

    Reacted by Ned Deily and Erlend E. Aasland
  10. ned-deily commented on Feb 21, 2024

    @ned-deily
    ned-deily
    on Feb 21, 2024
    Member
    More actions

    shared (i.e. ,--enable-shared) non-framework, non-default location build

    Sorry, I should have thought to suggest testing that one as well originally. I generally avoid --enable-shared builds on macOS as they often lead to problems like this but they are used.

  11. native-api commented on Feb 21, 2024

    @native-api
    native-api
    on Feb 21, 2024
    ContributorAuthor
    More actions

    We have enabled --enable-shared by default by user requests. The rationale was it is required for products that link against libpython and it's the setting in official CPython Docker images.

    Reacted by Ned Deily
  12. ned-deily commented on Feb 21, 2024

    @ned-deily
    ned-deily
    on Feb 21, 2024
    Member
    More actions

    To be sure, there's nothing inherently bad about using --enable-shared on macOS, especially when running from an installed Python. You just need to be vigilant during development and testing when running from a Python build directory to make sure the interpreter is not using the old installed shared library rather than the newly built one.

    I've commented on the PR on how we can simplify the proposed fix.

    That said, I stumbled across another potential problem here with --enable-shared. In the reproduction case above, there is:

    --prefix=$(pwd)/root --enable-shared --libdir=$(pwd)/root/lib

    Now it turns out that specifying that value for libdir is a no-op since the default value of libdir is $prefix/lib so there's no need to use libdir in this case. However, if you were to use a different value for libdir, then the macOS install_name, i.e. the path to the shared library that is baked into the python executable by the linker, is hardwired to be $prefix/lib so attempting to execute python will immediately segfault. It would be a simple change here to fix the install_name for the enable-shared case to use libdir, which is where the shared library is installed, and, while that does prevent the segfault, the installed Python is still not very usable as the standard library extension modules are also installed into libdir but the default sys.path doesn't take that into account so imports of them fail. This isn't a new issue it seems and has probably been around for almost forever but, as far as I recall, no one has every complained about it so it is probably best to leave well enough alone and not attempt to change this behavior here.

    Reacted by Erlend E. Aasland
  13. ned-deily
    added a commit that references this issue on Feb 21, 2024

    gh-115737: Correct libpython install name for macOS shared library bu…

    074bbec
  14. ned-deily commented on Feb 21, 2024

    @ned-deily
    ned-deily
    on Feb 21, 2024
    Member
    More actions

    Thanks for the report and the followup info. The simplified fix is merged into main for release in 3.13.0a5.

    Reacted by Erlend E. Aasland and native-api
  15. 11 remaining items

  16. freakboy3742
    added a commit that references this issue on Sep 9, 2024

    [3.9] pythongh-115737: Correct libpython install name for macOS share…

    c9aedc0
  17. freakboy3742
    added a commit that references this issue on Oct 9, 2024

    [3.12] pythongh-115737: Correct libpython install name for macOS shar…

    1f18745
  18. freakboy3742
    added 4 commits that reference this issue on Dec 13, 2024

    [3.9] pythongh-115737: Correct libpython install name for macOS share…

    0935df2

    [3.10] pythongh-115737: Correct libpython install name for macOS shar…

    913d4b8

    [3.12] pythongh-115737: Correct libpython install name for macOS shar…

    ea02b69

    [3.11] pythongh-115737: Correct libpython install name for macOS shar…

    fe3ba8e
  19. LukasWoodtli
    added a commit that references this issue on Jan 22, 2025

    pythongh-115737: Correct libpython install name for macOS shared libr…

    738fced
  20. freakboy3742
    added 3 commits that reference this issue on Feb 3, 2026

    [3.10] pythongh-115737: Correct libpython install name for macOS shar…

    f987d67

    [3.11] pythongh-115737: Correct libpython install name for macOS shar…

    520f7c4

    [3.12] pythongh-115737: Correct libpython install name for macOS shar…

    ae5a2bc
  21. freakboy3742
    added 2 commits that reference this issue on Jun 12, 2026

    [3.11] pythongh-115737: Correct libpython install name for macOS shar…

    38e6632

    [3.12] pythongh-115737: Correct libpython install name for macOS shar…

    21787c6
  22. freakboy3742
    added 2 commits that reference this issue on Oct 2, 2026

    [3.12] pythongh-115737: Correct libpython install name for macOS shar…

    a729434

    [3.11] pythongh-115737: Correct libpython install name for macOS shar…

    26eb442
  23. freakboy3742
    added a commit that references this issue on Oct 12, 2026

    [3.12] pythongh-115737: Correct libpython install name for macOS shar…

    70ed906
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-macbuildThe build process and cross-buildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.