[Python dist] Explicitly link Core Foundation framework for MacOS (#34395)

Some user reported an issue that symbols from CoreFoundation are missing
when install grpc/grpc-tools inside Conda:
* https://github.com/grpc/grpc/issues/33714
* https://github.com/grpc/grpc/issues/34135

This PR adds the `-framework CoreFoundation` flag so no workarounds are
required from user.


<!--

If you know who should review your pull request, please assign it to
that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the
appropriate
lang label.

-->
pull/34606/head
Xuan Wang 2 years ago committed by GitHub
parent 5d04df43bb
commit eccbc97697
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      setup.py
  2. 5
      tools/distrib/python/grpcio_tools/setup.py

@ -293,6 +293,11 @@ if EXTRA_ENV_LINK_ARGS is None:
if "linux" in sys.platform:
EXTRA_ENV_LINK_ARGS += " -static-libgcc"
# Explicitly link Core Foundation framework for MacOS to ensure no symbol is
# missing when compiled using package managers like Conda.
if "darwin" in sys.platform:
EXTRA_ENV_LINK_ARGS += " -framework CoreFoundation"
EXTRA_COMPILE_ARGS = shlex.split(EXTRA_ENV_COMPILE_ARGS)
EXTRA_LINK_ARGS = shlex.split(EXTRA_ENV_LINK_ARGS)

@ -190,6 +190,11 @@ if EXTRA_ENV_LINK_ARGS is None:
if check_linker_need_libatomic():
EXTRA_ENV_LINK_ARGS += " -latomic"
# Explicitly link Core Foundation framework for MacOS to ensure no symbol is
# missing when compiled using package managers like Conda.
if "darwin" in sys.platform:
EXTRA_ENV_LINK_ARGS += " -framework CoreFoundation"
EXTRA_COMPILE_ARGS = shlex.split(EXTRA_ENV_COMPILE_ARGS)
EXTRA_LINK_ARGS = shlex.split(EXTRA_ENV_LINK_ARGS)

Loading…
Cancel
Save