Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
solvingj opened this issue Feb 4, 2025 · 2 comments · Fixed by #60
Closed

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

solvingj opened this issue Feb 4, 2025 · 2 comments · Fixed by #60

Comments

@solvingj
Copy link

solvingj commented Feb 4, 2025

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

@solvingj
Copy link
Author

solvingj commented Feb 12, 2025

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

@zsimic
Copy link
Contributor

zsimic commented Feb 14, 2025

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
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants