build: Tweak linker flags for zstd

Merged
CO
10mo ago
+109-12

This is because vendored libzstd will cause symbol collisions.
So, we need to conceal the exported symbols from zstd.

Related to https://github.com/fluent/fluent-bit/issues/11068.


Enter [N/A] in the box, if an item is not applicable to your change.

Testing
Before we can approve your change; please submit the following in a comment:

  • Example configuration file for the change
  • Debug log output from testing the change
  • Attached Valgrind output that shows no leaks or memory corruption was found

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

  • Run local packaging test showing all targets (including any new ones) build.
  • Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • Documentation required for this feature

Backporting

  • Backport to latest stable release.

Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

Summary by CodeRabbit

  • Chores
    • Added a build-time toggle to prefer the system zstd library, propagated across multi-stage distro builds and threaded into the build configuration.
    • Ensure zstd development packages are installed where needed and the build honors the chosen preference during packaging.
    • Build system now prefers a found system zstd, falls back to pkg-config, and otherwise builds a bundled zstd with appropriate visibility.

✏️ Tip: You can customize this high-level summary in your review settings.