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

Compilation of mysqlclient fails on CentOS 7 because of missing constant MYSQL_OPT_SSL_ENFORCE #627

Closed
dwt opened this issue Jun 27, 2023 · 5 comments

Comments

@dwt
Copy link

dwt commented Jun 27, 2023

Describe the bug

Compilation of mysqlclient fails on CentOS 7 because of missing constant MYSQL_OPT_SSL_ENFORCE.

To reproduce

$ export MYSQLCLIENT_LDFLAGS=$(mysql_config --libs)
$ export MYSQLCLIENT_CFLAGS=$(mysql_config --cflags)
$ pip install mysqlclient
Collecting mysqlclient
  Using cached mysqlclient-2.2.0.tar.gz (89 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: mysqlclient
  Building wheel for mysqlclient (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for mysqlclient (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [50 lines of output]
      # Options for building extention module:
        extra_compile_args: ['-I/usr/include/mysql', '-std=c99']
        extra_link_args: ['-L/usr/lib64/mysql', '-lmysqlclient', '-lpthread', '-lz', '-lm', '-ldl', '-lssl', '-lcrypto']
        define_macros: [('version_info', (2, 2, 0, 'final', 0)), ('__version__', '2.2.0')]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-38
      creating build/lib.linux-x86_64-cpython-38/MySQLdb
      copying src/MySQLdb/times.py -> build/lib.linux-x86_64-cpython-38/MySQLdb
      copying src/MySQLdb/converters.py -> build/lib.linux-x86_64-cpython-38/MySQLdb
      copying src/MySQLdb/cursors.py -> build/lib.linux-x86_64-cpython-38/MySQLdb
      copying src/MySQLdb/__init__.py -> build/lib.linux-x86_64-cpython-38/MySQLdb
      copying src/MySQLdb/release.py -> build/lib.linux-x86_64-cpython-38/MySQLdb
      copying src/MySQLdb/_exceptions.py -> build/lib.linux-x86_64-cpython-38/MySQLdb
      copying src/MySQLdb/connections.py -> build/lib.linux-x86_64-cpython-38/MySQLdb
      creating build/lib.linux-x86_64-cpython-38/MySQLdb/constants
      copying src/MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-cpython-38/MySQLdb/constants
      copying src/MySQLdb/constants/ER.py -> build/lib.linux-x86_64-cpython-38/MySQLdb/constants
      copying src/MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-cpython-38/MySQLdb/constants
      copying src/MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-cpython-38/MySQLdb/constants
      copying src/MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-cpython-38/MySQLdb/constants
      copying src/MySQLdb/constants/CR.py -> build/lib.linux-x86_64-cpython-38/MySQLdb/constants
      running egg_info
      writing src/mysqlclient.egg-info/PKG-INFO
      writing dependency_links to src/mysqlclient.egg-info/dependency_links.txt
      writing top-level names to src/mysqlclient.egg-info/top_level.txt
      reading manifest file 'src/mysqlclient.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      adding license file 'LICENSE'
      writing manifest file 'src/mysqlclient.egg-info/SOURCES.txt'
      copying src/MySQLdb/_mysql.c -> build/lib.linux-x86_64-cpython-38/MySQLdb
      running build_ext
      building 'MySQLdb._mysql' extension
      creating build/temp.linux-x86_64-cpython-38
      creating build/temp.linux-x86_64-cpython-38/src
      creating build/temp.linux-x86_64-cpython-38/src/MySQLdb
      gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -I/opt/rh/rh-python38/root/usr/include -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -I/opt/rh/rh-python38/root/usr/include -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC "-Dversion_info=(2, 2, 0, 'final', 0)" -D__version__=2.2.0 -I/home/zope/virtualenv_demo/include -I/opt/rh/rh-python38/root/usr/include/python3.8 -c src/MySQLdb/_mysql.c -o build/temp.linux-x86_64-cpython-38/src/MySQLdb/_mysql.o -I/usr/include/mysql -std=c99
      src/MySQLdb/_mysql.c: In function '_mysql_ConnectionObject_Initialize':
      src/MySQLdb/_mysql.c:536:13: warning: implicit declaration of function 'mysql_optionsv' [-Wimplicit-function-declaration]
                   mysql_optionsv(&(self->connection), MYSQL_OPT_SSL_ENFORCE, (void *)&enforce_tls);
                   ^
      src/MySQLdb/_mysql.c:536:49: error: 'MYSQL_OPT_SSL_ENFORCE' undeclared (first use in this function)
                   mysql_optionsv(&(self->connection), MYSQL_OPT_SSL_ENFORCE, (void *)&enforce_tls);
                                                       ^
      src/MySQLdb/_mysql.c:536:49: note: each undeclared identifier is reported only once for each function it appears in
      /tmp/pip-build-env-39axp3fk/overlay/lib/python3.8/site-packages/setuptools/config/pyprojecttoml.py:66: _BetaConfiguration: Support for `[tool.setuptools]` in `pyproject.toml` is still *beta*.
        config = read_configuration(filepath, True, ignore_option_errors, dist)
      error: command '/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 mysqlclient
Failed to build mysqlclient
ERROR: Could not build wheels for mysqlclient, which is required to install pyproject.toml-based projects

Environment

[root@7102c32a5bc7 /]# yum info mariadb-devel
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile

  • base: ftp.agdsn.de
  • centos-sclo-rh: ftp.agdsn.de
  • centos-sclo-sclo: ftp.agdsn.de
  • extras: ftp.agdsn.de
  • updates: ftp.agdsn.de
    Installed Packages
    Name : mariadb-devel
    Arch : aarch64
    Epoch : 1
    Version : 5.5.68
    Release : 1.el7
    Size : 3.3 M
    Repo : installed
    From repo : base
    Summary : Files for development of MariaDB/MySQL applications
    URL : http://mariadb.org
    License : GPLv2 with exceptions and LGPLv2 and BSD
    Description : MariaDB is a multi-user, multi-threaded SQL database server. This
    : package contains the libraries and header files that are needed for
    : developing MariaDB/MySQL client applications.
    : MariaDB is a community developed branch of MySQL.
    [root@7102c32a5bc7 /]# python --version
    Python 3.8.13
    [root@7102c32a5bc7 /]# cat /etc/release
    CentOS Linux release 7.9.2009 (AltArch)
    Derived from Red Hat Enterprise Linux 7.8 (Source)
    NAME="CentOS Linux"
    VERSION="7 (AltArch)"
    ID="centos"
    ID_LIKE="rhel fedora"
    VERSION_ID="7"
    PRETTY_NAME="CentOS Linux 7 (AltArch)"
    ANSI_COLOR="0;31"
    CPE_NAME="cpe:/o:centos:centos:7:server"
    HOME_URL="https://www.centos.org/"
    BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

CentOS Linux release 7.9.2009 (AltArch)
CentOS Linux release 7.9.2009 (AltArch)
cpe:/o:centos:centos:7:server

How did you install libmysqlclient libraries?

yum install mariadb-devel

What version of mysqlclient do you use?

5.5.68

Docker command to start MySQL server

See https://gist.github.com/dwt/c8faf00644447c4c3da6021fe8b0a2be - reproduction was too long for here

Minimum but complete code to reproduce

not needed

Schema and initial data required to reproduce.

not needed

Commands, and any other step required to reproduce your issue.

not needed

@methane
Copy link
Member

methane commented Jun 27, 2023

What version of mysqlclient do you use?

5.5.68

Too old. Unsupported.

@methane methane closed this as not planned Won't fix, can't repro, duplicate, stale Jun 27, 2023
@dwt
Copy link
Author

dwt commented Jun 27, 2023

Not quite sure what the correct way to handle this problem would be. It seems like the default mariadb version on CentOS 7 is just too old? If so, an error message saying that would be appreciated.

@methane
Copy link
Member

methane commented Jun 27, 2023

You shouldn't claim support for such a old Linux distribution to OSS maintainers.
You should fix your issue yourself, or pay to some company providing tech support for CentOS.
Using RHEL7 is another option.

@dwt
Copy link
Author

dwt commented Jun 27, 2023

@methane I am sorry, did I claim that you need to support that version? I thought I was asking for an environment check for the the installed version of mariadb and erroring out on the install if that version is unsupported.

I would hope that you don't get bug reports that way asking for support because it's clear that the current version of pymysql doesn't and will never support that version.

@methane
Copy link
Member

methane commented Jun 27, 2023

https://endoflife.date/mariadb
MariaDB 5.5 become EOL in 2020.

https://endoflife.date/mysql
MySQL 5.5 extended support become EOL in 2018.

New mysqlclient release supports only supported MySQL/MariaDB.
New mysqlclient microversion (e.g. v2.2.1) may support same to previous microversion (e.g. v2.2.0), but it is not guaranteed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants