fix(build): restore complete mixed Rust build matrix

`make all` exercises substantially more than the default zstd binary. It also
builds compression-only and decompression-only archives, older contrib tools
that compile program C shims directly, and the single-file amalgamations. The
Rust migration had changed symbol ownership without updating every one of
those feature and link boundaries.

The first failure came from `fileio_asyncio`: it is always compiled, but its
codec bindings unconditionally referenced both `zstd_compress` and
`zstd_decompress`. A compression-only archive therefore required disabled
decoder modules, and the decompression-only configuration had the symmetric
problem. Gate the concrete codec imports, callback types, helpers, and exports
with their Cargo features. Keep the format probe compilable without the
legacy decoder predicate when decompression is disabled.

Once that boundary compiled, the remaining `make all` paths exposed related
integration gaps. Move the C decompression projection declarations out of the
compression preprocessor block, while leaving destination callback types
shared. Link the Rust CLI helpers archive into zlibWrapper, pzstd, and
largeNbDicts, whose util/time/data-generator C files are now declaration shims
rather than implementations.

The generated single-file C sources also call Rust-owned symbols now. Build
and link an appropriately featured Rust archive in their native smoke tests,
and include the pool configuration shim in the decoder case. The full
amalgamation combines `zstd_lazy.c` and `zstd_opt.c` into one translation unit,
so guard their otherwise translation-unit-local dictionary mode enum against
duplicate definition.

A Rust-backed amalgamation is no longer a standalone Emscripten input. Remove
the obsolete emcc/Docker path and report that limitation explicitly; restoring
the WebAssembly smoke test requires a Rust WebAssembly archive and a defined
cross-language amalgamation contract.

Test Plan:
- `cargo check --manifest-path rust/Cargo.toml --no-default-features --features compression` -- passed
- `cargo check --manifest-path rust/Cargo.toml --no-default-features --features decompression` -- passed
- `sh -n build/single_file_libs/build_decoder_test.sh build/single_file_libs/build_library_test.sh` -- passed
- `make all` -- passed, including native single-file and seekable-format tests
- `git diff --cached --check` -- passed
This commit is contained in:
2026-07-22 06:56:06 +02:00
parent 701cf40471
commit da0e2c8380
9 changed files with 129 additions and 124 deletions
+14 -5
View File
@@ -1387,6 +1387,12 @@ static void FIO_displayMultipleFileSummary(const FIO_ctx_t* fCtx, int summaryKin
summaryKind, &callbacks);
}
typedef int (*FIO_rust_multiple_destination_warning_fn)(void* opaque);
typedef void* (*FIO_rust_multiple_destination_open_fn)(void* opaque);
typedef void (*FIO_rust_multiple_destination_attach_fn)(
void* opaque, void* destination);
typedef int (*FIO_rust_multiple_destination_close_fn)(void* opaque);
#ifndef ZSTD_NOCOMPRESS
/* **********************************************************************
@@ -1478,11 +1484,6 @@ typedef char FIO_rust_compress_multiple_projection_size[
int FIO_rust_compressMultipleFilenames(
const FIO_rust_compress_multiple_projection_t* projection);
typedef int (*FIO_rust_multiple_destination_warning_fn)(void* opaque);
typedef void* (*FIO_rust_multiple_destination_open_fn)(void* opaque);
typedef void (*FIO_rust_multiple_destination_attach_fn)(
void* opaque, void* destination);
typedef int (*FIO_rust_multiple_destination_close_fn)(void* opaque);
typedef struct {
const FIO_rust_compress_multiple_projection_t* files;
FIO_rust_multiple_destination_warning_fn warning;
@@ -1555,6 +1556,10 @@ typedef char FIO_rust_compress_multiple_separate_projection_size[
int FIO_rust_compressMultipleSeparateFilenames(
const FIO_rust_compress_multiple_separate_projection_t* projection);
#endif /* #ifndef ZSTD_NOCOMPRESS */
#ifndef ZSTD_NODECOMPRESS
typedef int (*FIO_rust_decompress_multiple_file_fn)(
void* opaque, const char* outFileName, const char* srcFileName);
typedef struct {
@@ -1738,6 +1743,10 @@ typedef char FIO_rust_decompress_file_projection_size[
int FIO_rust_decompressFilename(
const FIO_rust_decompress_file_projection_t* projection);
#endif /* #ifndef ZSTD_NODECOMPRESS */
#ifndef ZSTD_NOCOMPRESS
enum {
FIO_RUST_ZSTD_OK = 0,
FIO_RUST_ZSTD_COMPRESS_ERROR = 1,