Skip to content

Commit

Permalink
apacheGH-36329: [C++][CI] Use OpenSSL 3 on macOS (apache#36336)
Browse files Browse the repository at this point in the history
### Rationale for this change

GitHub Actions self-hosted runner for macOS has
/usr/local/include/openssl/ provided by OpenSSL 3 (`openssl@ 3`). Our include paths have `... -isystem /usr/local/include -isystem /usr/local/opt/openssl@ 1.1/include ...`. It means that `/usr/local/include/openssl/...` is used for `#include <openssl/...>`.

If we mix OpenSSL 3 headers and OpenSSL 1.1 libraries, we may get some problems such as a link error.

### What changes are included in this PR?

This uses OpenSSL 3 instead of OpenSSL 1.1 because GitHub Actions self-hosted runner for macOS provides OpenSSL 3 by /usr/local/include/openssl/. Note that `$(brew --prefix openssl@ 3)/include` isn't linked as /usr/local/include/openssl` by default. So I think that Homebrew GitHub Actions self-hosted runner for macOS does it explicitly.

Other solution: Unlinking `/usr/local/include/openssl` by `brew unlink openssl@ 3`. But there is no reason to use OpenSSL 1.1 for us. So this PR doesn't use this solution.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* Closes: apache#36329

Authored-by: Sutou Kouhei <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
  • Loading branch information
kou authored and lriggs committed Jul 21, 2023
1 parent 6093e9d commit 6eb8141
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cpp/Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ brew "grpc"
brew "llvm@14"
brew "lz4"
brew "ninja"
brew "openssl@1.1"
brew "openssl@3"
brew "protobuf"
brew "python"
brew "rapidjson"
Expand Down
22 changes: 11 additions & 11 deletions cpp/cmake_modules/FindOpenSSLAlt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ endif()
if(APPLE AND NOT OPENSSL_ROOT_DIR)
find_program(BREW brew)
if(BREW)
execute_process(COMMAND ${BREW} --prefix "[email protected]"
OUTPUT_VARIABLE OPENSSL11_BREW_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(OPENSSL11_BREW_PREFIX)
set(OPENSSL_ROOT_DIR ${OPENSSL11_BREW_PREFIX})
else()
execute_process(COMMAND ${BREW} --prefix "openssl"
OUTPUT_VARIABLE OPENSSL_BREW_PREFIX
foreach(BREW_OPENSSL_VERSION "" "3" "3.0" "1.1")
set(BREW_OPENSSL_PACKAGE "openssl")
if(BREW_OPENSSL_VERSION)
string(APPEND BREW_OPENSSL_PACKAGE "@${BREW_OPENSSL_VERSION}")
endif()
execute_process(COMMAND ${BREW} --prefix --installed ${BREW_OPENSSL_PACKAGE}
OUTPUT_VARIABLE BREW_OPENSSL_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(OPENSSL_BREW_PREFIX)
set(OPENSSL_ROOT_DIR ${OPENSSL_BREW_PREFIX})
if(BREW_OPENSSL_PREFIX)
set(OPENSSL_ROOT_DIR ${BREW_OPENSSL_PREFIX})
break()
endif()
endif()
endforeach()
endif()
endif()

Expand Down

0 comments on commit 6eb8141

Please sign in to comment.