Skip to content

CDRIVER-4233 fix implicit decl of arc4random and strlcpy on macOS #910

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

Merged
merged 2 commits into from
Dec 13, 2021

Conversation

kevinAlbs
Copy link
Collaborator

@kevinAlbs kevinAlbs commented Dec 11, 2021

Background

macOS does not define arc4random and strlcpy when _XOPEN_SOURCE=700 is defined.

CDRIVER-4233 includes a further analysis of the root cause.

#895 (comment) includes motivation for applying XOPEN_SOURCE=700.

Summary of changes

  • Apply -D_XOPEN_SOURCE=700 to the CHECK_SYMBOL_EXISTS for strlcpy.
  • Define _DARWIN_C_SOURCE=1 to enable arc4random and strlcpy.

Fixes the link-with-cmake-mac, link-with-pkg-config-mac, link-with-cmake-mac-deprecated, link-with-bson-mac tasks on the ** Release Archive Creator build variant.

Apply -D_XOPEN_SOURCE=700 to CMAKE_REQUIRED_DEFINITIONS to apply to later
CMAKE_SYMBOL_EXISTS checks.
@kevinAlbs kevinAlbs marked this pull request as ready for review December 11, 2021 17:53
Copy link
Contributor

@vector-of-bool vector-of-bool left a comment

Choose a reason for hiding this comment

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

LGTM

@kevinAlbs kevinAlbs merged commit 1523c42 into mongodb:master Dec 13, 2021
@kevinAlbs kevinAlbs deleted the macos.4233 branch December 13, 2021 21:22
@kevinAlbs kevinAlbs restored the macos.4233 branch February 3, 2022 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants