File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -266,6 +266,18 @@ if(EXECUTORCH_BUILD_PTHREADPOOL)
266266 executorch_move_interface_include_directories_to_build_time_only(
267267 pthreadpool_interface
268268 )
269+
270+ if (APPLE )
271+ # Use hidden visibility for pthreadpool on Apple platforms to avoid issues
272+ # with pthreadpool symbols from libtorch_cpu taking precedence over the ones
273+ # from the pthreadpool library statically linked in _portable_lib. The
274+ # pthreadpool public APIs are marked as weak by default on some Apple
275+ # platforms, so setting to hidden visibility works around this by not
276+ # putting the symbol in the indirection table. See
277+ # https://github.com/pytorch/executorch/issues/14321 for more details.
278+ target_compile_options (pthreadpool PRIVATE -fvisibility=hidden)
279+ endif ()
280+
269281 install (
270282 TARGETS pthreadpool pthreadpool_interface fxdiv
271283 EXPORT ExecuTorchTargets
You can’t perform that action at this time.
0 commit comments