René's URL Explorer Experiment


Title: Statically linked `sqlite3` fails checks due to missing `-lm` · Issue #128321 · python/cpython · GitHub

Open Graph Title: Statically linked `sqlite3` fails checks due to missing `-lm` · Issue #128321 · python/cpython

X Title: Statically linked `sqlite3` fails checks due to missing `-lm` · Issue #128321 · python/cpython

Description: 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): $ ....

Open Graph Description: 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 S...

X Description: 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 fai...

Opengraph URL: https://github.com/python/cpython/issues/128321

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Statically linked `sqlite3` fails checks due to missing `-lm`","articleBody":"# Bug report\r\n\r\n### Bug description:\r\n\r\nOn Linux, if I build a static version of sqlite3 (e.g., `./configure --disable-shared \u0026\u0026 make` from a sqlite3 tarball)\r\n\r\nYou can see that `./configure` for CPython fails the SQLite checks (added back in https://github.com/python/cpython/pull/30016):\r\n\r\n```\r\n$ ./configure 2\u003e\u00261 | grep sqlite\r\nchecking for sqlite3 \u003e= 3.15.2... yes\r\nchecking for sqlite3.h... yes\r\nchecking for sqlite3_bind_double in -lsqlite3... no\r\nchecking for sqlite3_column_decltype in -lsqlite3... no\r\nchecking for sqlite3_column_double in -lsqlite3... no\r\nchecking for sqlite3_complete in -lsqlite3... no\r\nchecking for sqlite3_progress_handler in -lsqlite3... no\r\nchecking for sqlite3_result_double in -lsqlite3... no\r\nchecking for sqlite3_set_authorizer in -lsqlite3... no\r\nchecking for sqlite3_trace_v2 in -lsqlite3... no\r\nchecking for sqlite3_trace in -lsqlite3... no\r\nchecking for sqlite3_value_double in -lsqlite3... no\r\nchecking for sqlite3_load_extension in -lsqlite3... no\r\nchecking for sqlite3_serialize in -lsqlite3... no\r\nchecking for --enable-loadable-sqlite-extensions... no\r\n```\r\n\r\nAnd in the `config.log` there are a bunch of failures due to undefined references to functions in libm, e.g.:\r\n\r\n```\r\nconfigure:15469: checking for sqlite3_bind_double in -lsqlite3\r\nconfigure:15492: gcc -o conftest   -I/usr/local/include  -I$(srcdir)/Modules/_sqlite -L/usr/local/lib -lsqlite3  -L/usr/local/lib conftest.c -lsqlite3  -L/usr/local/lib -lsqlite3  -ldl  \u003e\u00265\r\n/usr/bin/ld: /usr/local/lib/libsqlite3.a(sqlite3.o): in function `logFunc':\r\n/repo/sqlite-autoconf-3470100/sqlite3.c:131765:(.text+0x26858): undefined reference to `log2'\r\n/usr/bin/ld: /repo/sqlite-autoconf-3470100/sqlite3.c:131768:(.text+0x268d4): undefined reference to `log'\r\n/usr/bin/ld: /repo/sqlite-autoconf-3470100/sqlite3.c:131762:(.text+0x268ec): undefined reference to `log10'\r\n/usr/bin/ld: /repo/sqlite-autoconf-3470100/sqlite3.c:131750:(.text+0x2691c): undefined reference to `log'\r\n```\r\n\r\nCPython is determing SQLite's requirements via `pkg-config` if it can at:\r\n\r\nhttps://github.com/python/cpython/blob/492b224b991cd9027f1bc6d9988d01e94f764992/configure.ac#L4204-L4209\r\n\r\nAnd `-lm` is included in the `pkg-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:\r\n\r\n```\r\n$ pkg-config --static --libs sqlite3 \r\n-L/usr/local/lib -lsqlite3 -lm \r\n$ pkg-config --libs sqlite3             \r\n-L/usr/local/lib -lsqlite3 \r\n```\r\n\r\nHowever, `PKG_CHECK_MODULES` doesn't pass this flag. There's a `PKG_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:\r\n\r\n```\r\nPKG_CONFIG=\"$PKG_CONFIG --static\"\r\n```\r\n\r\nwhich changes all the `PKG_CHECK_MODULES` calls to include the `--static` flag. However, there's a missing export for `LIBS` which prevents this from resolving the issue:\r\n\r\n```\r\n$ git rev-parse HEAD\r\nf9a5a3a3ef34e63dc197156e9a5f57842859ca04\r\n$ export PKG_CONFIG=\"pkg-config --static\"\r\n$ ./configure 2\u003e\u00261 | grep sqlite\r\nchecking for sqlite3 \u003e= 3.15.2... yes\r\nchecking for sqlite3.h... yes\r\nchecking for sqlite3_bind_double in -lsqlite3... no\r\nchecking for sqlite3_column_decltype in -lsqlite3... no\r\nchecking for sqlite3_column_double in -lsqlite3... no\r\nchecking for sqlite3_complete in -lsqlite3... no\r\nchecking for sqlite3_progress_handler in -lsqlite3... no\r\nchecking for sqlite3_result_double in -lsqlite3... no\r\nchecking for sqlite3_set_authorizer in -lsqlite3... no\r\nchecking for sqlite3_trace_v2 in -lsqlite3... no\r\nchecking for sqlite3_trace in -lsqlite3... no\r\nchecking for sqlite3_value_double in -lsqlite3... no\r\nchecking for sqlite3_load_extension in -lsqlite3... no\r\nchecking for sqlite3_serialize in -lsqlite3... no\r\nchecking for --enable-loadable-sqlite-extensions... no\r\nchecking for stdlib extension module _sqlite3... missing\r\n^C\r\n```\r\n\r\nThis is \"solved\" with the patch:\r\n\r\n```diff\r\ndiff --git a/configure.ac b/configure.ac\r\nindex badb19d5589..5ed147f5482 100644\r\n--- a/configure.ac\r\n+++ b/configure.ac\r\n@@ -4221,6 +4221,7 @@ dnl bpo-45774/GH-29507: The CPP check in AC_CHECK_HEADER can fail on FreeBSD,\r\n dnl hence CPPFLAGS instead of CFLAGS.\r\n   CPPFLAGS=\"$CPPFLAGS $LIBSQLITE3_CFLAGS\"\r\n   LDFLAGS=\"$LIBSQLITE3_LIBS $LDFLAGS\"\r\n+  LIBS=\"$LIBSQLITE3_LIBS $LIBS\"\r\n \r\n   AC_CHECK_HEADER([sqlite3.h], [\r\n     have_sqlite3=yes\r\n```\r\n\r\nAs demonstrated by:\r\n\r\n```\r\n$ export PKG_CONFIG=\"pkg-config --static\"\r\n$ ./configure 2\u003e\u00261 | grep sqlite\r\nchecking for sqlite3 \u003e= 3.15.2... yes\r\nchecking for sqlite3.h... yes\r\nchecking for sqlite3_bind_double in -lsqlite3... yes\r\nchecking for sqlite3_column_decltype in -lsqlite3... yes\r\nchecking for sqlite3_column_double in -lsqlite3... yes\r\nchecking for sqlite3_complete in -lsqlite3... yes\r\nchecking for sqlite3_progress_handler in -lsqlite3... yes\r\nchecking for sqlite3_result_double in -lsqlite3... yes\r\nchecking for sqlite3_set_authorizer in -lsqlite3... yes\r\nchecking for sqlite3_trace_v2 in -lsqlite3... yes\r\nchecking for sqlite3_value_double in -lsqlite3... yes\r\nchecking for sqlite3_load_extension in -lsqlite3... yes\r\nchecking for sqlite3_serialize in -lsqlite3... yes\r\nchecking for --enable-loadable-sqlite-extensions... no\r\n```\r\n\r\nFor context, this was reported in https://github.com/astral-sh/python-build-standalone/issues/449 and some of the findings here are repeated there.\r\n\r\nI've posted the patch in https://github.com/python/cpython/pull/128322\r\n\r\n### CPython versions tested on:\r\n\r\nCPython main branch\r\n\r\n### Operating systems tested on:\r\n\r\nLinux\r\n\r\n\u003c!-- gh-linked-prs --\u003e\r\n### Linked PRs\r\n* gh-128322\r\n* gh-128355\n* gh-128356\n\u003c!-- /gh-linked-prs --\u003e\r\n","author":{"url":"https://github.com/zanieb","@type":"Person","name":"zanieb"},"datePublished":"2024-12-29T02:58:22.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/128321/cpython/issues/128321"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:5cd6c077-6ced-8f49-6a65-db810f3da957
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC07C:1B7E6F:1A49C3E:2432F4E:696AA604
html-safe-noncea70d998bceacd17b989fc183e9c1030e50c234960ab202227070a7b17b874780
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMDdDOjFCN0U2RjoxQTQ5QzNFOjI0MzJGNEU6Njk2QUE2MDQiLCJ2aXNpdG9yX2lkIjoiMzgwODc3NzM2MDYzODY0OTg2MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmaca4258d56379b20ebe74c8073bfccba84261993da39c20ce6910a3df1d01079c3
hovercard-subject-tagissue:2762081552
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/128321/issue_layout
twitter:imagehttps://opengraph.githubassets.com/687a62926e8e4e504550c9f7d5c8f37c67bfd0577986a14254e5dfa6ff2bd9a8/python/cpython/issues/128321
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/687a62926e8e4e504550c9f7d5c8f37c67bfd0577986a14254e5dfa6ff2bd9a8/python/cpython/issues/128321
og:image:altBug 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 S...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamezanieb
hostnamegithub.com
expected-hostnamegithub.com
Nonea51f97dbb9326f71c08ecb61577457d543c602124d1a2672871258ef37ac5261
turbo-cache-controlno-preview
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release4bd0eac606c70914085176ef312ebdcd97a8cdf1
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/issues/128321#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F128321
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F128321
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/128321
Reloadhttps://github.com/python/cpython/issues/128321
Reloadhttps://github.com/python/cpython/issues/128321
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/issues/128321
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 33.9k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 71.1k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.1k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects 31 https://github.com/python/cpython/projects
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/python/cpython/security
Please reload this pagehttps://github.com/python/cpython/issues/128321
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/128321
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/128321
#128322https://github.com/python/cpython/pull/128322
Statically linked sqlite3 fails checks due to missing -lmhttps://github.com/python/cpython/issues/128321#top
#128322https://github.com/python/cpython/pull/128322
buildThe build process and cross-buildhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22build%22
topic-sqlite3https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-sqlite3%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com/zanieb
https://github.com/zanieb
zaniebhttps://github.com/zanieb
on Dec 29, 2024https://github.com/python/cpython/issues/128321#issue-2762081552
#30016https://github.com/python/cpython/pull/30016
cpython/configure.achttps://github.com/python/cpython/blob/492b224b991cd9027f1bc6d9988d01e94f764992/configure.ac#L4204-L4209
492b224https://github.com/python/cpython/commit/492b224b991cd9027f1bc6d9988d01e94f764992
astral-sh/python-build-standalone#449https://github.com/astral-sh/python-build-standalone/issues/449
#128322https://github.com/python/cpython/pull/128322
gh-128321: Set LIBS instead of LDFLAGS during sqlite3 library build checks #128322https://github.com/python/cpython/pull/128322
[3.12] gh-128321: Set LIBS instead of LDFLAGS when checking sqlite3 requirements (GH-128322) #128355https://github.com/python/cpython/pull/128355
[3.13] gh-128321: Set LIBS instead of LDFLAGS when checking sqlite3 requirements (GH-128322) #128356https://github.com/python/cpython/pull/128356
buildThe build process and cross-buildhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22build%22
topic-sqlite3https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-sqlite3%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.