Build with System OpenSSL on Mac OS arm64 (#31096)

* fix: grpcio fails to build from source on Apple Silicon mac #(25082)

Boringssl currently does not support macOS arm64, so installation on these platform with default config will undoubtedly fail, that means the env var 'BUILD_WITH_SYSTEM_OPENSSL' must be set to true.

* Use system installation of openssl by default on macOS arm64

* Format code by yapf
pull/31407/head
Amchii 2 years ago committed by GitHub
parent 34b1633944
commit b3d9833166
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      setup.py

@ -133,11 +133,22 @@ BUILD_OVERRIDE_BORING_SSL_ASM_PLATFORM = os.environ.get(
# present, then it will still attempt to use Cython.
BUILD_WITH_CYTHON = _env_bool_value('GRPC_PYTHON_BUILD_WITH_CYTHON', 'False')
# Currently, boringssl does not support macOS arm64, so we try to use the system
# installation of openssl to build gRPC locally by default.
if "darwin" in sys.platform and "arm64" == platform.machine().lower():
sys.stderr.write(
"Boringssl currently does not support macOS arm64, so we'll try to use the system installation "
"of 'openssl' to build by default, make sure you have 'openssl' installed in this case\n"
)
BUILD_WITH_SYSTEM_OPENSSL_DEFAULT_ENV = "True"
else:
BUILD_WITH_SYSTEM_OPENSSL_DEFAULT_ENV = "False"
# Export this variable to use the system installation of openssl. You need to
# have the header files installed (in /usr/include/openssl) and during
# runtime, the shared library must be installed
BUILD_WITH_SYSTEM_OPENSSL = _env_bool_value('GRPC_PYTHON_BUILD_SYSTEM_OPENSSL',
'False')
BUILD_WITH_SYSTEM_OPENSSL = _env_bool_value(
'GRPC_PYTHON_BUILD_SYSTEM_OPENSSL', BUILD_WITH_SYSTEM_OPENSSL_DEFAULT_ENV)
# Export this variable to use the system installation of zlib. You need to
# have the header files installed (in /usr/include/) and during

Loading…
Cancel
Save