Skip to content

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

Open
zeniel wants to merge 1 commit into
apache:mainfrom
zeniel:fix-gcc14-const-members
Open

zeniel wants to merge 1 commit into
apache:mainfrom
zeniel:fix-gcc14-const-members

Conversation

@zeniel

@zeniel zeniel commented Sep 30, 2026

Copy link
Copy Markdown

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.

This branch has not been deployed

No deployments
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

1 participant