Skip to content

fix: remove WINDOWS_EXPORT_ALL_SYMBOLS to prevent LNK1189 and clean up tracked-but-ignored files#508

Open
zzlin237 wants to merge 1 commit into
alibaba:mainfrom
zzlin237:feat/LNK1189
Open

fix: remove WINDOWS_EXPORT_ALL_SYMBOLS to prevent LNK1189 and clean up tracked-but-ignored files#508
zzlin237 wants to merge 1 commit into
alibaba:mainfrom
zzlin237:feat/LNK1189

Conversation

@zzlin237

@zzlin237 zzlin237 commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

问题: Windows 上构建 DLL 时,启用 WINDOWS_EXPORT_ALL_SYMBOLS ON 会导致 CMake 生成一个 .def 文件,其中枚举了所有 COMDAT 符号。随着代码库规模的增长,符号数量将超过 PE/COFF 格式的 65535 个节区上限,从而触发 LNK1189 错误(超出 65535 个对象的库限制)。
变更内容:移除全部 4 处 WINDOWS_EXPORT_ALL_SYMBOLS 的使用,不再使用dll库(仅仅在example中生效,在python和c端不起作用);将 fts_bench 改为链接静态库 zvec 而非共享库 zvec_shared;新增 BUILD_CPP_EXAMPLES CMake 选项,支持以静态链接方式构建 C++ 示例,无需 DLL;更新 Windows CI 配置,通过 BUILD_CPP_EXAMPLES=ON 构建并运行 C++ 示例

@zzlin237 zzlin237 changed the title Feat/lnk1189 fix: remove WINDOWS_EXPORT_ALL_SYMBOLS to prevent LNK1189 and clean up tracked-but-ignored files Jun 22, 2026
On MSVC, WINDOWS_EXPORT_ALL_SYMBOLS generates a .def file exporting all
symbols. When the codebase grows beyond the PE/COFF 65535 export limit,
the linker fails with LNK1189.

Fix: build zvec_shared/zvec_core_shared/zvec_ailego_shared as STATIC
instead of SHARED on MSVC. The targets still exist so consumers
(fts_bench, C++ examples, subproject integration) link normally.
WINDOWS_EXPORT_ALL_SYMBOLS is silently ignored for static libraries.
Linux/macOS are completely unaffected (still SHARED).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant