Skip to content

Use system libcurl through dlopen on Linux/BSD#781

Merged
jviotti merged 2 commits into
mainfrom
curl-dlopen
Jun 16, 2026
Merged

Use system libcurl through dlopen on Linux/BSD#781
jviotti merged 2 commits into
mainfrom
curl-dlopen

Conversation

@jviotti

@jviotti jviotti commented Jun 16, 2026

Copy link
Copy Markdown
Member

Signed-off-by: Juan Cruz Viotti jv@jviotti.com

@jviotti jviotti force-pushed the curl-dlopen branch 2 times, most recently from 9260c14 to c809979 Compare June 16, 2026 15:21
@jviotti jviotti marked this pull request as ready for review June 16, 2026 15:26
@jviotti jviotti changed the title [WIP] Use libcurl through dlopen on Linux Use system libcurl through dlopen on Linux/BSD Jun 16, 2026
@augmentcode

augmentcode Bot commented Jun 16, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: This PR changes the non-macOS/non-Windows HTTP implementation to use the system libcurl loaded at runtime (via dlopen), rather than bundling a vendored curl + TLS/DNS dependency stack.

Changes:

  • Removes vendored networking dependencies (curl, mbedtls, nghttp2, c-ares, libpsl, zlib) from DEPENDENCIES and deletes related custom CMake find modules.
  • Updates the curl HTTP backend (src/http/http_curl.cc) to support two modes: link-time system curl (JSONSCHEMA_USE_SYSTEM_CURL) or runtime-loaded curl (default).
  • Adds CurlLibraryError and wires it into CLI error reporting with structured JSON/non-JSON output (src/error.h).
  • Adjusts src/http/CMakeLists.txt to link dl only for the runtime-loaded backend and to link CURL::libcurl when requested.
  • Documents the new runtime dependency and override env var (SOURCEMETA_JSONSCHEMA_CURL_SO) in README.markdown.
  • Adds a Linux CI test to validate behavior when libcurl is missing/misconfigured.
  • Updates the Alpine test Dockerfile to install libcurl.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot 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.

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread src/http/http_curl.cc Outdated
Comment thread Dockerfile.test.alpine
@jviotti jviotti force-pushed the curl-dlopen branch 2 times, most recently from d05e668 to 0bdf26d Compare June 16, 2026 15:36
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
@jviotti jviotti merged commit dda4f72 into main Jun 16, 2026
14 checks passed
@jviotti jviotti deleted the curl-dlopen branch June 16, 2026 16:35
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Jun 18, 2026
⚠️ **CAUTION: this is a major update, indicating a breaking change!** ⚠️

This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [sourcemeta/jsonschema](https://github.com/sourcemeta/jsonschema) | major | `v15.11.0` → `v16.0.0` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>sourcemeta/jsonschema (sourcemeta/jsonschema)</summary>

### [`v16.0.0`](https://github.com/sourcemeta/jsonschema/releases/tag/v16.0.0)

[Compare Source](sourcemeta/jsonschema@v15.11.0...v16.0.0)

#### What's Changed

- Support bundled schemas with custom meta-schemas by [@&#8203;jviotti](https://github.com/jviotti) in [#&#8203;779](sourcemeta/jsonschema#779)
- Support `dependentSchemas` and `dependentRequired` on `codegen` by [@&#8203;jviotti](https://github.com/jviotti) in [#&#8203;780](sourcemeta/jsonschema#780)

#### Breaking Changes

- Use system `libcurl` through `dlopen` on Linux/BSD by [@&#8203;jviotti](https://github.com/jviotti) in [#&#8203;781](sourcemeta/jsonschema#781)

Before this release, the Linux pre-compiled binaries were built against a vendored static copy of cURL. While that worked in most cases, it relied on a very specific CA certificate store. Making it problematic if you need more runtime control over that in your actual target installation.

So instead of linking against a specific version of cURL in the system (and therefore probably breaking some distros no matter what), we take a more dynamic approach: we can at runtime try to find an appropriate cURL library we can use (probing lots of popular paths across distros), and dynamically load it.

Most Linux systems have cURL installed out of the box, otherwise you get a friendly runtime error instructing you on how to fix it or point to a custom one of your choice.

**Full Changelog**: <sourcemeta/jsonschema@v15.11.0...v16.0.0>

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yMjcuMSIsInVwZGF0ZWRJblZlciI6IjQzLjIyNy4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiLCJhdXRvbWF0aW9uOmJvdC1hdXRob3JlZCIsImRlcGVuZGVuY3ktdHlwZTo6bWFqb3IiXX0=-->
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.

1 participant