From 536da1a22b8ca5cc1caaade7328404144bf44be6 Mon Sep 17 00:00:00 2001 From: Daniel Moody Date: Thu, 23 Jun 2022 19:50:22 +0000 Subject: SERVER-63616 added check to make sure macos version supports link-model dynamic --- SConstruct | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/SConstruct b/SConstruct index 387397f26d2..4f0981ed9e0 100644 --- a/SConstruct +++ b/SConstruct @@ -6,6 +6,7 @@ import errno import json import os import re +import platform import shlex import shutil import stat @@ -737,6 +738,13 @@ add_option( type='choice', ) +add_option( + 'force-macos-dynamic-link', + default=False, + action='store_true', + help='Bypass link-model=dynamic check for macos versions <12.', +) + try: with open("version.json", "r") as version_fp: version_data = json.load(version_fp) @@ -1858,6 +1866,29 @@ if link_model.startswith('dynamic') and get_option('install-action') == 'symlink f"Options '--link-model={link_model}' not supported with '--install-action={get_option('install-action')}'." ) +if link_model.startswith('dynamic') and env.TargetOSIs( + 'darwin') and not get_option('force-macos-dynamic-link'): + + macos_version_message = textwrap.dedent("""\ + link-model=dynamic us only supported on macos version 12 or higher. + This is due to a 512 dylib limit on older macos. See this post for + more information: https://developer.apple.com/forums//thread/708366?login=true&page=1#717495022 + Use '--force-macos-dynamic-link' to bypass this check. + """) + + try: + macos_version_major = int(platform.mac_ver()[0].split('.')[0]) + if macos_version_major < 12: + env.FatalError( + textwrap.dedent(f"""\ + Macos version detected: {macos_version_major} + """) + macos_version_message) + except (IndexError, TypeError) as exc: + env.FatalError( + textwrap.dedent(f"""\ + Failed to detect macos version: {exc} + """) + macos_version_message) + # libunwind configuration. # In which the following globals are set and normalized to bool: # - use_libunwind -- cgit v1.2.1