Skip to content

Unvendor libmpdec sources #115119

Open
Open
@zware

Description

@zware

To facilitate cleaner updates of the externally-maintained libmpdec required by the _decimal module, we should migrate away from the bundled copy in Modules/_decimal/libmpdec and towards an "external" in cpython-source-deps for Windows and --with-system-libmpdec by default elsewhere.

My tentative plan is as follows:

  • In 3.15:
  • In 3.16:
    • Remove --with[out]-system-libmpdec configure options and Modules/_decimal/libmpdec/: gh-115119: Removed bundled copy of the libmpdec #133964
  • Linked PRs

    Activity

    added
    buildThe build process and cross-build
    on Feb 7, 2024
    self-assigned this
    on Feb 7, 2024
    erlend-aasland

    erlend-aasland commented on Feb 7, 2024

    @erlend-aasland
    Contributor

    [...] with a fallback to the bundled copy (maybe with a warning?)

    +1 for an autoconf warning.

    ned-deily

    ned-deily commented on Feb 8, 2024

    @ned-deily
    Member

    Adding an external libmpdec to the macOS installer build shouldn't be a big issue. Assign it to me if you proceed with this.

    erlend-aasland

    erlend-aasland commented on Feb 8, 2024

    @erlend-aasland
    Contributor

    FTR: the source deps repo is now updated.

    added 2 commits that reference this issue on Feb 8, 2024

    pythongh-115119: Switch Windows build to mpdecimal external

    3cfe39b

    pythongh-115119: Switch Windows build to mpdecimal external

    7fc2f57
    erlend-aasland

    erlend-aasland commented on Feb 8, 2024

    @erlend-aasland
    Contributor

    @ned-deily: for build-installer.py, is there more to do than adding a configuration for mpdecimal? I've used the following configure options: ['--disable-cxx', 'MACHINE=universal']

    ned-deily

    ned-deily commented on Feb 8, 2024

    @ned-deily
    Member

    Likely yes, I'll take care of it. Thanks.

    ned-deily

    ned-deily commented on Feb 13, 2024

    @ned-deily
    Member
    No description provided.
    erlend-aasland

    erlend-aasland commented on Feb 13, 2024

    @erlend-aasland
    Contributor

    In a quick test, it appeared that with ./configure --with-system-libmpdec today, pkg-config info for libmpdec was not being used. If so, that should be corrected.

    Last time I checked, libmpdec did not provide pkgconfig files:

    $ ls $(brew --prefix libmpdec)/lib/pkgconfig
    ls: /opt/homebrew/opt/mpdecimal/lib/pkgconfig: No such file or directory
    $ cd mpdecimal-2.5.1; find . | grep pkg
    $
    ned-deily

    ned-deily commented on Feb 13, 2024

    @ned-deily
    Member

    With the current 4.0.0 version, it appears both Homebrew and MacPorts ship them:

    $ pkg-config libmpdec --cflags
    -I/opt/homebrew/Cellar/mpdecimal/4.0.0/include
    $ pkg-config libmpdec --libs
    -L/opt/homebrew/Cellar/mpdecimal/4.0.0/lib -lmpdec -lm
    
    ...
    
    $ pkg-config libmpdec --libs
    -L/opt/macports/lib -lmpdec -lm

    126 remaining items

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

    Metadata

    Metadata

    Assignees

    Labels

    buildThe build process and cross-buildextension-modulesC modules in the Modules dir

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Unvendor `libmpdec` sources · Issue #115119 · python/cpython

      Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

      Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant