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

fix: Fix dual linking of gflags when CMake variable BUILD_SHARED_LIBS is cached #12359

Closed
wants to merge 5 commits into from

Conversation

zhztheplayer
Copy link
Contributor

This fixes #12358.

@facebook-github-bot facebook-github-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 Feb 17, 2025
Copy link

netlify bot commented Feb 17, 2025

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit 4b82b2f
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/67c06eabb3a3180008c65218

@majetideepak
Copy link
Collaborator

I will let @assignUser review this since he was the original author.

Copy link
Collaborator

@assignUser assignUser left a comment

Choose a reason for hiding this comment

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

Thanks for the improvement, a minor comment.

FetchContent_MakeAvailable(gflags)

# Workaround for https://github.com/gflags/gflags/issues/277
if(DEFINED CACHED_BUILD_SHARED_LIBS AND NOT DEFINED CACHE{BUILD_SHARED_LIBS})
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't we want to always reset to the value in CACHED_BUILD_SHARED_LIBS, as that being defined means we changed the original value/unset it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would you mean to remove AND NOT DEFINED CACHE{BUILD_SHARED_LIBS}? It's reasonable to me if so.

I was trying to consider the case that FetchContent_MakeAvailable(gflags) internally caches BUILD_SHARED_LIBS again. But apparently if that happens, we cannot change the cached value without FORCE so it's anyway a no-op even jumping into line 55.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks, yes that's right. We should force it then. Otherwise it could leak into the main build, unlikely but can cause fun to debug issues ^^

@assignUser assignUser added the ready-to-merge PR that have been reviewed and are ready for merging. PRs with this tag notify the Velox Meta oncall label Feb 24, 2025
@assignUser assignUser changed the title fix: Fix dual linking of gflags when CMake variable BUILD_SHARED_LIBS is cached build(cmake): Fix dual linking of gflags when CMake variable BUILD_SHARED_LIBS is cached Feb 24, 2025
@assignUser assignUser changed the title build(cmake): Fix dual linking of gflags when CMake variable BUILD_SHARED_LIBS is cached fix: Fix dual linking of gflags when CMake variable BUILD_SHARED_LIBS is cached Feb 24, 2025
@facebook-github-bot
Copy link
Contributor

@mbasmanova has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@mbasmanova
Copy link
Contributor

@zhztheplayer Got "This diff is either too old, or sits on an old base revision, making it unsafe to land - try rebasing first." Would you rebase?

@zhztheplayer
Copy link
Contributor Author

@zhztheplayer Got "This diff is either too old, or sits on an old base revision, making it unsafe to land - try rebasing first." Would you rebase?

Thanks, rebased.

@facebook-github-bot
Copy link
Contributor

@mbasmanova has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@mbasmanova merged this pull request in a034fe0.

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 ready-to-merge PR that have been reviewed and are ready for merging. PRs with this tag notify the Velox Meta oncall
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash due to dual linking of gflags
5 participants