Skip to content
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

2.7.3: sqlite module does not build on centos 5 and Mac OS X 10.4 #58777

Closed
JoakimSernbrant mannequin opened this issue Apr 13, 2012 · 16 comments
Closed

2.7.3: sqlite module does not build on centos 5 and Mac OS X 10.4 #58777

JoakimSernbrant mannequin opened this issue Apr 13, 2012 · 16 comments
Labels
build The build process and cross-build

Comments

@JoakimSernbrant
Copy link
Mannequin

JoakimSernbrant mannequin commented Apr 13, 2012

BPO 14572
Nosy @malemburg, @ned-deily, @davidmalcolm, @akheron, @msabramo
Files
  • sqlite3_int64.patch: Patch for sqlite3_int64 undeclared build error
  • sqlite3_int64_v2.patch
  • 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 2012-05-20.06:39:48.541>
    created_at = <Date 2012-04-13.22:09:11.126>
    labels = ['build']
    title = '2.7.3: sqlite module does not build on centos 5 and Mac OS X 10.4'
    updated_at = <Date 2013-04-28.11:17:57.056>
    user = 'https://bugs.python.org/JoakimSernbrant'

    bugs.python.org fields:

    activity = <Date 2013-04-28.11:17:57.056>
    actor = 'python-dev'
    assignee = 'none'
    closed = True
    closed_date = <Date 2012-05-20.06:39:48.541>
    closer = 'ned.deily'
    components = ['Build']
    creation = <Date 2012-04-13.22:09:11.126>
    creator = 'Joakim.Sernbrant'
    dependencies = []
    files = ['25634', '25647']
    hgrepos = []
    issue_num = 14572
    keywords = ['patch']
    message_count = 16.0
    messages = ['158238', '159089', '159917', '161076', '161077', '161095', '161172', '161173', '161174', '161184', '161185', '161186', '161194', '161214', '161217', '187975']
    nosy_count = 7.0
    nosy_names = ['lemburg', 'ned.deily', 'dmalcolm', 'python-dev', 'petri.lehtinen', 'Marc.Abramowitz', 'Joakim.Sernbrant']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'compile error'
    url = 'https://bugs.python.org/issue14572'
    versions = ['Python 2.7']

    @JoakimSernbrant
    Copy link
    Mannequin Author

    JoakimSernbrant mannequin commented Apr 13, 2012

    Python-2.7.3/Modules/_sqlite/connection.c: In function ‘_pysqlite_set_result’:
    Python-2.7.3/Modules/_sqlite/connection.c:552: error: ‘sqlite3_int64’ undeclared (first use in this function)

    The centos 5 version of sqlite3 (sqlite-devel-3.3.6-5) does not export the type sqlite3_int64. 2.7.0 did build without problems.

    Newer versions declare both sqlite3_int64 and sqlite_int64: http://www.sqlite.org/c3ref/int64.html

    Patch:

    diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
    index 26678c7..a646513 100644
    --- a/Modules/_sqlite/connection.c
    +++ b/Modules/_sqlite/connection.c
    @@ -549,7 +549,7 @@ void _pysqlite_set_result(sqlite3_context* context, PyObject* py_val)
         } else if (py_val == Py_None) {
             sqlite3_result_null(context);
         } else if (PyInt_Check(py_val)) {
    -        sqlite3_result_int64(context, (sqlite3_int64)PyInt_AsLong(py_val));
    +        sqlite3_result_int64(context, (sqlite_int64)PyInt_AsLong(py_val));
         } else if (PyLong_Check(py_val)) {
             sqlite3_result_int64(context, PyLong_AsLongLong(py_val));
         } else if (PyFloat_Check(py_val)) {
    @@ -580,7 +580,7 @@ PyObject* _pysqlite_build_py_params(sqlite3_context *context, int argc, sqlite3_
         sqlite3_value* cur_value;
         PyObject* cur_py_value;
         const char* val_str;
    -    sqlite3_int64 val_int;
    +    sqlite_int64 val_int;
         Py_ssize_t buflen;
         void* raw_buffer;

    @JoakimSernbrant JoakimSernbrant mannequin added build The build process and cross-build labels Apr 13, 2012
    @msabramo
    Copy link
    Mannequin

    msabramo mannequin commented Apr 23, 2012

    This patch worked for me as well. Thanks, Joakim!

    $ cat /etc/redhat-release 
    CentOS release 5.5 (Final)

    @malemburg
    Copy link
    Member

    Mac OS X 10.4 is also affected and for the same reason. SQLite builds fine for Python 2.5 and 2.6, but not for 2.7.

    @malemburg malemburg changed the title 2.7.3: sqlite module does not build on centos 5 2.7.3: sqlite module does not build on centos 5 and Mac OS X 10.4 May 4, 2012
    @msabramo
    Copy link
    Mannequin

    msabramo mannequin commented May 18, 2012

    Just to make this a tad easier, I put Joakim's patch into a gist:

    [marca@logger01.prod1 Python-2.7.3]$ pwd
    /home/marca/src/Python-2.7.3
    
    [marca@logger01.prod1 Python-2.7.3]$ curl -sk     
    https://raw.github.com/gist/2727063/ | patch -p1
    patching file [Modules/_sqlite/connection.c](https://github.com/python/cpython/blob/main/Modules/_sqlite/connection.c)
    

    I suppose this could be fixed in the Python code with some autoconf stuff, but I'm not too comfortable with autoconf.

    @msabramo
    Copy link
    Mannequin

    msabramo mannequin commented May 18, 2012

    curl -sk https://raw.github.com/gist/2727063/ | patch -p1

    @msabramo
    Copy link
    Mannequin

    msabramo mannequin commented May 19, 2012

    OK, here's a patch for configure.ac which seems to fix this problem -- if folks could review and test it that would be great.

    @ned-deily
    Copy link
    Member

    Thanks for the patch to configure.ac. It appears to work on OS X 10.4 and it should on any other system with an older version of sqlite3 installed. However, I think a better approach is to just change the two problematic references in Modules/_sqlite/connection.c to the older backwards compatible form. The current sqlite3.h file explicitly supports the older type for backward compatibility for exactly this kind of case. If so, why add unnecessary magic to Python's configure? Presumably the sqlite3 project will need to continue to support both definitions indefinitely. Perhaps Petri can chime in here as he made the change to include the new types. Attached is a new patch tested on OS X 10.4 and 10.7.

    @msabramo
    Copy link
    Mannequin

    msabramo mannequin commented May 20, 2012

    My guess would be that the code was switched to use the new typedef because the SQLite docs say they're preferred.

    http://www.sqlite.org/c3ref/int64.html

    Maybe they are planning to deprecate the old typedef at some point?

    @msabramo
    Copy link
    Mannequin

    msabramo mannequin commented May 20, 2012

    Probably either approach will have the exact same effect for the foreseeable
    future, so I don't feel strongly either way. It would be nice to have one of them so folks can have a sqlite3 module without having to search around and apply patches. Big win.

    @akheron
    Copy link
    Member

    akheron commented May 20, 2012

    Changing the code to use sqlite_int64 (Ned's patch) sounds better to me.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented May 20, 2012

    New changeset e31597b3bd15 by Ned Deily in branch '2.7':
    Issue bpo-14572: Prevent build failures with pre-3.5.0 versions of
    http://hg.python.org/cpython/rev/e31597b3bd15

    @ned-deily
    Copy link
    Member

    OK, the patch, as originally suggested by Joakim, is applied for release in 2.7.4. Thanks everyone.

    @akheron
    Copy link
    Member

    akheron commented May 20, 2012

    Isn't 3.2 or 3.3 affected by this?

    @ned-deily
    Copy link
    Member

    Isn't 3.2 or 3.3 affected by this?

    No, since the developer who made the original changes used sqlite3_int64 for 2.7 (789a3ea97083) but chose to hardwire the type to PyLong_AsLongLong for 3.x (e67715b87131). [corrected ids]

    @msabramo
    Copy link
    Mannequin

    msabramo mannequin commented May 20, 2012

    Ned, thanks for applying this patch!

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Apr 28, 2013

    New changeset 44fe1f5b07e3 by Serhiy Storchaka in branch '2.7':
    Issue bpo-17857: Prevent build failures with pre-3.5.0 versions of sqlite3,
    http://hg.python.org/cpython/rev/44fe1f5b07e3

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    build The build process and cross-build
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants