Skip to content
This repository has been archived by the owner on Jan 15, 2025. It is now read-only.

(PA-6387) Enable curl 8 #843

Merged
merged 4 commits into from
May 10, 2024

Conversation

joshcooper
Copy link
Contributor

@joshcooper joshcooper commented May 7, 2024

  • Re-revert curl 8
  • Run brew unlink openssl libyaml so they don't conflict with our runtime components
  • Drop yaml-cpp as a build requirement on macOS
  • Add developer notes about macOS
  • built 7632092
  • macOS 11 Intel token-sargent
  • macOS 12 ARM pix-arm64-macos12-6
  • macOS 12 Intel strange-tooth
  • macOS 13 ARM pix-arm64-macos13-1
  • macOS 13 Intel dismal-mutton
  • macOS 14 ARM pix-arm64-macos14-3
  • macOS 14 Intel freer-python

There is an issue with ffi and nokogiri on macOS 12 ARM unrelated to this PR: #846

joshcooper added 4 commits May 5, 2024 22:56
…evert-816-curl8"

This reverts commit 45ab2a8, reversing
changes made to f9068e6.
Previously, curl 8 on macOS 11 & 12 ARM failed to run:

   # /opt/puppetlabs/puppet/bin/curl --version
   dyld[3871]: symbol not found in flat namespace (_SSL_get0_group_name)

This occurred because we cross-compiled curl (and other components) using
headers from homebrew's openssl 3.3.0. But at runtime, we loaded the
libssl.dylib shared library that we built from openssl 3.0.13. Due to the
version mismatch between headers and libraries, curl tried to call the
SSL_get0_group_name function that only exists in openssl 3.2 and up.

This commit removes the homebrew symlinks for openssl and libyaml so that they
are not visible to our build process.

Some background about why this only affects cross compiled macOS builds. In
order to cross-compile ruby 3.2 on ARM, we have to install ruby 3.2 Intel and
use that as the base ruby, see notes/cross-compiling.md for details.

On macOS, we use homebrew to install build dependencies. Homebrew's [email protected]
package depends on openssl@3[1], which is currently 3.3.0[2]. When homebrew
installs packages, it creates symlinks in the /usr/local directory:

    # ls -l /usr/local/include/openssl
    ... /usr/local/include/openssl -> ../Cellar/openssl@3/3.3.0/include/openssl

On macOS, we compile using clang, which uses the following search path for
headers:

    # gcc -v main.c
    Apple clang version 13.0.0 (clang-1300.0.27.3)
    ...
    #include <...> search starts here:
    /usr/local/include
    /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include
    /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include
    /Library/Developer/CommandLineTools/usr/include
    /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/System/Library/Frameworks (framework directory)
    End of search list.

Since /usr/local/include is the first directory, we are mistakenly compiling
against homebrew's openssl.

However, it wasn't an issue until we bumped to curl 8, because the conditional
calls SSL_get0_group_name doesn't exist in curl 7[3]

[1] https://github.com/Homebrew/homebrew-core/blob/6fd6f60a799501e7c093b695cc830a8708bd1c14/Formula/r/ruby%403.2.rb#L30
[2] https://github.com/Homebrew/homebrew-core/blob/6fd6f60a799501e7c093b695cc830a8708bd1c14/Formula/o/openssl%403.rb#L4
[3] https://github.com/curl/curl/blob/7490d5488e0e7835199285b0568a1c2e0d51b6a9/lib/vtls/openssl.c#L4295-L4296
In May 2018, commit fd8c9e4 added yaml-cpp as a
component to the agent-runtime-master project.

In Oct 2018, commit bc865b3 installed yaml-cpp using
homebrew for agent 5.5.x on macOS 10.12. This means yaml-cpp headers are present
in /usr/local/include and take precedence over our component.

This drops yaml-cpp from brew install, which ensures we're compiling against the
correct yaml-cpp headers in our component.
@joshcooper joshcooper changed the title Enable curl 8 (PA-6387) Enable curl 8 May 7, 2024
@joshcooper joshcooper marked this pull request as ready for review May 8, 2024 16:07
@joshcooper joshcooper requested review from a team as code owners May 8, 2024 16:07
Copy link
Collaborator

@cthorn42 cthorn42 left a comment

Choose a reason for hiding this comment

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

Thank you for those MacOS notes with troubleshooting, it is appreciated!

@cthorn42 cthorn42 merged commit c54c2a6 into puppetlabs-toy-chest:master May 10, 2024
3 checks passed
@joshcooper joshcooper deleted the rerevert-curl branch May 13, 2024 19:24
@joshcooper joshcooper added the enhancement New feature or request label May 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants