python-zstandard icon indicating copy to clipboard operation
python-zstandard copied to clipboard

cffi: Support using `--system-zstd`

Open mgorny opened this issue 1 year ago • 6 comments

  1. Refactor make_cffi.py to avoid performing the compilation in global scope, and allow passing parameters
  2. Support --system-zstd with the CFFI backend. This uses the C preprocessor to find the system headers for, well, further preprocessing.

With these changes, I can successfully build the CFFI extension using system zstd library, and have it pass tests. I've also confirmed that it builds fine after removing the zstd directory entirely.

mgorny avatar Jan 24 '25 15:01 mgorny

Sure, will do that now.

mgorny avatar Sep 14 '25 18:09 mgorny

Rebased and updated.

mgorny avatar Sep 14 '25 18:09 mgorny

Hmm, I wonder what's different about zstd on macOS that it fails. Unfortunately, I don't have a macOS system to test.

mgorny avatar Sep 14 '25 19:09 mgorny

Wow - that was a quick rebase!

The macOS failure looks legit. We'll need to figure out a path forward there. And I'm pressed for time today. I was planning to cut a release this weekend to help with 3.14 support. So we'll have to defer this to the next release.

indygreg avatar Sep 14 '25 19:09 indygreg

Yeah, no problem with that. As a last resort, I suppose we could limit system zstd + CFFI to Linux, I guess, and force CFFI with vendored libs elsewhere.

mgorny avatar Sep 14 '25 19:09 mgorny

I went for the next best thing, I think: I've added a separate --system-zstd-cffi switch, so that both variants can switch between system and vendored library separately.

mgorny avatar Sep 16 '25 12:09 mgorny