Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

curl links against system libldap if installed #17919

Closed
hmoffatt opened this issue May 14, 2021 · 14 comments
Closed

curl links against system libldap if installed #17919

hmoffatt opened this issue May 14, 2021 · 14 comments
Assignees
Labels
category:port-bug The issue is with a library, which is something the port should already support

Comments

@hmoffatt
Copy link
Contributor

Host Environment

  • OS: Debian buster
  • Compiler: 8.3

To Reproduce

apt install libldap-dev
./vcpkg install curl

Failure logs
The port builds OK, but now any application using curl also ends up linked against the system libldap and liblber. The system libraries are dynamic libraries and this happens even if curl is built as a static library (linux default), which makes it a mess to deploy.

The config like from curl is attached. config-x64-linux-rel-out.log

Additional context

@dg0yt
Copy link
Contributor

dg0yt commented May 14, 2021

Oh, this might also explain some explicit osx linker flags in port GDAL...

@dg0yt
Copy link
Contributor

dg0yt commented May 14, 2021

There is no fine-grain feature to toggle LDAP. However, for UWP, there is -DUSE_WIN32_LDAP=OFF.

Basically,
a) some protocols are entirely implemented in curl,
b) some protocols are entirely dependent on external libraries,
b) some protocols optionally use external libraires,
where an "external library" may be either always present (core system library), or e.g. installed via Linux package manager.

There is a default port feature "non-http" ("Enables protocols beyond HTTP/HTTPS/HTTP2") which the port maps to -DHTTP_ONLY=....
As a pitfall for more finegrained feature control, the semantics of HTTP_ONLY is different from the feature:

  • The absence of the "non-http" feature should not forbid other protocols such as a hypothetical explicit feature "ldap"), but:
  • The activation of -DHTTP_ONLY=ON forces all other protocols to be disabled.

HTTP_ONLY and protocols in curl:
https://github.com/curl/curl/blob/dae382a1a1481a94b708c82d5aa9fa7253084160/CMakeLists.txt#L159-L209

Last not least, just looking for find_ in CMakeLists is not enough: For LDAP, it uses custom commands such as check_library_exists_concat.

@JackBoosY JackBoosY added the category:port-bug The issue is with a library, which is something the port should already support label May 14, 2021
@JackBoosY
Copy link
Contributor

Since the feature ldap has some problems upstream, we should disable this feature until the upstream fixes it.
Duplicated to #14030.

@dg0yt
Copy link
Contributor

dg0yt commented May 14, 2021

@JackBoosY Disabling LDAP (for different reasons, 14030 is about Windows) is one thing. Shall I open a separate issue for the other protocols/dependencies?
(Not sure if I will make another curl PR soon. IIRC there was another pc file issue in some triplets, so I might come to that port again.)

@JackBoosY
Copy link
Contributor

@dg0yt Yes, please.

@hmoffatt
Copy link
Contributor Author

The other issue seems more concerned with ldaps than pure ldap, and Windows rather than Linux. Is the proposed solution to disable all ldap on all platforms?

I tried to build curl without the non-http feature but many packages depend on curl with default features eg aws-sdk-cpp. Perhaps that is also a bug? Or the default features are wrong?

@JackBoosY
Copy link
Contributor

JackBoosY commented May 15, 2021

@hmoffatt We should only disable ldap on Windows, see curl/curl@835c263.
The Linux issue will be resolved in the disable PR also.

@hmoffatt
Copy link
Contributor Author

My issue is on linux though. The curl port shouldn't end up linked to random other libraries outside of vcpkg which may or may not be installed?

Maybe it would be best to add a libldap port and use that so it least it's under control.

@hmoffatt
Copy link
Contributor Author

Is it a good idea for curl's default features to include non-http anyway?

@dg0yt
Copy link
Contributor

dg0yt commented May 15, 2021

Is it a good idea for curl's default features to include non-http anyway?

IMO it is okay to enable generaly protocols which are entirely implemented in curl (item 'a' in the list above). For the other options, there must be vcpkg dependencies (which can be part of explicit features). If there is no vcpkg port, the protocol must be disabled, or perhaps move to another explicit feature ("system-libraries" is what I proposed in a GDAL bug.)

@dg0yt
Copy link
Contributor

dg0yt commented May 15, 2021

A problem with curl's HTTP_ONLY is that it is dominant, i.e. you cannot selectively enable additional protocols.

@ulfllorenz
Copy link
Contributor

Then asking here: I have a question: What is the status of this issue? I see that it is closed, but there are no associated commits or closing remarks.

We have the same problem here where our Linux package of curl drags in the libldap by default. I can disable non-HTTP parts and solve this problem by choosing "vcpkg install curl[core,ssl]", however, we also use the cpr package for the actual interfacing with curl, and cpr depends on curl with the default arguments, so that "vcpkg install curl[core,ssl] cpr" again drags in curl with the "non-http" feature. Our current workaround is to clone the cpr port and depend on "curl[core,ssl]", but that is not a good state IMO.

@ulfllorenz
Copy link
Contributor

Screw the second paragraph. We also use an old state of vcpkg and while testing the old and the current state, I seem to have mixed things up.

@dg0yt
Copy link
Contributor

dg0yt commented Aug 5, 2021

@ulfllorenz With #18971, curl should no longer request any LDAP dependencies except for WinLDAP (new non-default feature "winldap").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-bug The issue is with a library, which is something the port should already support
Projects
None yet
Development

No branches or pull requests

4 participants