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
Open
fix: remove WINDOWS_EXPORT_ALL_SYMBOLS to prevent LNK1189 and clean up tracked-but-ignored files#508zzlin237 wants to merge 1 commit into
zzlin237 wants to merge 1 commit into
Conversation
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题: 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++ 示例