Skip to content

Add build.ps1 support for external system OpenSSL 3.5+ - #6257

Open
Tomas Weinfurt (wfurt) wants to merge 3 commits into
microsoft:mainfrom
wfurt:furt/external-openssl-build
Open

Add build.ps1 support for external system OpenSSL 3.5+#6257
Tomas Weinfurt (wfurt) wants to merge 3 commits into
microsoft:mainfrom
wfurt:furt/external-openssl-build

Conversation

@wfurt

Copy link
Copy Markdown
Member

Expose the existing CMake external-OpenSSL selection through the build.ps1 helper so libmsquic can be built against a system OpenSSL 3.5.0+ without building the openssl/quictls submodules. Both libssl and libcrypto are then dynamically linked from the system.

  • build.ps1: add -UseExternalOpenSSL and -OpenSSLRootDir, mapping to QUIC_USE_EXTERNAL_OPENSSL / QUIC_OPENSSL_ROOT_DIR. Validate that they require -Tls openssl and are incompatible with -UseSystemOpenSSLCrypto. Finer-grained include/lib selection remains available via CMake.

  • CMakeLists.txt: make QUIC_USE_SYSTEM_LIBCRYPTO and QUIC_USE_EXTERNAL_OPENSSL mutually exclusive with a clear FATAL_ERROR, since the former is silently ignored by the external path.

  • docs/BUILD.md: document the new options and point power users to the CMake QUIC_OPENSSL_INCLUDE_DIR/QUIC_OPENSSL_LIB_DIR knobs.

fixes #5210

when build agains external openssl the library becomes much smaller:
~11× smaller (0.45 MB vs 5.03 MB stripped).

note that we seems to build & ship binaries for Ubuntu 26 using quictls e.g. the old way even if new openssl is available.

Testing

  • Ubuntu 26.04 (OpenSSL 3.5.5) and Arch (OpenSSL 3.6.3): -UseExternalOpenSSL builds libmsquic.so, dynamically links libssl.so.3 + libcrypto.so.3, and has no ossl_time_now / no undefined ossl_* symbols.
  • With openssl/quictls submodules masked empty: build still succeeds — proves no submodule dependency.
  • With submodules present: tls_openssl.c compiles with only -I.../src/inc; no submodule OpenSSL headers leak onto the include path.
  • Old OpenSSL (host, 3.0.13): fails cleanly at configure time — Could NOT find OpenSSL ... Found unsuitable version "3.0.13" ... minimum required is "3.5.0".
  • Conflicting flags: QUIC_USE_EXTERNAL_OPENSSL + QUIC_USE_SYSTEM_LIBCRYPTO now fails immediately with the new FATAL_ERROR.
  • Size comparison (Arch, RelWithDebInfo, stripped): external ~0.45 MB vs quictls ~5.03 MB — external is ~11x smaller because OpenSSL is no longer statically embedded.

Documentation

docs/BUILD.md updated with the new -UseExternalOpenSSL / -OpenSSLRootDir options and a note pointing power users to CMake for include/lib-dir control.

cc: Marie Píchová (@ManickaP)

Expose the existing CMake external-OpenSSL selection through the
build.ps1 helper so libmsquic can be built against a system OpenSSL
3.5.0+ without building the openssl/quictls submodules. Both libssl and
libcrypto are then dynamically linked from the system.

- build.ps1: add -UseExternalOpenSSL and -OpenSSLRootDir, mapping to
  QUIC_USE_EXTERNAL_OPENSSL / QUIC_OPENSSL_ROOT_DIR. Validate that they
  require -Tls openssl and are incompatible with -UseSystemOpenSSLCrypto.
  Finer-grained include/lib selection remains available via CMake.
- CMakeLists.txt: make QUIC_USE_SYSTEM_LIBCRYPTO and
  QUIC_USE_EXTERNAL_OPENSSL mutually exclusive with a clear FATAL_ERROR,
  since the former is silently ignored by the external path.
- docs/BUILD.md: document the new options and point power users to the
  CMake QUIC_OPENSSL_INCLUDE_DIR/QUIC_OPENSSL_LIB_DIR knobs.

This is the fully-dynamic system-crypto build direction discussed in
microsoft#5210, and avoids the ossl_time_now undefined-symbol
crash from the static-libssl + system-libcrypto submodule path.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@wfurt
Tomas Weinfurt (wfurt) requested a review from a team as a code owner August 22, 2026 21:42
@codecov

codecov Bot commented Aug 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.38%. Comparing base (4984c21) to head (f7ea86f).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6257      +/-   ##
==========================================
+ Coverage   85.28%   85.38%   +0.09%     
==========================================
  Files          60       60              
  Lines       18973    18977       +4     
==========================================
+ Hits        16181    16203      +22     
+ Misses       2792     2774      -18     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@guhetier

Copy link
Copy Markdown
Collaborator

note that we seems to build & ship binaries for Ubuntu 26 using quictls e.g. the old way even if new openssl is available.

Tomas Weinfurt (@wfurt) We are planning to start shipping with OpenSSL instead of QuicTLS by default starting MsQuic v2.7

Comment thread docs/BUILD.md Outdated
Address review feedback on microsoft#6257: the -UseExternalOpenSSL note claimed
libssl/libcrypto are always dynamically linked, but with -Static the
external OpenSSL is linked statically (OPENSSL_USE_STATIC_LIBS).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread CMakeLists.txt Outdated
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.

OpenSSL 3.5 crash

3 participants