-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
Statically linked sqlite3
fails checks due to missing -lm
#128321
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
Comments
cc @erlend-aasland — I understand you're the expert in this area. |
This will result in over-linking when sqlite3 is used as a shared library (no pkg-config --static). |
Ah true — we could just include it during the checks but it seems like a bit of a pain. |
…ents (#128322) Co-authored-by: Erlend E. Aasland <erlend@python.org>
…quirements (pythonGH-128322) (cherry picked from commit 81376fe) Co-authored-by: Zanie Blue <contact@zanie.dev> Co-authored-by: Erlend E. Aasland <erlend@python.org>
…quirements (pythonGH-128322) (cherry picked from commit 81376fe) Co-authored-by: Zanie Blue <contact@zanie.dev> Co-authored-by: Erlend E. Aasland <erlend@python.org>
…quirements (python#128322) Co-authored-by: Erlend E. Aasland <erlend@python.org>
@zanieb Thank you for finding and fixing this. It's a huge help.
I'm probably missing something, and if so please forgive me. Since |
Typically what happens is people who are interested in a static build export So everything works fine using pkg-config, the question is what to do about the fallback. For a fallback, what you'd typically do is perform a series of compile checks, to see if you can link successfully to sqlite on its own and upon failure check again to see if you can link successfully to sqlite when adding I have no objections to the "series of compile checks". I don't think it's fully appropriate in terms of general theory to simply add it unconditionally though. I'm also fine with only supporting pkg-config at all, for my own personal use, but that's another story. :) |
I see. It seems to me the project is designed to support static/dynamic choices (and all configuration choices for that matter), on a per-dependency basis. I definitely see it being "very common" that people who want "some deps" compiled in statically want "all deps" statically. On the other hand, it's also "not uncommon" for people to want a subset of deps static. Regardless, it doesn't seem appropriate even in principle to have an "all static or nothing static" support story, just because pkgconfig makes the "all static" case easy. So many other configurations and mechanisms in cpython are in place to make it flexible in this way. |
Bug report
Bug description:
On Linux, if I build a static version of sqlite3 (e.g.,
./configure --disable-shared && make
from a sqlite3 tarball)You can see that
./configure
for CPython fails the SQLite checks (added back in #30016):And in the
config.log
there are a bunch of failures due to undefined references to functions in libm, e.g.:CPython is determing SQLite's requirements via
pkg-config
if it can at:cpython/configure.ac
Lines 4204 to 4209 in 492b224
And
-lm
is included in thepkg-config
for the static sqlite3 build, but it's in the private libs and requires the--static
flag to be included in the--libs
output:However,
PKG_CHECK_MODULES
doesn't pass this flag. There's aPKG_CHECK_MODULES_STATIC
macro which does, but CPython doesn't seem to use this yet. The alternative is set the flag manually at configure time:which changes all the
PKG_CHECK_MODULES
calls to include the--static
flag. However, there's a missing export forLIBS
which prevents this from resolving the issue:This is "solved" with the patch:
As demonstrated by:
For context, this was reported in astral-sh/python-build-standalone#449 and some of the findings here are repeated there.
I've posted the patch in #128322
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
LIBS
instead ofLDFLAGS
during sqlite3 library build checks #128322The text was updated successfully, but these errors were encountered: