amazon-linux-2023 icon indicating copy to clipboard operation
amazon-linux-2023 copied to clipboard

[Bug] - error when install python package mariadb

Open jinglishi-kara opened this issue 1 year ago • 8 comments

OS: public.ecr.aws/lambda/python:3.12 mariadb package: mariadb105-devel (latest version is not supported) python package: mariadb (i tried 1.0.2 to 1.1.10)

Error:

> Building wheel for mariadb (pyproject.toml) did not run successfully.
> 57.64   │ exit code: 1
> 57.64   ╰─> [34 lines of output]
> 57.64       running bdist_wheel
> 57.64       running build
> 57.64       running build_py
> 57.64       creating build/lib.linux-x86_64-cpython-312/mariadb
> 57.64       copying mariadb/__init__.py -> build/lib.linux-x86_64-cpython-312/mariadb
> 57.64       creating build/lib.linux-x86_64-cpython-312/mariadb/constants
> 57.64       copying mariadb/constants/__init__.py -> build/lib.linux-x86_64-cpython-312/mariadb/constants
> 57.64       copying mariadb/constants/CLIENT.py -> build/lib.linux-x86_64-cpython-312/mariadb/constants
> 57.64       copying mariadb/constants/INDICATOR.py -> build/lib.linux-x86_64-cpython-312/mariadb/constants
> 57.64       copying mariadb/constants/CURSOR.py -> build/lib.linux-x86_64-cpython-312/mariadb/constants
> 57.64       running build_ext
> 57.64       building 'mariadb._mariadb' extension
> 57.64       creating build/temp.linux-x86_64-cpython-312/mariadb
> 57.64       gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=0 -DPY_MARIADB_PATCH_VERSION=2 -I/usr/include/mysql -I/usr/include/mysql/mysql -I./include -I/var/lang/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\"
> 57.64       mariadb/mariadb.c: In function ‘PyInit__mariadb’:
> 57.64       mariadb/mariadb.c:153:35: error: lvalue required as left operand of assignment
> 57.64         153 |     Py_TYPE(&MrdbConnection_Type) = &PyType_Type;
> 57.64             |                                   ^
> 57.64       mariadb/mariadb.c:169:31: error: lvalue required as left operand of assignment
> 57.64         169 |     Py_TYPE(&MrdbCursor_Type) = &PyType_Type;
> 57.64             |                               ^
> 57.64       mariadb/mariadb.c:175:29: error: lvalue required as left operand of assignment
> 57.64         175 |     Py_TYPE(&MrdbPool_Type) = &PyType_Type;
> 57.64             |                             ^
> 57.64       mariadb/mariadb.c:181:34: error: lvalue required as left operand of assignment
> 57.64         181 |     Py_TYPE(&MrdbIndicator_Type) = &PyType_Type;
> 57.64             |                                  ^
> 57.64       mariadb/mariadb.c:187:38: error: lvalue required as left operand of assignment
> 57.64         187 |     Py_TYPE(&Mariadb_Fieldinfo_Type) = &PyType_Type;
> 57.64             |                                      ^
> 57.64       mariadb/mariadb.c:193:38: error: lvalue required as left operand of assignment
> 57.64         193 |     Py_TYPE(&Mariadb_DBAPIType_Type) = &PyType_Type;
> 57.64             |                                      ^
> 57.64       error: command '/usr/bin/gcc' failed with exit code 1
> 57.64       [end of output]
> 57.64   
> 57.64   note: This error originates from a subprocess, and is likely not a problem with pip.
> 57.64   ERROR: Failed building wheel for mariadb
> 57.64 Failed to build mariadb
> 57.73 
> 57.73 [notice] A new release of pip is available: 24.2 -> 24.3.1
> 57.73 [notice] To update, run: pip install --upgrade pip
> 57.73 ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (mariadb)
> ------
> 
>  2 warnings found (use docker --debug to expand):
>  - WorkdirRelativePath: Relative workdir "kara-ai" can have unexpected results if the base image changes (line 13)
>  - JSONArgsRecommended: JSON arguments recommended for CMD to prevent unintended behavior related to OS signals (line 29)
> Dockerfile.aws:17
> --------------------
>   15 |     # Install dependencies from requirements.txt
>   16 |     COPY requirements.txt .
>   17 | >>> RUN pip install --no-cache-dir -r requirements.txt
>   18 |     
>   19 |     # copy environment variables
> --------------------

jinglishi-kara avatar Nov 04 '24 23:11 jinglishi-kara

Amazon Linux doesn't ship this python version (yet) and from what I can tell you are building a wheel we also do not ship.

From a quick google, this looks like a result of https://github.com/boostorg/python/issues/325 which would indicate that this is a bug in that mariadb wheel you are attempting to build that is incompatible with newer pythons ...

ozbenh avatar Nov 05 '24 03:11 ozbenh

@jinglishi-kara in order to build mariadb you need to have mariadb-connector-c-devel installed also. Not sure if you do, since not mentioned.

On Amazon Linux 2023.5.20240903 it builds mariadb-1.0.11 w/out errors:

sample build output

bash-5.2# pip -v install mariadb==1.0.11
Using pip 21.3.1 from /usr/lib/python3.9/site-packages/pip (python 3.9)
Collecting mariadb==1.0.11
  Downloading mariadb-1.0.11.zip (85 kB)
     |████████████████████████████████| 85 kB 1.6 MB/s
  Running command python setup.py egg_info
  running egg_info
  creating /tmp/pip-pip-egg-info-lls79m7k/mariadb.egg-info
  writing /tmp/pip-pip-egg-info-lls79m7k/mariadb.egg-info/PKG-INFO
  writing dependency_links to /tmp/pip-pip-egg-info-lls79m7k/mariadb.egg-info/dependency_links.txt
  writing top-level names to /tmp/pip-pip-egg-info-lls79m7k/mariadb.egg-info/top_level.txt
  writing manifest file '/tmp/pip-pip-egg-info-lls79m7k/mariadb.egg-info/SOURCES.txt'
  reading manifest file '/tmp/pip-pip-egg-info-lls79m7k/mariadb.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no files found matching '*.py' under directory 'test'
  warning: no files found matching 'MANIFEST'
  adding license file 'LICENSE'
  writing manifest file '/tmp/pip-pip-egg-info-lls79m7k/mariadb.egg-info/SOURCES.txt'
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: mariadb
  Running command /usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-rp9ivoww/mariadb_aab099e332484b66b8500fb57af9067b/setup.py'"'"'; __file__='"'"'/tmp/pip-install-rp9ivoww/mariadb_aab099e332484b66b8500fb57af9067b/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-y3vkdbai
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.9
  creating build/lib.linux-x86_64-3.9/mariadb
  copying mariadb/__init__.py -> build/lib.linux-x86_64-3.9/mariadb
  creating build/lib.linux-x86_64-3.9/mariadb/constants
  copying mariadb/constants/__init__.py -> build/lib.linux-x86_64-3.9/mariadb/constants
  copying mariadb/constants/CLIENT.py -> build/lib.linux-x86_64-3.9/mariadb/constants
  copying mariadb/constants/INDICATOR.py -> build/lib.linux-x86_64-3.9/mariadb/constants
  copying mariadb/constants/CURSOR.py -> build/lib.linux-x86_64-3.9/mariadb/constants
  copying mariadb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.9/mariadb/constants
  running build_ext
  building 'mariadb._mariadb' extension
  creating build/temp.linux-x86_64-3.9
  creating build/temp.linux-x86_64-3.9/mariadb
  gcc -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -ftree-vectorize -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -ftree-vectorize -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -ftree-vectorize -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=0 -DPY_MARIADB_PATCH_VERSION=11 -I/usr/include/mysql -I/usr/include/mysql/mysql -I./include -I/usr/include/python3.9 -c mariadb/mariadb.c -o build/temp.linux-x86_64-3.9/mariadb/mariadb.o -DDEFAULT_PLUGINS_SUBDIR="/usr/lib64/mariadb/plugin"
  gcc -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -ftree-vectorize -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -ftree-vectorize -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -ftree-vectorize -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=0 -DPY_MARIADB_PATCH_VERSION=11 -I/usr/include/mysql -I/usr/include/mysql/mysql -I./include -I/usr/include/python3.9 -c mariadb/mariadb_codecs.c -o build/temp.linux-x86_64-3.9/mariadb/mariadb_codecs.o -DDEFAULT_PLUGINS_SUBDIR="/usr/lib64/mariadb/plugin"
  gcc -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -ftree-vectorize -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -ftree-vectorize -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -ftree-vectorize -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=0 -DPY_MARIADB_PATCH_VERSION=11 -I/usr/include/mysql -I/usr/include/mysql/mysql -I./include -I/usr/include/python3.9 -c mariadb/mariadb_connection.c -o build/temp.linux-x86_64-3.9/mariadb/mariadb_connection.o -DDEFAULT_PLUGINS_SUBDIR="/usr/lib64/mariadb/plugin"
  gcc -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -ftree-vectorize -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -ftree-vectorize -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -ftree-vectorize -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=0 -DPY_MARIADB_PATCH_VERSION=11 -I/usr/include/mysql -I/usr/include/mysql/mysql -I./include -I/usr/include/python3.9 -c mariadb/mariadb_cursor.c -o build/temp.linux-x86_64-3.9/mariadb/mariadb_cursor.o -DDEFAULT_PLUGINS_SUBDIR="/usr/lib64/mariadb/plugin"
  gcc -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -ftree-vectorize -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -ftree-vectorize -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -ftree-vectorize -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=0 -DPY_MARIADB_PATCH_VERSION=11 -I/usr/include/mysql -I/usr/include/mysql/mysql -I./include -I/usr/include/python3.9 -c mariadb/mariadb_dbapitype.c -o build/temp.linux-x86_64-3.9/mariadb/mariadb_dbapitype.o -DDEFAULT_PLUGINS_SUBDIR="/usr/lib64/mariadb/plugin"
  gcc -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -ftree-vectorize -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -ftree-vectorize -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -ftree-vectorize -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=0 -DPY_MARIADB_PATCH_VERSION=11 -I/usr/include/mysql -I/usr/include/mysql/mysql -I./include -I/usr/include/python3.9 -c mariadb/mariadb_exception.c -o build/temp.linux-x86_64-3.9/mariadb/mariadb_exception.o -DDEFAULT_PLUGINS_SUBDIR="/usr/lib64/mariadb/plugin"
  gcc -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -ftree-vectorize -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -ftree-vectorize -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -ftree-vectorize -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=0 -DPY_MARIADB_PATCH_VERSION=11 -I/usr/include/mysql -I/usr/include/mysql/mysql -I./include -I/usr/include/python3.9 -c mariadb/mariadb_field.c -o build/temp.linux-x86_64-3.9/mariadb/mariadb_field.o -DDEFAULT_PLUGINS_SUBDIR="/usr/lib64/mariadb/plugin"
  gcc -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -ftree-vectorize -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -ftree-vectorize -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -ftree-vectorize -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=0 -DPY_MARIADB_PATCH_VERSION=11 -I/usr/include/mysql -I/usr/include/mysql/mysql -I./include -I/usr/include/python3.9 -c mariadb/mariadb_indicator.c -o build/temp.linux-x86_64-3.9/mariadb/mariadb_indicator.o -DDEFAULT_PLUGINS_SUBDIR="/usr/lib64/mariadb/plugin"
  gcc -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -ftree-vectorize -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -ftree-vectorize -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -ftree-vectorize -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=0 -DPY_MARIADB_PATCH_VERSION=11 -I/usr/include/mysql -I/usr/include/mysql/mysql -I./include -I/usr/include/python3.9 -c mariadb/mariadb_parser.c -o build/temp.linux-x86_64-3.9/mariadb/mariadb_parser.o -DDEFAULT_PLUGINS_SUBDIR="/usr/lib64/mariadb/plugin"
  gcc -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -ftree-vectorize -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -ftree-vectorize -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -ftree-vectorize -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=0 -DPY_MARIADB_PATCH_VERSION=11 -I/usr/include/mysql -I/usr/include/mysql/mysql -I./include -I/usr/include/python3.9 -c mariadb/mariadb_pooling.c -o build/temp.linux-x86_64-3.9/mariadb/mariadb_pooling.o -DDEFAULT_PLUGINS_SUBDIR="/usr/lib64/mariadb/plugin"
  gcc -shared -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -Wl,--build-id=sha1 -g -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -Wl,--build-id=sha1 -g build/temp.linux-x86_64-3.9/mariadb/mariadb.o build/temp.linux-x86_64-3.9/mariadb/mariadb_codecs.o build/temp.linux-x86_64-3.9/mariadb/mariadb_connection.o build/temp.linux-x86_64-3.9/mariadb/mariadb_cursor.o build/temp.linux-x86_64-3.9/mariadb/mariadb_dbapitype.o build/temp.linux-x86_64-3.9/mariadb/mariadb_exception.o build/temp.linux-x86_64-3.9/mariadb/mariadb_field.o build/temp.linux-x86_64-3.9/mariadb/mariadb_indicator.o build/temp.linux-x86_64-3.9/mariadb/mariadb_parser.o build/temp.linux-x86_64-3.9/mariadb/mariadb_pooling.o -L/usr/lib64/ -L/usr/lib64 -lmariadb -o build/lib.linux-x86_64-3.9/mariadb/_mariadb.cpython-39-x86_64-linux-gnu.so
  /usr/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
    warnings.warn(
  installing to build/bdist.linux-x86_64/wheel
  running install
  running install_lib
  creating build/bdist.linux-x86_64
  creating build/bdist.linux-x86_64/wheel
  creating build/bdist.linux-x86_64/wheel/mariadb
  copying build/lib.linux-x86_64-3.9/mariadb/_mariadb.cpython-39-x86_64-linux-gnu.so -> build/bdist.linux-x86_64/wheel/mariadb
  copying build/lib.linux-x86_64-3.9/mariadb/__init__.py -> build/bdist.linux-x86_64/wheel/mariadb
  creating build/bdist.linux-x86_64/wheel/mariadb/constants
  copying build/lib.linux-x86_64-3.9/mariadb/constants/INDICATOR.py -> build/bdist.linux-x86_64/wheel/mariadb/constants
  copying build/lib.linux-x86_64-3.9/mariadb/constants/CURSOR.py -> build/bdist.linux-x86_64/wheel/mariadb/constants
  copying build/lib.linux-x86_64-3.9/mariadb/constants/CLIENT.py -> build/bdist.linux-x86_64/wheel/mariadb/constants
  copying build/lib.linux-x86_64-3.9/mariadb/constants/__init__.py -> build/bdist.linux-x86_64/wheel/mariadb/constants
  copying build/lib.linux-x86_64-3.9/mariadb/constants/FIELD_TYPE.py -> build/bdist.linux-x86_64/wheel/mariadb/constants
  running install_egg_info
  running egg_info
  writing mariadb.egg-info/PKG-INFO
  writing dependency_links to mariadb.egg-info/dependency_links.txt
  writing top-level names to mariadb.egg-info/top_level.txt
  reading manifest file 'mariadb.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no files found matching '*.py' under directory 'test'
  warning: no files found matching 'MANIFEST'
  adding license file 'LICENSE'
  writing manifest file 'mariadb.egg-info/SOURCES.txt'
  Copying mariadb.egg-info to build/bdist.linux-x86_64/wheel/mariadb-1.0.11-py3.9.egg-info
  running install_scripts
  adding license file "LICENSE" (matched pattern "LICEN[CS]E*")
  creating build/bdist.linux-x86_64/wheel/mariadb-1.0.11.dist-info/WHEEL
  creating '/tmp/pip-wheel-y3vkdbai/mariadb-1.0.11-cp39-cp39-linux_x86_64.whl' and adding 'build/bdist.linux-x86_64/wheel' to it
  adding 'mariadb/__init__.py'
  adding 'mariadb/_mariadb.cpython-39-x86_64-linux-gnu.so'
  adding 'mariadb/constants/CLIENT.py'
  adding 'mariadb/constants/CURSOR.py'
  adding 'mariadb/constants/FIELD_TYPE.py'
  adding 'mariadb/constants/INDICATOR.py'
  adding 'mariadb/constants/__init__.py'
  adding 'mariadb-1.0.11.dist-info/LICENSE'
  adding 'mariadb-1.0.11.dist-info/METADATA'
  adding 'mariadb-1.0.11.dist-info/WHEEL'
  adding 'mariadb-1.0.11.dist-info/top_level.txt'
  adding 'mariadb-1.0.11.dist-info/RECORD'
  removing build/bdist.linux-x86_64/wheel
  Building wheel for mariadb (setup.py) ... done
  Created wheel for mariadb: filename=mariadb-1.0.11-cp39-cp39-linux_x86_64.whl size=212271 sha256=7df3bd2efce40309ff939176b5f34cda5e492480bb323db71364c94b8450fd08
  Stored in directory: /root/.cache/pip/wheels/15/3d/12/8498e8641b5397b17d36dff41f565a8c93c3193f14bd4284fc
Successfully built mariadb
Installing collected packages: mariadb
Successfully installed mariadb-1.0.11

elsaco avatar Nov 05 '24 06:11 elsaco

@jinglishi-kara in order to build mariadb you need to have mariadb-connector-c-devel installed also. Not sure if you do, since not mentioned.

On Amazon Linux 2023.5.20240903 it builds mariadb-1.0.11 w/out errors:

sample build output

Hi elsaco,

thank you for listing the mariadb building outpt with AL and mariadb version.

Actually, I want to create a AWS lambda function with container. I use the latest base image ( public.ecr.aws/lambda/python:3.12). I got the error when i build the image using below dockerfile.

FROM public.ecr.aws/lambda/python:3.12
RUN dnf install mariadb105-devel

RUN pip install mariadb

jinglishi-kara avatar Nov 05 '24 19:11 jinglishi-kara

Amazon Linux doesn't ship this python version (yet) and from what I can tell you are building a wheel we also do not ship.

From a quick google, this looks like a result of boostorg/python#325 which would indicate that this is a bug in that mariadb wheel you are attempting to build that is incompatible with newer pythons ...

AWS docker image public.ecr.aws/lambda/python:3.12 only support mariadb105, for which i cannot find the matching version of mariadb python package.

jinglishi-kara avatar Nov 05 '24 19:11 jinglishi-kara

The issue is with the old mariadb-connector-c-devel package that al2023 provides. Using the latest stable release from https://mariadb.org/connector-c/all-releases/ the pip install mariadb runs w/out errors:

[/var/task]# pip install mariadb
Collecting mariadb
  Downloading mariadb-1.1.10.tar.gz (84 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: packaging in /var/lang/lib/python3.12/site-packages (from mariadb) (24.1)
Building wheels for collected packages: mariadb
  Building wheel for mariadb (pyproject.toml) ... done
  Created wheel for mariadb: filename=mariadb-1.1.10-cp312-cp312-linux_x86_64.whl size=199161 sha256=0e7fef8d2fdbe547b92011ee2f7eb8fb4ff38133af432e863894b55b2cfd3fc0
  Stored in directory: /root/.cache/pip/wheels/49/11/3b/f7c4af9d972d01f5082482d36f58a6fb5fc86a64abb2d247e2
Successfully built mariadb
Installing collected packages: mariadb
Successfully installed mariadb-1.1.10

Just for testing I had to change to entry point to the lambda, build and install mariadb-connector-c-3.3.11-src then run pip install mariadb. The lvalue errors were gone also!

More info:

[/var/task]# mariadb_config --version
10.8.8
[/var/task]# python --version
Python 3.12.7
[/var/task]# pip show mariadb
Name: mariadb
Version: 1.1.10
Summary: Python MariaDB extension
Home-page: https://www.github.com/mariadb-corporation/mariadb-connector-python
Author: Georg Richter
Author-email:
License: LGPL 2.1
Location: /var/lang/lib/python3.12/site-packages
Requires: packaging
Required-by:

It's doable, if the maintainers would upgrade the connector package to a newer version:

MariaDB Connector/Python requires MariaDB Connector/C >= 3.3.1, found version 3.1.13

elsaco avatar Nov 07 '24 05:11 elsaco

Thanks, I'll forward this to the relevant team

ozbenh avatar Nov 08 '24 07:11 ozbenh

Looks like some internal team shuffling caused this to fall through the cracks, sorry about that, poking again

ozbenh avatar Feb 18 '25 22:02 ozbenh

A fixed version is on its way

ozbenh avatar Mar 10 '25 22:03 ozbenh