Skip to content

Fix build with GCC 14: drop const from vector_of_kll_sketches k_ and d_ - #71

Merged
leerho merged 1 commit into
apache:mainfrom
zeniel:fix-gcc14-const-members
Oct 10, 2026
Merged

leerho merged 1 commit into
apache:mainfrom
zeniel:fix-gcc14-const-members

Conversation

@zeniel

@zeniel zeniel commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

The copy and move assignment operators of vector_of_kll_sketches assign to k_ and d_, which are declared const. GCC 14 rejects this even though the templates are never instantiated:

src/vector_of_kll.cpp:146:6: error: assignment of read-only member 'datasketches::vector_of_kll_sketches<T, C>::k_'
src/vector_of_kll.cpp:147:6: error: assignment of read-only member 'datasketches::vector_of_kll_sketches<T, C>::d_'

As a result, the package cannot be built from source on any toolchain that ships GCC 14. That includes the Debian trixie based python:3.14 images, which is the failure reported in #65. It will probably also affect the Python 3.14 wheel builds proposed in #69. The root cause is the compiler version, not Python 3.14 itself.

This change makes the two members non-const, which keeps both assignment operators well-formed. There is no behaviour change.

I checked it on python:3.14-slim (Python 3.14.7, GCC 14.2.0), on both linux/amd64 and linux/aarch64:

  • The package builds, and the existing test suite passes (37 tests).
  • tdigest_double sketches serialized by this build are byte-identical to those from the official 5.2.0 wheel on Python 3.12, for the same input.
  • Each build deserializes, merges and queries the other's sketches with identical quantiles.

Fixes #65.

The copy and move assignment operators assign to k_ and d_, which are
declared const. GCC 14 rejects this even though the templates are not
instantiated ("assignment of read-only member"), so the package cannot
be built from source on toolchains that ship GCC 14, such as the Debian
trixie based python:3.14 images. Making the members non-const keeps the
assignment operators well-formed without changing behaviour.

@leerho leerho left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • What's broken: the package currently can't be built from source with GCC 14, which is the default compiler on Debian trixie and the python:3.14 Docker images (#65). The Python 5.3.0 release is the one that delivers the CVE fixes, so it should build anywhere.
  • The change is tiny: two members of vector_of_kll_sketches stop being const, and nothing behaves differently.
  • The contributor's description matches GCC 14's stricter checking of templates.

@leerho
leerho merged commit eb811dc into apache:main Oct 10, 2026
3 checks passed
@leerho leerho mentioned this pull request Oct 10, 2026
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

Successfully merging this pull request may close these issues.

Error when building wheel on Python 3.14

2 participants