Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Abseil on macOS #227

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ jobs:
# ---------------------------------------------------------------------------------------

- name: macos-x86_64
os: macos-11
os: macos-12
docker_image:
build_thirdparty_args:

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -euo pipefail

brew install autoconf automake pkg-config shellcheck
brew install autoconf automake pkg-config shellcheck bazelisk
dirs=( /opt/yb-build/{thirdparty,brew,tmp} )
sudo mkdir -p "${dirs[@]}"
sudo chmod 777 "${dirs[@]}"
Expand Down
21 changes: 18 additions & 3 deletions python/yugabyte_db_thirdparty/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
YB_THIRDPARTY_DIR,
add_path_entry,
shlex_join,
which_executable,
)
from yugabyte_db_thirdparty.file_system_layout import FileSystemLayout
from yugabyte_db_thirdparty import file_system_layout
Expand Down Expand Up @@ -372,8 +373,9 @@ def populate_dependencies(self) -> None:
['libunistring', 'gettext'] if is_macos() else []
) + [
'ncurses',
'abseil',
] + (
[] if is_macos() else ['libkeyutils', 'libverto', 'abseil', 'tcmalloc']
[] if is_macos() else ['libkeyutils', 'libverto', 'tcmalloc']
) + [
'libedit',
'icu4c',
Expand Down Expand Up @@ -793,8 +795,17 @@ def build_with_bazel(
should_clean: bool = True,
targets: List[str] = []) -> None:
log_prefix = self.log_prefix(dep)
bazel_path = which_executable('bazel')
if not bazel_path:
bazel_path = which_executable('bazelisk')
if not bazel_path:
raise IOError("Could not find bazel or bazelisk executable")
log("Using bazelisk wrapper instead of bazel: %s", bazel_path)
bazel_version = subprocess.check_call([bazel_path, '--version'])
log("Bazel version: %s", bazel_version)

if should_clean:
self.log_output(log_prefix, ['bazel', 'clean', '--expunge'])
self.log_output(log_prefix, [bazel_path, 'clean', '--expunge'])

# Need to remove the space after isystem so replacing the space separators with colons
# works properly.
Expand All @@ -803,7 +814,7 @@ def build_with_bazel(
bazel_linkopts = os.environ["LDFLAGS"].replace(" ", ":")

# Build without curses for more readable build output.
build_command = ["bazel", "build", "--curses=no"]
build_command = [bazel_path, "build", "--curses=no"]
if verbose_output:
build_command.append("--subcommands")
build_command += ["--action_env", f"BAZEL_CXXOPTS={bazel_cxxopts}"]
Expand Down Expand Up @@ -860,6 +871,10 @@ def install_bazel_build_output(
self.log_output(log_prefix, ['chmod', '755' if is_shared else '644', src_path])
self.log_output(log_prefix, ['cp', src_path, dest_path])

# Fix library's path referring to itself (LC_ID_DYLIB).
if is_shared and is_macos():
self.log_output(log_prefix, ['install_name_tool', '-id', dest_path, dest_path])

def validate_build_output(self) -> None:
if is_macos():
target_arch = get_target_arch()
Expand Down