GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Detect SQLite in configure.ac · Issue #89932 · python/cpython

Detect SQLite in configure.ac #89932

New issue
Copy link
New issue
Copy link
Closed
Closed
Detect SQLite in configure.ac#89932
Copy link
Labels
3.11only security fixesonly security fixesbuildThe build process and cross-buildThe build process and cross-buildtopic-sqlite3type-featureA feature request or enhancementA feature request or enhancement

Description

@erlend-aasland
erlend-aasland
opened on Nov 9, 2021
Issue body actions
BPO 45774
Nosy @tiran, @erlend-aasland
PRs
  • bpo-45774: Autoconfiscate SQLite detection (GH-29507) #29507
  • bpo-45774: Fix SQLite load extension autodetection (GH-29659) #29659
  • bpo-45774: Harden SQLite detection #30016
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2022-04-05.13:56:26.148>
    created_at = <Date 2021-11-09.22:26:46.277>
    labels = ['type-feature', 'build', '3.11']
    title = 'Detect SQLite in configure.ac'
    updated_at = <Date 2022-04-05.13:56:26.148>
    user = 'https://github.com/erlend-aasland'

    bugs.python.org fields:

    activity = <Date 2022-04-05.13:56:26.148>
    actor = 'erlendaasland'
    assignee = 'none'
    closed = True
    closed_date = <Date 2022-04-05.13:56:26.148>
    closer = 'erlendaasland'
    components = ['Build']
    creation = <Date 2021-11-09.22:26:46.277>
    creator = 'erlendaasland'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 45774
    keywords = ['patch']
    message_count = 11.0
    messages = ['406059', '406061', '406066', '406076', '406584', '406585', '406652', '406653', '406655', '408161', '416775']
    nosy_count = 2.0
    nosy_names = ['christian.heimes', 'erlendaasland']
    pr_nums = ['29507', '29659', '30016']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue45774'
    versions = ['Python 3.11']

    Activity

    1. erlend-aasland commented on Nov 9, 2021

      @erlend-aasland
      erlend-aasland
      on Nov 9, 2021
      ContributorAuthor
      More actions

      "Autoconfiscate" SQLite detection. Plan:

      • Detect header/library using AC_CHECK_HEADERS/AC_CHECK_LIB
      • Check required version using AC_COMPILE_IFELSE
      • Use AC_CHECK_LIB to check if sqlite3_load_extension is present, and if the result harmonises with --enable-loadable-sqlite-extensions; bail if not

      Nice side effect: configure will bail if --enable-loadable-sqlite-extensions is used and the target SQLite library was compiled with SQLITE_OMIT_LOAD_EXTENSION, even if we are not on macOS.

    2. erlend-aasland
      added
      3.11only security fixesonly security fixes
      buildThe build process and cross-buildThe build process and cross-build
      on Nov 9, 2021
    3. tiran commented on Nov 9, 2021

      @tiran
      tiran
      on Nov 9, 2021
      Member
      More actions

      Your solution looks very similar to my WIP patch:

      AC_CHECK_HEADERS([sqlite3.h],
      [AC_SEARCH_LIBS([sqlite3_version], [sqlite3])]
      )

      AS_VAR_IF([ac_cv_search_sqlite3_version], [no], [], [
        # found a working sqlite3.h and sqlite3 library
        # ac_cv_search_sqlite3_version != no
        LIBS="$LIBS $ac_cv_search_sqlite3_version"
        
        AC_CACHE_CHECK([for sqlite3 version >= 3.7.15], [ac_cv_lib_sqlite3_supported], [
          AC_LINK_IFELSE([
            AC_LANG_PROGRAM([
              #include <sqlite3.h>
              #if SQLITE_VERSION_NUMBER < 3007015
                #error "sqlite version is too old"
              #endif], []
            )
          ], [ac_cv_lib_sqlite3_supported=yes], [ac_cv_lib_sqlite3_supported=no])
        ])
        
        AC_CACHE_CHECK([for sqlite3_enable_load_extension], [ac_cv_lib_sqlite3_sqlite3_enable_load_extension], [
          AC_LINK_IFELSE(
            [AC_LANG_PROGRAM([#include <sqlite3.h>], [void *x = sqlite3_enable_load_extension])],
            [ac_cv_lib_sqlite3_sqlite3_enable_load_extension=yes],
            [ac_cv_lib_sqlite3_sqlite3_enable_load_extension=no])
        ])
      ])

      LIBS=$LIBS_SAVE

      AS_VAR_IF([ac_cv_lib_sqlite3_supported], [yes],
      [AC_DEFINE([HAVE_LIBSQLITE3], [1], [Define to 1 if you have the `sqlite3' library (-lsqlite3).])]
      )

      AS_VAR_IF([ac_cv_lib_sqlite3_sqlite3_enable_load_extension], [yes],
      [AC_DEFINE([HAVE_SQLITE3_ENABLE_LOAD_EXTENSION], [1],
      [Define to 1 if `sqlite3' library supports sqlite3_enable_load_extension.])]
      )

    4. erlend-aasland commented on Nov 9, 2021

      @erlend-aasland
      erlend-aasland
      on Nov 9, 2021
      ContributorAuthor
      More actions

      Nice. I think I'll steal some of your ideas tomorrow :)

    5. tiran commented on Nov 10, 2021

      @tiran
      tiran
      on Nov 10, 2021
      Member
      More actions

      I saw your message concerning sqlite3 on the FreeBSD buildbot. It's hard to tell why configure on FreeBSD doesn't find sqlite3.h without access to config.log or a shell. Maybe sqlite3 is installed in /usr/local ? configure does not use /usr/local/include and /usr/local/lib by default. setup.py extends the search paths for headers and libraries by non-standard locations.

      A "config.site" file should do the trick:

      $ mkdir -p /usr/local/etc
      $ cat > /usr/local/etc/config.site << EOF
      test -z "$CPPFLAGS" && CPPFLAGS="-I$/usr/local/include"
      test -z "$LDFLAGS" && LDFLAGS="-L/usr/local/lib"
      EOF
    6. tiran commented on Nov 19, 2021

      @tiran
      tiran
      on Nov 19, 2021
      Member
      More actions

      New changeset 29e5874 by Erlend Egeberg Aasland in branch 'main':
      bpo-45774: Autoconfiscate SQLite detection (GH-29507)
      29e5874

    7. erlend-aasland
      closed this as completedon Nov 19, 2021
    8. erlend-aasland
      closed this as completedon Nov 19, 2021
    9. tiran commented on Nov 19, 2021

      @tiran
      tiran
      on Nov 19, 2021
      Member
      More actions

      Awesome work! Thanks to your tireless effort we know have a blue print how to use pkg-config for other librariess.

    10. tiran
      added
      type-featureA feature request or enhancementA feature request or enhancement
      on Nov 19, 2021
    11. erlend-aasland commented on Nov 20, 2021

      @erlend-aasland
      erlend-aasland
      on Nov 20, 2021
      ContributorAuthor
      More actions

      Needs amendment before closing. See #73845.

    12. erlend-aasland
      reopened this on Nov 20, 2021
    13. erlend-aasland
      reopened this on Nov 20, 2021
    14. erlend-aasland commented on Nov 20, 2021

      @erlend-aasland
      erlend-aasland
      on Nov 20, 2021
      ContributorAuthor
      More actions

      Awesome work! Thanks to your tireless effort we know have a blue print how to use pkg-config for other librariess.

      Thank you for reviewing, and thank you for paving the way with all these build system improvements :)

    15. tiran commented on Nov 20, 2021

      @tiran
      tiran
      on Nov 20, 2021
      Member
      More actions

      New changeset 6d430ef by Erlend Egeberg Aasland in branch 'main':
      bpo-45774: Fix SQLite load extension autodetection (GH-29659)
      6d430ef

    16. erlend-aasland
      closed this as completedon Nov 20, 2021
    17. erlend-aasland
      closed this as completedon Nov 20, 2021
    18. erlend-aasland commented on Dec 9, 2021

      @erlend-aasland
      erlend-aasland
      on Dec 9, 2021
      ContributorAuthor
      More actions

      Reopening: the current detection is a little bit weak; many SQLite API's may be disabled at SQLite compile time using SQLITE_OMIT_* defines. We must make sure we've got all vital functions in place before marking the sqlite3 module as present and usable.

      The following API's can be omitted using compile time defines:

      • sqlite3_column_decltype (SQLITE_OMIT_DECLTYPE)
      • sqlite3_complete (SQLITE_OMIT_COMPLETE)
      • sqlite3_enable_shared_cache (SQLITE_OMIT_SHARED_CACHE)
      • sqlite3_progress_handler (SQLITE_OMIT_PROGRESS_CALLBACK)
      • sqlite3_set_authorizer (SQLITE_OMIT_AUTHORIZATION)
      • sqlite3_trace_v2 (SQLITE_OMIT_TRACE)
      • sqlite3_trace (SQLITE_OMIT_TRACE, SQLITE_OMIT_DEPRECATED)

      The following API's _may_ be disabled in the future using SQLITE_OMIT_FLOATING_POINT:

      • sqlite3_bind_double
      • sqlite3_column_double
      • sqlite3_result_double
      • sqlite3_value_double
    19. erlend-aasland
      reopened this on Dec 9, 2021
    20. erlend-aasland
      reopened this on Dec 9, 2021
    21. tiran commented on Apr 5, 2022

      @tiran
      tiran
      on Apr 5, 2022
      Member
      More actions

      New changeset f1606a5 by Erlend Egeberg Aasland in branch 'main':
      bpo-45774: Harden SQLite detection (GH-30016)
      f1606a5

    22. erlend-aasland
      closed this as completedon Apr 5, 2022
    23. erlend-aasland
      closed this as completedon Apr 5, 2022
    24. ezio-melotti
      transferred this issue fromon Apr 10, 2022
    25. erlend-aasland
      added
      topic-sqlite3
      on May 16, 2022
    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

      3.11only security fixesonly security fixesbuildThe build process and cross-buildThe build process and cross-buildtopic-sqlite3type-featureA feature request or enhancementA feature request or enhancement

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions

        You are visitor 01402503 — GeezerVison does not store the pages you look up.
        Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.