Uploaded image for project: 'AI Platform Core Components'
  1. AI Platform Core Components
  2. AIPCC-10691

Onboard mysqlclient into the AIPCC Builder

    • Icon: Story Story
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • None
    • None
    • False
    • Hide

      None

      Show
      None
    • False

      Package 'mysqlclient' does not build as-is via the AIPCC self-service pipeline and requires builder repository onboarding.

      Build Failure Summary

      Root Cause Analysis: `mysqlclient` Build Failure

      What Failed

      The build of mysqlclient 2.2.8 failed during the `get_requires_for_build_wheel` phase — before compilation even started. The package's `setup.py` uses `pkg-config` to locate MySQL/MariaDB client libraries, and none of the expected pkg-config packages were found in the build environment.

      Key Error

      mysqlclient: Trying pkg-config --exists mysqlclient
      mysqlclient: Command 'pkg-config --exists mysqlclient' returned non-zero exit status 1.
      mysqlclient: Trying pkg-config --exists mariadb
      mysqlclient: Command 'pkg-config --exists mariadb' returned non-zero exit status 1.
      mysqlclient: Trying pkg-config --exists libmariadb
      mysqlclient: Command 'pkg-config --exists libmariadb' returned non-zero exit status 1.
      mysqlclient: Trying pkg-config --exists perconaserverclient
      mysqlclient: Command 'pkg-config --exists perconaserverclient' returned non-zero exit status 1.
      
      Exception: Can not find valid pkg-config name.
      Specify MYSQLCLIENT_CFLAGS and MYSQLCLIENT_LDFLAGS env vars manually
      

      Why It Failed

      `mysqlclient` is a C extension that wraps the MySQL/MariaDB C client library (`libmysqlclient` or `libmariadb`). It requires the development headers and libraries to be present at build time. The build environment is missing the necessary system package that provides the `.pc` file for `pkg-config` discovery.

      How to Fix

      Install the MySQL or MariaDB client development package in the build environment before building. On RHEL/Fedora-based systems:

      • For MariaDB (typical on RHEL):
        ```bash
        dnf install mariadb-connector-c-devel
        ```
        This provides the `libmariadb.pc` pkg-config file.
      • For MySQL:
        ```bash
        dnf install mysql-devel
        ```

      The `pkg-config` tool itself must also be installed (package `pkgconf-pkg-config` or `pkg-config`), though the log shows `pkg-config` is already running — it just can't find any of the expected `.pc` files.

      Alternative (if system packages cannot be added)

      Set the `MYSQLCLIENT_CFLAGS` and `MYSQLCLIENT_LDFLAGS` environment variables manually to point to the correct include and library paths, as the error message itself suggests. This bypasses the `pkg-config` lookup entirely. For example:

      export MYSQLCLIENT_CFLAGS="-I/usr/include/mysql"
      export MYSQLCLIENT_LDFLAGS="-L/usr/lib64 -lmysqlclient"
      

      However, this still requires the actual C headers and shared library to be present — it only skips the discovery step, not the dependency itself.

      Summary

      Item Detail
      ------ --------
      Package mysqlclient 2.2.8
      Phase `get_requires_for_build_wheel` (pre-build)
      Root cause Missing MySQL/MariaDB client development libraries (no `.pc` file for pkg-config)
      Fix Install `mariadb-connector-c-devel` (or `mysql-devel`) in the build environment

      Packaging Analysis Summary

      Here is the executive summary formatted as a JIRA comment in JIRA wiki markup:

      Executive Summary: mysqlclient Packaging Analysis

      mysqlclient is a moderate complexity C-extension package (4/10) that provides a Python interface to MySQL/MariaDB databases. No pre-built Linux wheels exist on PyPI — only Windows wheels and source distributions are published — so a source build is the only option for Linux targets. The build compiles a single C source file (

      _mysql.c

      , ~3,000 lines) and requires MySQL/MariaDB client development headers and libraries at build time. The package has zero Python runtime dependencies, making dependency management straightforward. The latest release is v2.2.8 (2026-02-10), which requires Python >= 3.10 and setuptools >= 77.

      The primary build requirement is the

      mariadb-connector-c-devel

      RPM package, which provides the necessary C headers and pkg-config

      .pc

      file for automatic library detection. The full set of build-time RPM dependencies is:

      gcc

      ,

      python3-devel

      ,

      mariadb-connector-c-devel

      , and

      pkgconfig

      . At runtime, only

      mariadb-connector-c

      (providing

      libmariadb.so.3

      ) is needed. No critical packaging issues or blockers exist. Fedora already packages this successfully as

      python-mysqlclient

      using the same MariaDB connector approach, confirming build reproducibility on Red Hat platforms. If pkg-config detection fails, the environment variables

      MYSQLCLIENT_CFLAGS

      and

      MYSQLCLIENT_LDFLAGS

      can be set manually as a fallback.

      The license is GPL-2.0-or-later, which is fully compatible with Red Hat distribution. The C source additionally carries a dual BSD-style permissive license, providing extra redistribution flexibility. The C extension is architecture-specific but GPU-agnostic — a single wheel built on x86_64 RHEL will work across all index variants (CPU, CUDA, ROCm) for a given Python version.

      Recommended Build Command

      # RHEL 9 / UBI 9
      dnf install -y gcc python3-devel mariadb-connector-c-devel pkgconfig
      pip wheel mysqlclient==2.2.8 --no-binary mysqlclient
      

      Key Takeaways

      • No blockers — the build is straightforward and well-established on RHEL
      • Single system dependency
        mariadb-connector-c-devel

        (build) /

        mariadb-connector-c

        (runtime)

      • Zero Python dependencies at runtime
      • Fallback alternative:
        PyMySQL

        (pure Python, no compilation) if build constraints arise, though mysqlclient is preferred for performance and Django compatibility

      • Verify that
        mariadb-connector-c-devel

        is available in the target UBI/RHEL build repositories

              cheimes@redhat.com Christian Heimes
              aipcc-jira-bot@redhat.com AIPCC JIRABOT
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: