microsoft / DiskANN

Graph-structured Indices for Scalable, Fast, Fresh and Filtered Approximate Nearest Neighbor Search
Other
1.02k stars 208 forks source link

Fix msvc build error by suppressing warnings in external headers #530

Closed scuzqy closed 2 months ago

scuzqy commented 5 months ago

Environment: Visual Studio Community 2022 17.9.3, cl 19.39.33522 with build error:

2><MySourcePath>\DiskANN\build\packages\intelmkl.static.win-x64\lib\native\include\mkl_spblas.h(1147,1): error C2220: the following warning is treated as an error
2>(compiling source file '../../../src/pq.cpp')
2><MySourcePath>\DiskANN\build\packages\intelmkl.static.win-x64\lib\native\include\mkl_spblas.h(1147,1): warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
2>(compiling source file '../../../src/pq.cpp')
2>disk_utils.cpp
2>filter_utils.cpp
2>ann_exception.cpp
2>natural_number_set.cpp
2>natural_number_map.cpp
2><MySourcePath>\DiskANN\build\packages\intelmkl.static.win-x64\lib\native\include\mkl_spblas.h(1147,1): error C2220: the following warning is treated as an error
2>(compiling source file '../../../src/math_utils.cpp')
2><MySourcePath>\DiskANN\build\packages\intelmkl.static.win-x64\lib\native\include\mkl_spblas.h(1147,1): warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
2>(compiling source file '../../../src/math_utils.cpp')
2>scratch.cpp
2>index_factory.cpp
2>abstract_index.cpp
2><MySourcePath>\DiskANN\build\packages\intelmkl.static.win-x64\lib\native\include\mkl_spblas.h(1147,1): error C2220: the following warning is treated as an error
2>(compiling source file '../../../src/disk_utils.cpp')
2><MySourcePath>\DiskANN\build\packages\intelmkl.static.win-x64\lib\native\include\mkl_spblas.h(1147,1): warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
2>(compiling source file '../../../src/disk_utils.cpp')

cl 19.39.33522 fails to compile. C4819 is repeatedly raised, and is treated as an error when CMAKE_COMPILE_WARNING_AS_ERROR set to ON.

Reference Issues/PRs

What does this implement/fix? Briefly explain your changes.

Mark external includes(intelmkl) with "SYSTEM" flag so to supress warnings from them.

Any other comments?

scuzqy commented 5 months ago

@microsoft-github-policy-service agree