Skip to content

Commit

Permalink
Attempts to get the macOS arm64 build working
Browse files Browse the repository at this point in the history
  • Loading branch information
mbautin committed Sep 25, 2024
1 parent 5eb7657 commit acddd88
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
7 changes: 7 additions & 0 deletions build_and_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ if [[ $OSTYPE == darwin* ]]; then
else
log "This appears to be a non-Apple Silicon Mac, not checking for Rosetta 2."
fi

if [[ -f /opt/homebrew/bin/bash ]]; then
log "/opt/homebrew/bin/bash exists, checking its architecture:"
file /opt/homebrew/bin/bash
else
log "/opt/homebrew/bin/bash does not exist"
fi
fi

# -------------------------------------------------------------------------------------------------
Expand Down
15 changes: 12 additions & 3 deletions python/build_definitions/openssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
from yugabyte_db_thirdparty.build_definition_helpers import * # noqa


ARM64_HOMEBREW_BASH_PATH = '/opt/homebrew/bin/bash'


def use_arm64_bash_in_script(script_path: str) -> None:
with open(script_path) as script_file:
lines = [line.rstrip() for line in script_file]
Expand All @@ -25,7 +28,7 @@ def use_arm64_bash_in_script(script_path: str) -> None:
return
if not lines[0].startswith('#!') and lines[0].endswith('bash'):
return
lines[0] = '#!/opt/homebrew/bin/bash'
lines[0] = '#!' + ARM64_HOMEBREW_BASH_PATH
with open(script_path, 'w') as output_file:
output_file.write('\n'.join(lines) + '\n')

Expand All @@ -49,9 +52,15 @@ def build(self, builder: BuilderInterface) -> None:
common_configure_options = ['shared', 'no-tests', 'enable-fips']
install_path = os.path.join(
builder.fs_layout.tp_installed_common_dir, "lib")
if is_macos_arm64_build():
use_arm64_bash_in_script('config')
configure_cmd = ['./config'] + common_configure_options
if is_macos_arm64_build():
if os.path.exists(ARM64_HOMEBREW_BASH_PATH):
use_arm64_bash_in_script('config')
else:
log(f"{ARM64_HOMEBREW_BASH_PATH} not found, cannot modify OpenSSL configure script"
" to use it. Using the arch command instead.")
configure_cmd = ['arch', '-arm64'] + configure_cmd

if not is_macos():
configure_cmd += ['-Wl,-rpath=' + install_path]

Expand Down

0 comments on commit acddd88

Please sign in to comment.