diff --git a/docker/images/proxysql/deb-compliant/entrypoint/entrypoint.bash b/docker/images/proxysql/deb-compliant/entrypoint/entrypoint.bash index 4d8329e3c..3cde22c0a 100755 --- a/docker/images/proxysql/deb-compliant/entrypoint/entrypoint.bash +++ b/docker/images/proxysql/deb-compliant/entrypoint/entrypoint.bash @@ -41,6 +41,22 @@ else build_target="$PROXYSQL_BUILD_TYPE" fi +# When PROXYSQLGENAI=1 is set, the build recurses into plugins/mysqlx/ +# which dynamically links against the system libprotobuf (3.x). Some of +# the v4.0.0 packaging images were built before plugins/mysqlx existed +# and do not yet ship libprotobuf-dev. Install it on demand here so the +# plugin's pkg-config check at plugins/mysqlx/Makefile:47 succeeds. The +# install is idempotent — apt-get returns 0 if the package is already +# present. Skip silently for v3.x builds where PROXYSQLGENAI is unset +# and the plugin path is not exercised. +if [[ "${PROXYSQLGENAI:-}" == "1" ]]; then + if ! pkg-config --exists protobuf 2>/dev/null; then + echo "==> Installing libprotobuf-dev (required for PROXYSQLGENAI=1 mysqlx plugin build)" + apt-get update -qq + apt-get install -y --no-install-recommends libprotobuf-dev + fi +fi + # clean is expensive, do it before, outside of container #${MAKE} cleanbuild if [[ "${PROXYSQLGENAI:-}" == "1" ]]; then diff --git a/docker/images/proxysql/rhel-compliant/entrypoint/entrypoint.bash b/docker/images/proxysql/rhel-compliant/entrypoint/entrypoint.bash index 88d33e304..a6997070f 100755 --- a/docker/images/proxysql/rhel-compliant/entrypoint/entrypoint.bash +++ b/docker/images/proxysql/rhel-compliant/entrypoint/entrypoint.bash @@ -41,6 +41,25 @@ else build_target="$PROXYSQL_BUILD_TYPE" fi +# See deb-compliant entrypoint for the rationale: PROXYSQLGENAI=1 +# triggers a build of plugins/mysqlx/ which dynamically links against +# the system libprotobuf (3.x). Some of the v4.0.0 packaging images +# were built before plugins/mysqlx existed and do not yet ship +# protobuf-devel. Install it on demand for RHEL-family images. +if [[ "${PROXYSQLGENAI:-}" == "1" ]]; then + if ! pkg-config --exists protobuf 2>/dev/null; then + echo "==> Installing protobuf-devel (required for PROXYSQLGENAI=1 mysqlx plugin build)" + if command -v dnf >/dev/null 2>&1; then + dnf install -y protobuf-devel + elif command -v yum >/dev/null 2>&1; then + yum install -y protobuf-devel + else + echo "ERROR: cannot install protobuf-devel (neither dnf nor yum present)" >&2 + exit 1 + fi + fi +fi + # clean is expensive, do it before, outside of container #${MAKE} cleanbuild if [[ "${PROXYSQLGENAI:-}" == "1" ]]; then diff --git a/docker/images/proxysql/suse-compliant/entrypoint/entrypoint.bash b/docker/images/proxysql/suse-compliant/entrypoint/entrypoint.bash index 2eff69862..1b1e97d1f 100755 --- a/docker/images/proxysql/suse-compliant/entrypoint/entrypoint.bash +++ b/docker/images/proxysql/suse-compliant/entrypoint/entrypoint.bash @@ -41,6 +41,23 @@ else build_target="$PROXYSQL_BUILD_TYPE" fi +# See deb-compliant entrypoint for the rationale: PROXYSQLGENAI=1 +# triggers a build of plugins/mysqlx/ which dynamically links against +# the system libprotobuf (3.x). Some of the v4.0.0 packaging images +# were built before plugins/mysqlx existed and do not yet ship +# protobuf-devel. Install it on demand for SUSE-family images. +if [[ "${PROXYSQLGENAI:-}" == "1" ]]; then + if ! pkg-config --exists protobuf 2>/dev/null; then + echo "==> Installing protobuf-devel (required for PROXYSQLGENAI=1 mysqlx plugin build)" + if command -v zypper >/dev/null 2>&1; then + zypper install -y libprotobuf-c-devel || zypper install -y protobuf-devel + else + echo "ERROR: cannot install protobuf-devel (zypper not present)" >&2 + exit 1 + fi + fi +fi + # clean is expensive, do it before, outside of container #${MAKE} cleanbuild if [[ "${PROXYSQLGENAI:-}" == "1" ]]; then