Bug 10047 - configure fails to detect LDAP library compile flags properly
Summary: configure fails to detect LDAP library compile flags properly
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Build (show other bugs)
Version: 4.9.3
Hardware: All All
: P5 normal (vote)
Target Milestone: 4.9
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-26 07:18 UTC by Gilles Pion
Modified: 2024-04-08 04:54 UTC (History)
6 users (show)

See Also:


Attachments
c source file generated by configure to check for ldap_initialize (22.56 KB, text/x-c)
2013-07-26 07:18 UTC, Gilles Pion
no flags Details
test.c (22.65 KB, text/x-csrc)
2013-08-06 11:42 UTC, Gilles Pion
no flags Details
ldap_init(ialize) not found (263.16 KB, application/x-gzip)
2014-03-04 16:56 UTC, Peter (mail address dead)
no flags Details
Proposed patch (1.22 KB, patch)
2016-02-23 15:50 UTC, Guillaume Xavier Taillon (mail address dead)
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gilles Pion 2013-07-26 07:18:15 UTC
Created attachment 9076 [details]
c source file generated by configure to check for ldap_initialize

Samba version 4.0.7
Aix 6.1
Compiler: IBM xlc

Last lines of "./configure" output:
Checking for ldap_init : not found 
Checking for ldap_init_fd : not found 
Checking for ldap_initialize : not found 
Checking for ldap_set_rebind_proc : not found 
Checking for ldap_add_result_entry : ok 
Checking whether ldap_set_rebind_proc takes 3 arguments : ok 
Active Directory support not available: LDAP support ist not available.
<path>/wscript:760: error: Active Directory support not found. 
Use --without-ads for building without Active Directory support.


Cause:
the generated "test.c" file used in configure checks doesn't have the following required ldap include:
#include <ldap.h>

The compilation gives the following error
"test.c", line 826.39: 1506-045 (S) Undeclared identifier ldap_initialize.

After having extracted the test.c file , added the missing include, it compiles just fine
Comment 1 Yannick Bergeron (mail address dead) 2013-08-03 01:42:27 UTC
Hi Gilles,

I'm currently in vacation but will be back at work on Monday August 5, 2013.
I'm running Samba on AIX (5.3, 6.1 and 7.1) and compile it with XL C/C++.
What is your compilation procedure which produce the following errors? (env. variable, configure options, etc.)
What do you have on your system? IBM Tivoli Directory Server/Client? OpenLDAP? Something else?

Best regards,

Yannick Bergeron
Comment 2 Gilles Pion 2013-08-06 11:42:11 UTC
2013/8/3 <samba-bugs@samba.org>
>
> I'm currently in vacation but will be back at work on Monday August 5, 2013.
> I'm running Samba on AIX (5.3, 6.1 and 7.1) and compile it with XL C/C++.
> What is your compilation procedure which produce the following errors? (env.
> variable, configure options, etc.)
> What do you have on your system? IBM Tivoli Directory Server/Client? OpenLDAP?
> Something else?

I'm created a separate samba projet tree using it's own dedicated
openldap (2.4.26) source tree.
All samba dependencies (like openssl, openldap) are all installed
under a dedicated common prefix.

You should be able to easily reproduce the bug.
(Maybe it's not present when using another version of openldap)

When waf version of "configure" tries to check for the availability of
"ldap_set_rebind_proc" API it uses the attached .c file

With my setup, a compile and link done with the following command
fails when the includes (ldap.h and lber.h) are commented out:

PREFIX=<install_directory_path_here> # openldap and openssl installed
there, also "--prefix" of samba install
> xlc -I$PREFIX/include/ -L$PREFIX/lib -lldap -llber -lcrypto -lssl -o a.out test.c
"test.c", line 829.39: 1506-045 (S) Undeclared identifier ldap_set_rebind_proc.

The *same* commands runs without error after having un-commented  the
two includes lines (ldap.h and lper.h) inside test.c
Comment 3 Gilles Pion 2013-08-06 11:42:13 UTC
Created attachment 9110 [details]
test.c
Comment 4 Peter (mail address dead) 2014-02-11 17:34:04 UTC
I have the same problem with
AIX 7.1
Samba version 4.1.4
openldap 2.4.39

what is the correct procedure here? should I open a new bug?
Comment 5 Peter (mail address dead) 2014-03-04 16:56:45 UTC
Created attachment 9750 [details]
ldap_init(ialize) not found

config.log after these messages:
Checking for header ldap.h                                : yes 
Checking for header lber.h                                : yes 
Checking for header ldap_pvt.h                            : no 
Checking for ber_tag_t                                    : ok 
Checking for library lber                                 : yes 
Checking for ber_scanf                                    : ok 
Checking for ber_sockbuf_add_io                           : ok 
Checking for variable LDAP_OPT_SOCKBUF                    : ok 
Checking for variable LBER_OPT_LOG_PRINT_FN               : ok 
Checking for library ldap                                 : yes 
Checking for ldap_init                                    : not found 
Checking for ldap_init_fd                                 : not found 
Checking for ldap_initialize                              : not found 
Checking for ldap_set_rebind_proc                         : not found 
Checking for ldap_add_result_entry                        : ok 
Checking whether ldap_set_rebind_proc takes 3 arguments   : ok 
Active Directory support not available: LDAP support ist not available.
/usr/samba-4.1.5/source3/wscript:753: error: Active Directory support not found. Use --without-ads for building without Active Directory support.
Comment 6 Björn Jacke 2014-03-05 09:50:19 UTC
i don't have a aix box for testing any more. we also don't have any aix box in the build farm. to get aix build work again we a aix machine in the buildfarm and a possibility for us to log in would be very helpful. finally we would also have space for a donated box in the server room here if remote login is more problematic :-)
Comment 7 Guillaume Xavier Taillon (mail address dead) 2016-02-23 15:49:07 UTC
Configure, possible false negative on AIX 7.1.3, ldap_init not found
AIX Version: 7100-03-05-1524
XLC Version: 13.01.0003.0000
Samba Version: 4.3.5
OpenLDAP Version: 2.4.43

Checking for header ldap.h                                                      
       : yes                                                                    
Checking for header lber.h                                                      
       : yes                                                                    
[...]
Checking for library ldap                                                       
       : yes                                                                    
Checking for ldap_init                                                          
       : not found                                                              
Checking for ldap_init_fd                                                       
       : not found                                                              
Checking for ldap_initialize                                                    
       : not found                                                              
Checking for ldap_set_rebind_proc                                               
       : not found                                                              
Checking for ldap_add_result_entry                                              
       : ok                                                                     
Checking whether ldap_set_rebind_proc takes 3 arguments                         
       : ok                                                                     
/usr/src/samba-4.3.5/source3/wscript:700: error: LDAP support not found. Try
installing libldap2-dev or openldap-devel. Otherwise, use --without-ldap to
build without LDAP support. LDAP support is required for the LDAP passdb
backend, LDAP idmap backends and ADS. ADS support improves communication with
Active Directory domain controllers.

Configure can't find ldap_init, ldap_init_fd, ldap_initialize and 
ldap_set_rebind_proc but is able to find ldap.h, lber.h, etc. 
bin/config.log reveals that when it tries to compile their test, ld can't find
any of lber's symbols. Adding lber as a library in CHECK_FUNCS_IN fixes the
problem (see patch). I don't see why lber is required here, could this be my
openldap that's not properly built?

ld: 0711-317 ERROR: Undefined symbol: .ber_sockbuf_ctrl           
ld: 0711-317 ERROR: Undefined symbol: .ber_memalloc_x             
ld: 0711-317 ERROR: Undefined symbol: ber_pvt_log_print          
[...]

The patch might also resolve Bug 7467.
Comment 8 Guillaume Xavier Taillon (mail address dead) 2016-02-23 15:50:12 UTC
Created attachment 11865 [details]
Proposed patch
Comment 9 Björn Jacke 2018-12-20 15:46:29 UTC
this patch is not enough and this is also not really a AIX specific issue, it's a generic waf configure issue imho. On AIX (like on some other platforms) openldap is always a third party installed library, so that the specific compiler and linker flags need to be used for exactly that specific openldap installation. And in the waf build the ldap library specific flags need to be used at all the places where they are needed (but not globally).

Some brainstorming: The flags needed for ldap (and other library) support should probably extracted from a pkg-config file. For libraries (like openldap) which don't ship with pkg-config files we might just ship out own pkg-config file, which returns the flags that we currently use by default now anyway. Someone with special needs for his ldap library installation can then just adopt that file.