Skip to content

build: add ldap to libcurl.pc Requires: - #15163

Closed
vszakats wants to merge 2 commits into
curl:masterfrom
vszakats:build-pc-ldap
Closed

build: add ldap to libcurl.pc Requires:#15163
vszakats wants to merge 2 commits into
curl:masterfrom
vszakats:build-pc-ldap

Conversation

@vszakats

@vszakats vszakats commented Oct 5, 2024

Copy link
Copy Markdown
Member

No description provided.

@vszakats vszakats changed the title build: add ldap to libcurl.pc build: add ldap to libcurl.pc Requires: Oct 5, 2024
@vszakats vszakats closed this in 1d96067 Oct 7, 2024
@vszakats
vszakats deleted the build-pc-ldap branch October 7, 2024 10:32
@citrus-it

Copy link
Copy Markdown

I just hit some fallout from this when building rsyslog on OmniOS. rsyslog happens to run:

% pkg-config --exists --print-errors libcurl
Package ldap was not found in the pkg-config search path.
Perhaps you should add the directory containing `ldap.pc'
to the PKG_CONFIG_PATH environment variable
Package 'ldap', required by 'libcurl', not found

There is no ldap.pc on OmniOS (it's a core library that comes from illumos rather then openldap).

@vszakats

Copy link
Copy Markdown
Member Author

Thanks, noted.

It appears it's curl's job to guess what's available on a target env.
This is fine on unixes, but less so on others. There is one more
thing to try, but it's complicated, discussed in: #15535

vszakats added a commit that referenced this pull request Nov 14, 2024
The idea of linking dependencies found to `libcurl.pc` turns out not
to work in practice in some cases.

Specifically: gss, ldap, mbedtls, libmsh3, rustls

A `.pc` may not work or be missing for a couple of reasons:
- not all build methods generate it: mbedTLS, Rustls
- generated file is broken: msh3
  Ref: nibanks/msh3#225
- installed package flavour isn't shipping with one:
  FreeBSD GSS, OmniOS LDAP, macOS LDAP

The effect of such issues shall be subtle in theory, because
`libcurl.pc` normally lists these dependencies in the `Requires.private`
section meant for static linking. But, e.g. `pkg-config --exists`
requires these to be present, and builds sometimes use this check
regardless of build type. This bug is not present in `pkgconf`; it only
checks for them when `--static` is also passed.

Fix these by adding affected `.pc` references to `libcurl.pc` only when
we detected the dependency via `pkg-config`.

There are a few side-effects of this solution:
- references are never added for dependencies where curl doesn't
  implement `pkg-config` detection. These are:
  - autotools: ldap, mbedtls, msh3
  - cmake: ldap (pending #15273)
- generated `libcurl.pc` depends on the build-time environment.
- generated `libcurl.pc` depends on curl build tool (cmake, autotools).
- generated `libcurl.pc` depends on curl build implementation details.

Make an exception for GNU GSS, where I blindly guess that `gss.pc` is
always available, as no issues were reported.

Other, not mentioned, dependencies continue to be added regardless
of the detection method.

Reported-by: Harmen Stoppels, Thomas, Daniel Engberg, Andy Fiddaman
Fixes #15469
Fixes #15507
Fixes #15535
Fixes #15163 (comment)
Closes #15573
pps83 pushed a commit to pps83/curl that referenced this pull request Apr 26, 2025
pps83 pushed a commit to pps83/curl that referenced this pull request Apr 26, 2025
The idea of linking dependencies found to `libcurl.pc` turns out not
to work in practice in some cases.

Specifically: gss, ldap, mbedtls, libmsh3, rustls

A `.pc` may not work or be missing for a couple of reasons:
- not all build methods generate it: mbedTLS, Rustls
- generated file is broken: msh3
  Ref: nibanks/msh3#225
- installed package flavour isn't shipping with one:
  FreeBSD GSS, OmniOS LDAP, macOS LDAP

The effect of such issues shall be subtle in theory, because
`libcurl.pc` normally lists these dependencies in the `Requires.private`
section meant for static linking. But, e.g. `pkg-config --exists`
requires these to be present, and builds sometimes use this check
regardless of build type. This bug is not present in `pkgconf`; it only
checks for them when `--static` is also passed.

Fix these by adding affected `.pc` references to `libcurl.pc` only when
we detected the dependency via `pkg-config`.

There are a few side-effects of this solution:
- references are never added for dependencies where curl doesn't
  implement `pkg-config` detection. These are:
  - autotools: ldap, mbedtls, msh3
  - cmake: ldap (pending curl#15273)
- generated `libcurl.pc` depends on the build-time environment.
- generated `libcurl.pc` depends on curl build tool (cmake, autotools).
- generated `libcurl.pc` depends on curl build implementation details.

Make an exception for GNU GSS, where I blindly guess that `gss.pc` is
always available, as no issues were reported.

Other, not mentioned, dependencies continue to be added regardless
of the detection method.

Reported-by: Harmen Stoppels, Thomas, Daniel Engberg, Andy Fiddaman
Fixes curl#15469
Fixes curl#15507
Fixes curl#15535
Fixes curl#15163 (comment)
Closes curl#15573
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