Skip to content

Commit 288d864

Browse files
dascodermeta-codesync[bot]
authored andcommitted
Fix weak external symbol leakage (#4758)
Summary: This PR enforces hidden visibility for internal templates for the macOS/Linux builds. By doing so we can eliminate the weak external symbol leakage that causes linker warnings and instability in complex environments like Flask/Conda #2167. Verified that the visibility was changed for constructors and destructors via nm -m command. Pull Request resolved: #4758 Reviewed By: alibeklfc Differential Revision: D90891541 Pulled By: junjieqi fbshipit-source-id: f350c2c63745d2f005138be9eccdcaf9b2d4d0f8
1 parent d05801a commit 288d864

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

faiss/python/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,13 @@ swig_add_library(swigfaiss
114114
SOURCES swigfaiss.swig
115115
)
116116

117+
if(TARGET swigfaiss)
118+
set_target_properties(swigfaiss PROPERTIES
119+
CXX_VISIBILITY_PRESET hidden
120+
VISIBILITY_INLINES_HIDDEN ON
121+
)
122+
endif()
123+
117124
set_property(TARGET swigfaiss PROPERTY SWIG_COMPILE_OPTIONS -doxygen)
118125

119126
set_property(SOURCE swigfaiss_avx2.swig

0 commit comments

Comments
 (0)