Skip to content

checking for stdlib extension module _sqlite3... missing #58

Closed

Description

@solvingj

Ubuntu 18.0.4
uname -m: aarch64
Running in docker on M1 mac

portable-python v1.9.6
building 3.12.3

portable-python.yaml

linux:
  allowed-system-libs: /lib/.*
  cpython-modules: libffi zlib xz bzip2 openssl uuid sqlite3

I just hit this error.

Apparently, since early 3.11.0, it's been impossible to statically link sqlite3 into cpython. The good news it just got fixed and backported. The bad news is the "no patching" guideline of this project makes it hard to fix this for any pre-existing version. Any suggestions for this case?

He's the upstream bug report and fix information:

python/cpython#128321

python/cpython#128322

python/cpython#128355 (backport PR to 3.12 branch)

It references the original introduction of the issue in 3.11.0:

python/cpython#30016

Activity

  1. solvingj commented on Feb 12, 2025

    @solvingj
    Author

    In conjunction with the linked pull request, it's now possible to statically link sqlite3.
    For posterity, here is the relevant configuration needed. Could probably get away with smaller patches but this verified to work.

    For python 3.11.x-3.12.8, and 3.13.0-3.13.1

    cpython-patches:
      #  https://github.com/python/cpython/issues/128321
      #  Until python 3.12.9, LIBSQLITE3_LIBS passed incorrectly in configure
      #  This patch fixes 2 issues:
      #    - Fixes the passing of the variable as per patch in linked issue
      #    - adds -lm to compensate for cpython not --static to pkg-config
      #       and maintainers choosing not to add -lm in linked issue
      #
      - file: configure
        regex: '  LDFLAGS="\$LIBSQLITE3_LIBS \$LDFLAGS"'
        replacement: '  LIBS="$LIBSQLITE3_LIBS $LIBS -lm"'
      - file: configure.ac
        regex: '  LDFLAGS="\$LIBSQLITE3_LIBS \$LDFLAGS"'
        replacement: '  LIBS="$LIBSQLITE3_LIBS $LIBS -lm"'
    

    For python 3.12.9+ and 3.13.2+
    (just needs to add -lm)

    cpython-patches:
      #  https://github.com/python/cpython/issues/128321
      #  Adds -lm to compensate for cpython not --static to pkg-config
      #       and maintainers choosing not to add -lm in linked issue
      #
      - file: configure
        regex: '  LIBS="\$LIBS \$LIBSQLITE3_LIBS"'
        replacement: '  LIBS="$LIBS $LIBSQLITE3_LIBS -lm"'
      - file: configure.ac
        regex: '  LIBS="\$LIBS \$LIBSQLITE3_LIBS"'
        replacement: '  LIBS="$LIBS $LIBSQLITE3_LIBS -lm"'
    
  2. zsimic commented on Feb 14, 2025

    @zsimic
    Contributor

    Release with portable-python v1.9.8

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions