Skip to content

cmake: support building with system jerasure and gf-complete - #68258

Merged
tchaikov merged 3 commits into
ceph:mainfrom
tchaikov:wip-with-system-jerasure
May 26, 2026
Merged

tchaikov merged 3 commits into
ceph:mainfrom
tchaikov:wip-with-system-jerasure

Conversation

@tchaikov

@tchaikov tchaikov commented Apr 8, 2026 •

Copy link
Copy Markdown
Contributor

Debian has carried libjerasure-dev and libgf-complete-dev as build-depends for ceph since 2021 (see https://salsa.debian.org/ceph-team/ceph/-/commit/74f71e7757f9), but ceph always builds from its vendored copies because there is no cmake option to use the system ones.

This series first wraps the vendored build into a proper cmake target (Jerasure::jerasure), then adds a WITH_SYSTEM_JERASURE option that provides the same target backed by system libraries.

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

tchaikov added 2 commits April 8, 2026 18:42
…arget

Wrap the vendored jerasure and gf-complete object libraries into a
static library (jerasure_vendored) and expose it via a Jerasure::jerasure
alias target. This prepares for an upcoming WITH_SYSTEM_JERASURE option
that will provide the same target backed by system libraries.

Split jerasure_init.cc (ceph's own galois field initialization glue)
into a separate jerasure_init_objs target, since it is not part of the
jerasure library and must always be built from ceph's source.

Normalize shec's include paths to use bare #include "jerasure.h"
instead of #include "jerasure/include/jerasure.h", consistent with the
jerasure plugin and compatible with both vendored and system headers.

No functional change: ec_jerasure, ec_shec, and their legacy flavor
variants produce identical binaries.

Signed-off-by: Kefu Chai <[email protected]>
…plete

Add a cmake option to build ceph's erasure code plugins (ec_jerasure
and ec_shec) against system-provided jerasure and gf-complete libraries
instead of the vendored copies.

This allows downstream distributions to build with their own packaged
versions of these libraries. For instance, Debian has shipped
libjerasure-dev and libgf-complete-dev as build dependencies for ceph
since 2021, but the build always used the vendored copies because there
was no cmake option to use the system ones.

Using system libraries also lets distributions benefit from any
optimizations or fixes applied to their packages without having to
carry patches against ceph's vendored copies. For example, the vendored
gf-complete requires a downstream -O1 workaround to avoid emitting
SSE 4.1 instructions that crash on older CPUs. But with system libraries,
that becomes the library package's responsibility.

The option is OFF by default, preserving the current behavior of
building from vendored sources.

A new FindJerasure.cmake module locates the system jerasure and
gf-complete headers and libraries, and creates the Jerasure::jerasure
imported target with the same target name that the vendored build now
provides (see previous commit).

Signed-off-by: Kefu Chai <[email protected]>
@tchaikov

tchaikov commented Apr 8, 2026

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@tchaikov

tchaikov commented Apr 8, 2026

Copy link
Copy Markdown
Contributor Author

cc @thomasgoirand

Add libjerasure-dev to Build-Depends and enable WITH_SYSTEM_JERASURE
so that the Debian package builds ec_jerasure and ec_shec plugins
against the distribution-provided libraries instead of the vendored
copies.

libjerasure-dev pulls in libgf-complete-dev, so both libraries are
covered by a single build dependency.

Add libjerasure2 to ceph-base's Depends for the runtime shared
libraries. libjerasure2 in turn depends on libgf-complete1t64.
The explicit dependency is needed because dh_shlibdeps excludes
erasure-code plugins from automatic dependency scanning (they are
loaded via dlopen at runtime).

The distro-packaged jerasure and gf-complete are from the same
upstream git snapshots (2017/04/10) as ceph's vendored copies.
gf-complete source is byte-identical. jerasure differs only in
additional null-pointer checks and error handling in jerasure.c,
plus an extra galois_uninit_field() function that ceph does not use.
All function signatures ceph depends on are present and compatible.

Signed-off-by: Kefu Chai <[email protected]>
@tchaikov

tchaikov commented Apr 9, 2026

Copy link
Copy Markdown
Contributor Author

@tchaikov

tchaikov commented Apr 9, 2026

Copy link
Copy Markdown
Contributor Author

jenkins test windows

@tchaikov
tchaikov requested a review from cbodley April 9, 2026 05:29
@tchaikov

tchaikov commented Apr 9, 2026

Copy link
Copy Markdown
Contributor Author

@cbodley hi Casey, could you help review this change? I came across two downstream patches that both work around issues with the vendored jerasure/gf-complete:

  1. Debian switched to the system-packaged libraries instead of the vendored copies: https://salsa.debian.org/ceph-team/ceph/-/commit/74f71e7757f9
  2. Proxmox works around a gf-complete SSE 4.1 compatibility issue by passing -O1: https://github.com/proxmox/ceph/blob/master/patches/0007-fix-compatibility-with-CPUs-not-supporting-SSE-4.1-i.patch

Adding an option to build against the system libraries would address both. Debian wouldn't need to carry their packaging patch and it would actually use the jerasure and gf-completed shipped by the distro, and Proxmox could drop the compiler flag workaround in favor of a properly maintained library.

@tchaikov

tchaikov commented Apr 9, 2026

Copy link
Copy Markdown
Contributor Author

cc @ThomasLamprecht and @Aequitosh

@NitzanMordhai

Copy link
Copy Markdown
Contributor

@tchaikov
tchaikov merged commit bb3f03d into ceph:main May 26, 2026
6 checks passed
@tchaikov
tchaikov deleted the wip-with-system-jerasure branch May 26, 2026 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants