Skip to content

fix(macos): Install gflags and glog from source instead of Homebrew#16165

Closed
yaooqinn wants to merge 1 commit intofacebookincubator:mainfrom
yaooqinn:fix/macos-glog-gflags-brew
Closed

fix(macos): Install gflags and glog from source instead of Homebrew#16165
yaooqinn wants to merge 1 commit intofacebookincubator:mainfrom
yaooqinn:fix/macos-glog-gflags-brew

Conversation

@yaooqinn
Copy link
Copy Markdown
Contributor

Summary

This PR fixes the macOS build failure caused by Homebrew's glog 0.7.x breaking API changes.

Problem

Homebrew recently upgraded glog to version 0.7.1 which has breaking API changes - the GLOG_EXPORT macro requires CMake target linking which breaks direct header includes. This causes folly compilation to fail with the error:

<glog/logging.h> was not included correctly. See the document in the comment of logging.h for detail.

The root cause is that Velox pins glog to v0.6.0 in setup-versions.sh, but the macOS setup script uses Homebrew which installs the latest incompatible version.

Solution

This change:

  • Removes gflags and glog from MACOS_VELOX_DEPS (Homebrew packages)
  • Adds install_gflags function for macOS (similar to other setup scripts)
  • Installs both gflags (v2.2.2) and glog (v0.6.0) from source using the pinned versions from setup-versions.sh
  • Updates the CI workflow to call install_gflags and install_glog

This approach is consistent with how other Linux setup scripts handle these dependencies.

Testing

This fix has been validated based on feedback from issue #16135 where contributors confirmed that:

  • Uninstalling Homebrew's glog and building from source fixes the issue
  • The pinned v0.6.0 version works correctly

Fixes #16135

Homebrew's glog 0.7.x has breaking API changes that are incompatible
with folly - the GLOG_EXPORT macro requires CMake target linking which
breaks direct header includes.

This change:
- Removes gflags and glog from MACOS_VELOX_DEPS (Homebrew packages)
- Adds install_gflags function for macOS
- Installs both gflags (v2.2.2) and glog (v0.6.0) from source using
  the pinned versions from setup-versions.sh
- Updates the CI workflow to call install_gflags and install_glog

Fixes facebookincubator#16135
@netlify
Copy link
Copy Markdown

netlify Bot commented Jan 29, 2026

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit c4e2b0c
🔍 Latest deploy log https://app.netlify.com/projects/meta-velox/deploys/697b4ec760e22c0008c4e8d1

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 29, 2026
@juwentus1234 juwentus1234 self-requested a review January 29, 2026 18:04
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Jan 29, 2026

@kagamiori has imported this pull request. If you are a Meta employee, you can view this in D91798238.

Comment thread scripts/setup-macos.sh

function install_gflags {
wget_and_untar https://github.com/gflags/gflags/archive/"${GFLAGS_VERSION}".tar.gz gflags
cmake_install_dir gflags -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON -DBUILD_gflags_LIB=ON
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest also setting BUILD_TESTING=OFF

@czentgr
Copy link
Copy Markdown
Collaborator

czentgr commented Jan 29, 2026

Thanks for the quick fix. This explains the CI failures for macOS as well.

Copy link
Copy Markdown
Collaborator

@PingLiuPing PingLiuPing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Jan 29, 2026

@kagamiori merged this pull request in 1979ab8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mac failed with build folly with glog and gflag

6 participants