Skip to content

fix(setup): resolve openssl@3 prefix via brew so setup.sh works on Intel Macs - #379

Merged
tilakpatel22 merged 1 commit into
Fincept-Corporation:mainfrom
mstru54:fix/macos-intel-openssl-prefix
Aug 31, 2026
Merged

fix(setup): resolve openssl@3 prefix via brew so setup.sh works on Intel Macs#379
tilakpatel22 merged 1 commit into
Fincept-Corporation:mainfrom
mstru54:fix/macos-intel-openssl-prefix

Conversation

@mstru54

@mstru54 mstru54 commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Problem

setup.sh only sets OPENSSL_ROOT_DIR when /opt/homebrew/opt/openssl@3 exists:

if [ "$PLATFORM" = "macos" ] && [ -d "/opt/homebrew/opt/openssl@3" ]; then
    EXTRA_ARGS="-DOPENSSL_ROOT_DIR=/opt/homebrew/opt/openssl@3"
fi

/opt/homebrew is the Apple Silicon prefix. On Intel Macs Homebrew installs under /usr/local, so the test fails, EXTRA_ARGS stays empty, and CMake is configured with no OpenSSL root.

Impact on Intel Macs

1. Configure fails. fincept-qt/CMakeLists.txt calls find_package(OpenSSL REQUIRED). macOS ships no OpenSSL development headers, so with no root to search this is a hard stop — ./setup.sh cannot complete on an Intel Mac as written.

2. A quieter TLS problem. Even given a working OpenSSL, the guard below is skipped because it is conditioned on the same variable:

if(APPLE AND OPENSSL_ROOT_DIR)
    # symlink libssl/libcrypto into Qt's lib dir

The comment on that block explains the stakes: without the symlinks Qt's openssl TLS plugin fails to register and Qt falls back to the deprecated SecureTransport backend, "which double-frees in SSLWrite during QWebSocket close and crashes the crypto tab." So the hardcoded path also silently disarms the workaround for that crash.

Fix

Ask Homebrew for the prefix rather than hardcoding one:

OPENSSL_PREFIX="$(brew --prefix openssl@3 2>/dev/null || true)"

This is correct on both architectures and additionally honours a non-standard HOMEBREW_PREFIX. When openssl@3 is not installed, brew --prefix fails, EXTRA_ARGS stays empty, and behaviour is exactly as before — so this is a no-op wherever the current code already worked.

Verification

Built from a clean clone on:

  • macOS 15.7.9, Intel x86_64
  • Apple Clang 17.0.0
  • Qt 6.8.3 (aqtinstall, clang_64), CMake 3.27.7, Ninja 1.11.1
  • Homebrew openssl@3 3.6.3 at /usr/local/opt/openssl@3

Results:

  • Configure succeeds — Found OpenSSL: /usr/local/opt/openssl@3/lib/libcrypto.dylib (found version "3.6.3")
  • All four symlinks created in Qt's lib dir (libssl.dylib, libssl.3.dylib, libcrypto.dylib, libcrypto.3.dylib)
  • Build completes: 758/758 targets, 0 errors
  • App logs TLS backend: openssl (available: securetransport, openssl, cert-only) at startup, confirming the openssl plugin registered rather than falling back to SecureTransport

Without this change the same clone fails at the configure step.

…pple Silicon path

The macOS configure step only set OPENSSL_ROOT_DIR when
/opt/homebrew/opt/openssl@3 existed. That path is Apple Silicon only —
Intel Macs install Homebrew under /usr/local, so on those machines
EXTRA_ARGS stayed empty and the build was configured without an OpenSSL
root.

Two consequences on Intel:

1. find_package(OpenSSL REQUIRED) in fincept-qt/CMakeLists.txt has no
   root to search. macOS ships no OpenSSL development headers, so
   configure fails.

2. More subtly, the `if(APPLE AND OPENSSL_ROOT_DIR)` block that symlinks
   libssl/libcrypto into Qt's lib dir is skipped. Per the comment there,
   that makes Qt's openssl TLS plugin fail to register and fall back to
   the deprecated SecureTransport backend, which double-frees in SSLWrite
   during QWebSocket close and crashes the crypto tab.

Ask brew for the prefix instead, which is correct on both architectures
and also honours a non-standard HOMEBREW_PREFIX. Falls back to leaving
EXTRA_ARGS empty when openssl@3 is not installed, so behaviour is
unchanged where the formula is absent.

Verified on macOS 15.7.9 / Intel x86_64, Apple Clang 17, Qt 6.8.3:
build completes (758/758 targets) and the app logs
"TLS backend: openssl" at startup.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Hi @mstru54 — thanks for the PR!

Our automated scope gate flagged the following:

No scope-approved linked issue. This PR must close an issue that carries one of: good-first-issue, help-wanted, scope:approved. Link it in the PR body with Closes #NNN or via GitHub's "Linked issues" sidebar.

Please read CONTRIBUTING.md. Once an issue with the appropriate label exists and is linked here, re-run this check by pushing an empty commit or editing the PR description. A maintainer can also bypass this gate by adding the scope:approved label to this PR.

PRs that remain unresolved for 7 days will be closed automatically.

@tilakpatel22

Copy link
Copy Markdown
Collaborator

@mstru54 Thanks for the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-scope-approval Auto-applied by pr-gate.yml to PRs that fail the scope gate.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants