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

Cannot compile against a static build of OpenLDAP #2367

cmeister2 opened this issue Mar 7, 2018 · 4 comments


None yet
3 participants
Copy link

commented Mar 7, 2018

I did this

./configure --prefix=/tmp/curl_install --disable-shared --enable-debug --enable-maintainer-mode --disable-symbol-hiding --enable-ipv6 --with-random=/dev/null --with-ssl=/tmp/curl_install --with-ldap-lib=/tmp/curl_install/lib/libldap.a

This gives the following output:

checking for lber.h... no
checking for ldap.h... no
checking for ldapssl.h... no
checking for ldap_ssl.h... no
checking for ldap_init in -l"/tmp/curl_install/lib/libldap.a"... no
configure: WARNING: "/tmp/curl_install/lib/libldap.a" is not an LDAP library: LDAP disabled

The header file failures appear to be due to not having those files in the standard system path (as expected).

The ldap_init failure looks to be simpler:

configure:21593: checking for ldap_init in -l"/tmp/curl_install/lib/libldap.a"
configure:21615: gcc -o conftest -Werror-implicit-function-declaration -g -O0 -pedantic -Wall -W -Wpointer-arith -Wwrite-strings -Wunused -Wshadow -Winline -Wnested-externs -Wmissing-declarations -Wmissing-prototypes -Wno-long-long -Wfloat-equal -Wno-multichar -Wsign-compare -Wundef -Wno-format-nonliteral -Wendif-labels -Wstrict-prototypes -Wdeclaration-after-statement -Wstrict-aliasing=3 -Wcast-align -Wtype-limits -Wold-style-declaration -Wmissing-parameter-type -Wempty-body -Wclobbered -Wignored-qualifiers -Wconversion -Wno-sign-conversion -Wvla -Wdouble-promotion -Wno-system-headers -DDEBUGBUILD -DCURLDEBUG    conftest.c -l/tmp/curl_install/lib/libldap.a  -lz  >&5
conftest.c:37:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
 char ldap_init ();
/usr/bin/ld: cannot find -l/tmp/curl_install/lib/libldap.a

Specifying the path of the ldap library isn't really the correct way of specifying a "-l" library; but specifying "ldap" as the name will also fail because the lib path isn't specified.

This looks to be because there's no configure mechanism for specifying the root directory of an LDAP install (compare to say libbrotli or openssl or rtmp, which have a --with-{brotli,ssl,rtmp} mechanism).

I expected the following

For the build to work!

curl/libcurl version

Latest git master (b2afc36)

operating system

Ubuntu Linux

@bagder bagder added the build label Mar 7, 2018


This comment has been minimized.

Copy link
Contributor Author

commented Mar 9, 2018

By the way, I don't mind implementing the fix if I get a reasonable design 😄


This comment has been minimized.

Copy link

commented Mar 17, 2018

The configure script really isn't done to fix static builds for a lot of situations, mostly since it is a futile game to make sure it tracks down and link with all the possible 3rd party dependencies for all libs it can link with. We focus on linking shared in the configure script.

That said, you can usually fix static links problem by crafting LDFLAGS, LlBS and CPPFLAGS etc on the configure command line to instruct configure to link with (the correct) extra things and fine the correct include paths etc.


This comment has been minimized.

Copy link

commented Mar 31, 2019

@cmeister2 have you fixed this somehow?


This comment has been minimized.

Copy link
Contributor Author

commented Mar 31, 2019

@lock lock bot locked as resolved and limited conversation to collaborators Jun 30, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.