Skip to content

cmake: link llvm stdc++ lib to AWS-LC/BoringSSL-specific feature detections only - #23122

Closed
vszakats wants to merge 1 commit into
curl:masterfrom
vszakats:cm-ossl-cxx
Closed

vszakats wants to merge 1 commit into
curl:masterfrom
vszakats:cm-ossl-cxx

Conversation

@vszakats

@vszakats vszakats commented Sep 27, 2026 •

Copy link
Copy Markdown
Member

When using llvm/clang combined with AWS-LC/BoringSSL and
OPENSSL_USE_STATIC_LIBS=ON.

Passing the stdc++ library to other feature detections may break them,
ending the configure stage with a weird error.

As in this example seen with quiche 0.30.0 (+ cmake 4.4.3) on Linux:

[...]
-- Performing Test HAVE_FSETXATTR_5
CMake Error at curl/bld/CMakeFiles/CMakeTmp/CMakeLists.txt:30 (target_link_libraries):
  Target "cmTC_503bd" links to:

    Threads::Threads

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

CMake Error at CMake/Macros.cmake:44 (try_compile):
  Failed to generate test project build system.
Call Stack (most recent call first):
  CMakeLists.txt:1700 (curl_internal_test)

Ref: https://github.com/curl/curl/actions/runs/36243669911/job/108408815423#step:21:1729

CMakeFiles/CMakeConfigureLog.yaml shows no error message, just a
failure with exit code 1.

Follow-up to 12a6de2 #16043
Cherry-picked from #23088

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The new condition applies stdc++ unconditionally to AWS-LC due to operator precedence.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Limits stdc++ linkage to AWS-LC/BoringSSL feature detection.

Changes:

  • Removes stdc++ from global feature checks.
  • Adds it within OpenSSL-specific checks.
File Description
CMakeLists.txt Narrows stdc++ linkage scope.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread CMakeLists.txt Resolved
… feature detections

When using llvm/clang combined with AWS-LC/BoringSSL and
`OPENSSL_USE_STATIC_LIBS=ON`.

Passing the stdc++ library to other feature detection may break them,
ending the configure stage with weird errors.

As in this example seen with quiche 0.30.0 (+ cmake 4.4.3) on Linux:
```
[...]
-- Performing Test HAVE_FSETXATTR_5
CMake Error at /home/runner/work/curl/curl/bld/CMakeFiles/CMakeTmp/CMakeLists.txt:30 (target_link_libraries):
  Target "cmTC_503bd" links to:

    Threads::Threads

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

CMake Error at CMake/Macros.cmake:44 (try_compile):
  Failed to generate test project build system.
Call Stack (most recent call first):
  CMakeLists.txt:1700 (curl_internal_test)
```
Ref: https://github.com/curl/curl/actions/runs/36243669911/job/108408815423#step:21:1729

The `CMakeFiles/CMakeConfigureLog.yaml` log shows no error message, just
a failure with exit code 1.

Follow-up to 12a6de2 curl#16043
Cherry-picked from curl#23088

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The scoped change preserves required TLS checks while preventing unrelated CMake detections from inheriting stdc++.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@vszakats vszakats closed this in cee47ee Sep 27, 2026
@vszakats
vszakats deleted the cm-ossl-cxx branch September 27, 2026 17:29
vszakats added a commit that referenced this pull request Sep 27, 2026
…structions

- docs/HTTP3.md: update instructions for quiche and curl with autotools.
- docs/HTTP3.md: add instructions for curl with CMake.
- GHA/http3-linux: bump to quiche 0.30.0
- GHA/http3-linux: adjust local script for BoringSSL sources that
  changed location upstream.
- GHA/http3-linux: use clang in quiche jobs to stay in sync with
  the quiche build also using clang. Necessary to avoid C++ standard
  library confusion.
- GHA/http3-linux: explicitly pass `stdc++` library for BoringSSL in
  quiche jobs.
- GHA/http3-linux: pass `-fPIC`, to correctly build against BoringSSL.
- GHA/http3-linux: pass `-DOPENSSL_USE_STATIC_LIBS=ON` to CMake
  to enable `stdc++`.
- GHA/http3-linux: uninstall `libssl-dev` package to avoid CMake picking
  it up, and ending up with confused OpenSSL target settings (consisting
  of the manual configuration intermixed with system openssl.pc settings)
  that make the configure stage fail.

Follow-up to cee47ee #23122
Follow-up to 47c08c8 #23116
Follow-up to efc5e67 #22988

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

Development

Successfully merging this pull request may close these issues.

2 participants