fix(compile): _LoadSha1Map 缓存补充只加载当前编译有效 sha1,修 9026a429f5e2d0e0.new_builder undefined symbol
.transpyc_cache 残留旧版 llvmlite/__builder.vp 的 9026a429f5e2d0e0.pyi/ .stub.ll(当前版本是 d9b3d06934cd1898)。_LoadSha1Map 从全局缓存补充 temp 缺失文件时不检查 sha1 有效性,把旧版 .vpi/.stub.ll 也加载进 sig_files/stub_files → 同名类 IRBuilder 按旧 sha1 前缀注册 → new_builder 用 9026a429f5e2d0e0 前缀拼接,链接 undefined symbol。 补充逻辑移到 sha1_map 加载之后,仅补充 sha1_map 中存在的 sha1。
This commit is contained in:
1 parent
401429ccdf
commit
c2b04f5026
1 file changed
+19
-14
@@ -302,20 +302,6 @@ class Phase2Translator:
|
||||
sha1 = fname[:-8]
|
||||
self.stub_files[sha1] = fpath
|
||||
|
||||
# 从全局缓存补充 temp_dir 中缺失的 .vpi / .stub.ll
|
||||
if os.path.isdir(_GLOBAL_CACHE_DIR):
|
||||
for fname in os.listdir(_GLOBAL_CACHE_DIR):
|
||||
if fname.startswith('_'):
|
||||
continue
|
||||
if fname.endswith('.vpi') or fname.endswith('.pyi'):
|
||||
sha1 = fname[:-4]
|
||||
if sha1 not in self.sig_files:
|
||||
self.sig_files[sha1] = os.path.join(_GLOBAL_CACHE_DIR, fname)
|
||||
elif fname.endswith('.stub.ll'):
|
||||
sha1 = fname[:-8]
|
||||
if sha1 not in self.stub_files:
|
||||
self.stub_files[sha1] = os.path.join(_GLOBAL_CACHE_DIR, fname)
|
||||
|
||||
# 从内存存储器读取 SHA1 映射(_sha1_map.txt 仅人类可读,不再作为机器数据源)
|
||||
# 延迟导入避免循环依赖(Config 导入 Phase2Translator)
|
||||
from lib.Projectrans.Config import get_sha1_map_store
|
||||
@@ -331,6 +317,25 @@ class Phase2Translator:
|
||||
for sha1, stub_path in self.stub_files.items():
|
||||
self.sha1_map[sha1] = sha1
|
||||
|
||||
# 从全局缓存补充 temp_dir 中缺失的 .vpi / .stub.ll。
|
||||
# 只补充"当前编译有效"的 sha1(在 sha1_map 中):.transpyc_cache 会残留
|
||||
# 旧版源码的缓存(如旧 __builder.vp 的 9026a429f5e2d0e0.pyi/.stub.ll 与新
|
||||
# d9b3d06934cd1898 共存),不加过滤会把旧版 .vpi/.stub.ll 也加载进
|
||||
# sig_files/stub_files → 同名类(IRBuilder)按旧 sha1 前缀注册 →
|
||||
# ld.lld undefined symbol: 9026a429f5e2d0e0.new_builder。
|
||||
if os.path.isdir(_GLOBAL_CACHE_DIR):
|
||||
for fname in os.listdir(_GLOBAL_CACHE_DIR):
|
||||
if fname.startswith('_'):
|
||||
continue
|
||||
if fname.endswith('.vpi') or fname.endswith('.pyi'):
|
||||
sha1 = fname[:-4]
|
||||
if sha1 in self.sha1_map and sha1 not in self.sig_files:
|
||||
self.sig_files[sha1] = os.path.join(_GLOBAL_CACHE_DIR, fname)
|
||||
elif fname.endswith('.stub.ll'):
|
||||
sha1 = fname[:-8]
|
||||
if sha1 in self.sha1_map and sha1 not in self.stub_files:
|
||||
self.stub_files[sha1] = os.path.join(_GLOBAL_CACHE_DIR, fname)
|
||||
|
||||
def _build_struct_sha1_map(self) -> dict[str, str]:
|
||||
struct_sha1_map = {}
|
||||
valid_sha1_keys = set(self.sha1_map.keys())
|
||||
|
||||
Reference in new issue
Block a user