Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

ImportError: zstd C API versions mismatch; Python bindings were not compiled/linked against expected zstd version (10409 returned by the lib, 10409 hardcoded in zstd headers, 10408 hardcoded in the cext)

オープン
#143 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 10 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
42/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
c, python
領域
backend

調査の方向性

python setup.py build --system-zstd と、示されている import コマンドを使って失敗を再現します。まず、c-ext/backend_c.c、build/zstandard/_cffi.c、zstd/zstdlib.c、およびシステムの zstd ヘッダーにあるバージョンの情報源を比較します。ビルドされた Python バインディングが C API のバージョン不一致なしに正常に import できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

I get the following error when I try to use just-built C extension against system zstd:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/python-zstandard/build/lib.linux-x86_64-3.9/zstandard/__init__.py", line 39, in <module>
    from .backend_c import *  # type: ignore
ImportError: zstd C API versions mismatch; Python bindings were not compiled/linked against expected zstd version (10409 returned by the lib, 10409 hardcoded in zstd headers, 10408 hardcoded in the cext)

This is how I built it:

$ python setup.py build --system-zstd
generating build/zstandard/_cffi.c
regenerated: 'build/zstandard/_cffi.c'
running build
running build_py
creating build/lib.linux-x86_64-3.9
creating build/lib.linux-x86_64-3.9/zstandard
copying zstandard/backend_cffi.py -> build/lib.linux-x86_64-3.9/zstandard
copying zstandard/__init__.py -> build/lib.linux-x86_64-3.9/zstandard
copying zstandard/__init__.pyi -> build/lib.linux-x86_64-3.9/zstandard
copying zstandard/py.typed -> build/lib.linux-x86_64-3.9/zstandard
running build_ext
building 'zstandard.backend_c' extension
creating build/temp.linux-x86_64-3.9
creating build/temp.linux-x86_64-3.9/c-ext
x86_64-pc-linux-gnu-gcc-10.2.0 -pthread -fPIC -Ic-ext -I/usr/include/python3.9 -c c-ext/backend_c.c -o build/temp.linux-x86_64-3.9/c-ext/backend_c.o -DZSTD_MULTITHREAD
x86_64-pc-linux-gnu-gcc-10.2.0 -pthread -shared -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu build/temp.linux-x86_64-3.9/c-ext/backend_c.o -L/usr/lib64 -lzstd -o build/lib.linux-x86_64-3.9/zstandard/backend_c.cpython-39-x86_64-linux-gnu.so
building 'zstandard._cffi' extension
creating build/temp.linux-x86_64-3.9/build
creating build/temp.linux-x86_64-3.9/build/zstandard
creating build/temp.linux-x86_64-3.9/zstd
x86_64-pc-linux-gnu-gcc-10.2.0 -pthread -fPIC -I/tmp/python-zstandard/zstd -I/tmp/python-zstandard/zstd/dictBuilder -I/usr/include/python3.9 -c build/zstandard/_cffi.c -o build/temp.linux-x86_64-3.9/build/zstandard/_cffi.o
x86_64-pc-linux-gnu-gcc-10.2.0 -pthread -fPIC -I/tmp/python-zstandard/zstd -I/tmp/python-zstandard/zstd/dictBuilder -I/usr/include/python3.9 -c zstd/zstdlib.c -o build/temp.linux-x86_64-3.9/zstd/zstdlib.o
x86_64-pc-linux-gnu-gcc-10.2.0 -pthread -shared -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu build/temp.linux-x86_64-3.9/build/zstandard/_cffi.o build/temp.linux-x86_64-3.9/zstd/zstdlib.o -L/usr/lib64 -o build/lib.linux-x86_64-3.9/zstandard/_cffi.cpython-39-x86_64-linux-gnu.so
$ cd build/lib.linux-x86_64-3.9/
$ python -c 'import zstandard.backend_c'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/python-zstandard/build/lib.linux-x86_64-3.9/zstandard/__init__.py", line 39, in <module>
    from .backend_c import *  # type: ignore
ImportError: zstd C API versions mismatch; Python bindings were not compiled/linked against expected zstd version (10409 returned by the lib, 10409 hardcoded in zstd headers, 10408 hardcoded in the cext)

I can reproduce this with git master @ 477776e6019478ca1c0b5777b073afbec70975f5

主要言語
C
スター
642
フォーク
118
平均マージ
9日 3時間
マージ済み PR(30日)
6

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

indygreg/python-zstandard のほかの issue

indygreg/python-zstandard の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。