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

Use vcpkg to build macOS packages #465

Merged
merged 23 commits into from
Dec 30, 2024

Conversation

BewareMyPower
Copy link
Contributor

@BewareMyPower BewareMyPower commented Dec 16, 2024

Fixes #464

The manual build of 3rd party libraries are error-prone. It seems that on x86_64 platform libsnappy.a is a universal binary that cannot be operated with ar. This PR switches to vcpkg for a reliable build for dependencies.

It should be noted that vcpkg enables IPv6 by default when building libcurl, which makes the libcurl.a require the dynamic linking to some macOS frameworks. e.g. you need to add -framework SystemConfiguration -framework CoreFoundation link option, and even -framework CoreServices option for macOS 14 (see curl/curl#11893). This is not user friendly for the downstream libraries like pulsar-client-node.

Therefore, this PR builds macOS libraries via patching vcpkg to disable the IPv6 feature of libcurl for macOS. The upstream does not accept this change, see microsoft/vcpkg#35834.

Two customized triplets files are added:

  • Only build release version dependencies
  • Set the minimum target OS version to 13.0

@BewareMyPower BewareMyPower marked this pull request as draft December 16, 2024 04:30
@BewareMyPower BewareMyPower force-pushed the bewaremypower/fix-macos-build branch from 3de8c36 to 42cd284 Compare December 16, 2024 04:32
@BewareMyPower BewareMyPower force-pushed the bewaremypower/fix-macos-build branch from 69fff36 to b63fb20 Compare December 16, 2024 16:04
@BewareMyPower BewareMyPower force-pushed the bewaremypower/fix-macos-build branch 3 times, most recently from 33313ed to ff0a581 Compare December 17, 2024 11:10
@BewareMyPower BewareMyPower force-pushed the bewaremypower/fix-macos-build branch from ff0a581 to 382c9d9 Compare December 17, 2024 11:12
@BewareMyPower BewareMyPower changed the title (WIP) Test macOS build Use vcpkg to build macOS packages Dec 17, 2024
@BewareMyPower BewareMyPower marked this pull request as ready for review December 17, 2024 13:12
@BewareMyPower BewareMyPower self-assigned this Dec 17, 2024
@BewareMyPower BewareMyPower requested a review from shibd December 17, 2024 13:13
@BewareMyPower BewareMyPower marked this pull request as draft December 17, 2024 13:19
@BewareMyPower BewareMyPower added this to the 3.7.0 milestone Dec 17, 2024
@BewareMyPower BewareMyPower marked this pull request as ready for review December 17, 2024 14:04
vcpkg-osx-json.diff Outdated Show resolved Hide resolved
pkg/mac/build-static-library.sh Outdated Show resolved Hide resolved
@BewareMyPower
Copy link
Contributor Author

@RobertIndie I've updated the approach with patching, PTAL again. In addition, I removed the macOS build workflow with homebrew dependencies because the latest Boost is no longer compatible with the code base, see https://github.com/apache/pulsar-client-cpp/actions/runs/12498761411/job/34872997202

@BewareMyPower BewareMyPower marked this pull request as draft December 27, 2024 03:01
@BewareMyPower BewareMyPower marked this pull request as ready for review December 27, 2024 03:03
@BewareMyPower BewareMyPower merged commit 1e8e4d2 into apache:main Dec 30, 2024
13 checks passed
@BewareMyPower BewareMyPower deleted the bewaremypower/fix-macos-build branch December 30, 2024 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Cannot build macOS x86_64 libraries
2 participants