Details
- 
    Bug 
- 
    Status: Closed (View Workflow)
- 
    Major 
- 
    Resolution: Fixed
- 
    1.1.10
- 
    Operating System: Fedora 40
 Python version: 3.12.6
 Pip version: 24.2
 GCC version: 14.2.1
- 
        3.12.6
Description
Attempting to build the mariadb-connector-python version 1.1.10 results in a compilation error related to incompatible pointer types in the C extension code. The build process fails when compiling the _mariadb extension, specifically in the mariadb_cursor.c file.
Command:
| pip install ./mariadb-connector-python-1.1.10 | 
Output:
| Processing ./mariadb-connector-python-1.1.10 | 
|   Installing build dependencies ... done | 
|   Getting requirements to build wheel ... done | 
|   Preparing metadata (pyproject.toml) ... done | 
| Collecting packaging (from mariadb==1.1.10) | 
|   Using cached packaging-24.1-py3-none-any.whl.metadata (3.2 kB) | 
| Using cached packaging-24.1-py3-none-any.whl (53 kB) | 
| Building wheels for collected packages: mariadb | 
|   Building wheel for mariadb (pyproject.toml) ... error | 
|   error: subprocess-exited-with-error | 
|    | 
|   × Building wheel for mariadb (pyproject.toml) did not run successfully. | 
|   │ exit code: 1 | 
|   ╰─> [44 lines of output] | 
|       running bdist_wheel | 
|       running build | 
|       running build_py | 
|       creating build/lib.linux-x86_64-cpython-312/mariadb | 
|       copying mariadb/__init__.py -> build/lib.linux-x86_64-cpython-312/mariadb | 
|       copying mariadb/connectionpool.py -> build/lib.linux-x86_64-cpython-312/mariadb | 
|       copying mariadb/connections.py -> build/lib.linux-x86_64-cpython-312/mariadb | 
|       creating build/lib.linux-x86_64-cpython-312/mariadb/constants | 
|       copying mariadb/constants/__init__.py -> build/lib.linux-x86_64-cpython-312/mariadb/constants | 
|       copying mariadb/constants/CAPABILITY.py -> build/lib.linux-x86_64-cpython-312/mariadb/constants | 
|       copying mariadb/constants/CLIENT.py -> build/lib.linux-x86_64-cpython-312/mariadb/constants | 
|       copying mariadb/constants/CURSOR.py -> build/lib.linux-x86_64-cpython-312/mariadb/constants | 
|       copying mariadb/constants/ERR.py -> build/lib.linux-x86_64-cpython-312/mariadb/constants | 
|       copying mariadb/constants/FIELD_FLAG.py -> build/lib.linux-x86_64-cpython-312/mariadb/constants | 
|       copying mariadb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-cpython-312/mariadb/constants | 
|       copying mariadb/constants/EXT_FIELD_TYPE.py -> build/lib.linux-x86_64-cpython-312/mariadb/constants | 
|       copying mariadb/constants/INDICATOR.py -> build/lib.linux-x86_64-cpython-312/mariadb/constants | 
|       copying mariadb/constants/INFO.py -> build/lib.linux-x86_64-cpython-312/mariadb/constants | 
|       copying mariadb/constants/STATUS.py -> build/lib.linux-x86_64-cpython-312/mariadb/constants | 
|       copying mariadb/constants/TPC_STATE.py -> build/lib.linux-x86_64-cpython-312/mariadb/constants | 
|       copying mariadb/cursors.py -> build/lib.linux-x86_64-cpython-312/mariadb | 
|       copying mariadb/dbapi20.py -> build/lib.linux-x86_64-cpython-312/mariadb | 
|       copying mariadb/field.py -> build/lib.linux-x86_64-cpython-312/mariadb | 
|       copying mariadb/release_info.py -> build/lib.linux-x86_64-cpython-312/mariadb | 
|       running build_ext | 
|       building 'mariadb._mariadb' extension | 
|       creating build/temp.linux-x86_64-cpython-312/mariadb | 
|       gcc -fno-strict-overflow -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -fexceptions -fcf-protection -fexceptions -fcf-protection -fexceptions -fcf-protection -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=1 -DPY_MARIADB_PATCH_VERSION=10 -DPY_MARIADB_PRE_RELEASE_SEGMENT=\"None\" -DPY_MARIADB_PRE_RELEASE_NR=\"0\" -DPY_MARIADB_POST_RELEASE_SEGMENT=\"None\" -DPY_MARIADB_POST_RELEASE_NR=\"0\" -I/usr/include/mysql -I/usr/include/mysql/mysql -I./include -I/home/rsiddhu/dev/django/.env/include -I/usr/include/python3.12 -c mariadb/mariadb.c -o build/temp.linux-x86_64-cpython-312/mariadb/mariadb.o -DDEFAULT_PLUGINS_SUBDIR=\"/usr/lib64/mariadb/plugin\" | 
|       gcc -fno-strict-overflow -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -fexceptions -fcf-protection -fexceptions -fcf-protection -fexceptions -fcf-protection -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=1 -DPY_MARIADB_PATCH_VERSION=10 -DPY_MARIADB_PRE_RELEASE_SEGMENT=\"None\" -DPY_MARIADB_PRE_RELEASE_NR=\"0\" -DPY_MARIADB_POST_RELEASE_SEGMENT=\"None\" -DPY_MARIADB_POST_RELEASE_NR=\"0\" -I/usr/include/mysql -I/usr/include/mysql/mysql -I./include -I/home/rsiddhu/dev/django/.env/include -I/usr/include/python3.12 -c mariadb/mariadb_codecs.c -o build/temp.linux-x86_64-cpython-312/mariadb/mariadb_codecs.o -DDEFAULT_PLUGINS_SUBDIR=\"/usr/lib64/mariadb/plugin\" | 
|       gcc -fno-strict-overflow -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -fexceptions -fcf-protection -fexceptions -fcf-protection -fexceptions -fcf-protection -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=1 -DPY_MARIADB_PATCH_VERSION=10 -DPY_MARIADB_PRE_RELEASE_SEGMENT=\"None\" -DPY_MARIADB_PRE_RELEASE_NR=\"0\" -DPY_MARIADB_POST_RELEASE_SEGMENT=\"None\" -DPY_MARIADB_POST_RELEASE_NR=\"0\" -I/usr/include/mysql -I/usr/include/mysql/mysql -I./include -I/home/rsiddhu/dev/django/.env/include -I/usr/include/python3.12 -c mariadb/mariadb_connection.c -o build/temp.linux-x86_64-cpython-312/mariadb/mariadb_connection.o -DDEFAULT_PLUGINS_SUBDIR=\"/usr/lib64/mariadb/plugin\" | 
|       gcc -fno-strict-overflow -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -fexceptions -fcf-protection -fexceptions -fcf-protection -fexceptions -fcf-protection -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=1 -DPY_MARIADB_PATCH_VERSION=10 -DPY_MARIADB_PRE_RELEASE_SEGMENT=\"None\" -DPY_MARIADB_PRE_RELEASE_NR=\"0\" -DPY_MARIADB_POST_RELEASE_SEGMENT=\"None\" -DPY_MARIADB_POST_RELEASE_NR=\"0\" -I/usr/include/mysql -I/usr/include/mysql/mysql -I./include -I/home/rsiddhu/dev/django/.env/include -I/usr/include/python3.12 -c mariadb/mariadb_cursor.c -o build/temp.linux-x86_64-cpython-312/mariadb/mariadb_cursor.o -DDEFAULT_PLUGINS_SUBDIR=\"/usr/lib64/mariadb/plugin\" | 
|       mariadb/mariadb_cursor.c: In function 'MrdbCursor_execute_text': | 
|       mariadb/mariadb_cursor.c:1138:39: error: passing argument 2 of 'PyBytes_AsStringAndSize' from incompatible pointer type [-Wincompatible-pointer-types] | 
|        1138 |         PyBytes_AsStringAndSize(stmt, &statement, (Py_ssize_t *)&statement_len); | 
|             |                                       ^~~~~~~~~~ | 
|             |                                       | | 
|             |                                       const char ** | 
|       In file included from /usr/include/python3.12/Python.h:50, | 
|                        from ./include/mariadb_python.h:21, | 
|                        from mariadb/mariadb_cursor.c:20: | 
|       /usr/include/python3.12/bytesobject.h:56:12: note: expected 'char **' but argument is of type 'const char **' | 
|          56 |     char **s,           /* pointer to buffer variable */ | 
|             |     ~~~~~~~^ | 
|       error: command '/usr/bin/gcc' failed with exit code 1 | 
|       [end of output] | 
|    | 
|   note: This error originates from a subprocess, and is likely not a problem with pip. | 
|   ERROR: Failed building wheel for mariadb | 
| Failed to build mariadb | 
| ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (mariadb)
 | 
Cause: The error indicates a type mismatch in the C extension code where a
| const char ** | 
is being passed to a function that expects a
| char ** | 
. This might be due to stricter type checking in Python 3.12 or changes in the Python C API.
Suggested Fix
Package installed successfully after changing line 1128 of 'mariadb/mariadb_cursor.c' from 
| const char *statement; | 
to
| char *statement; | 
Attachments
Issue Links
- relates to
- 
                    CONPY-294 Failed building wheel for mariadb -         
- Closed
 
-