[Samba] how to enable Active Directory support building samba on AIX?

Mike Noonan mike.p.noonan at gmail.com
Tue Mar 4 23:45:24 MST 2014


Hi Peter,

I had a look at your config.log
On line 448924, it is compiling the test program to see in ldap_init is
available.
Underneath you will find a whole whack of undefined symbols. We can also
see the compile command issued and it does not include your LDFLAGS.
I find whenever I make a change to my build environment, I will restore the
samba tar file to ensure I get a really clean start from waf. Otherwise,
the results can be somewhat unpredictable.

So, I'll describe my build environment on AIX 7.1. As I have not finished
unit testing with samba 4.1.x series, I am building it in a private tree
under my home directory including all dependencies.

First, these are the freeware packages installed:
9010435 at t-lpar3:~/local/src> rpm -qa
rsync-3.0.6-1
bash-4.2-1
perl-IO-Socket-SSL-1.33-2
perl-Net_SSLeay.pm-1.30-3
AIX-rpm-7.1.2.15-3
bzip2-1.0.2-3
gzip-1.2.4a-7
popt-1.7-1
readline-4.3-2
sudo-1.7.10p7-1
tar-1.14-1
unzip-5.51-1
vim-common-6.3-1
vim-enhanced-6.3-1
zlib-1.2.3-3


The prerequisite packages I have built are:
make-4.0
db-5.3.21
ncurses-5.9
openldap-2.4.23

In each package directory, I create a MakeDist script.
Most of them source a file I call LocalProfile which looks like this:
unset LIBPATH
unset LD_LIBRARY_PATH
export InstallDir=/home/9010435/local
export OBJECT_MODE=64
export CC="/usr/vacpp/bin/xlc_r -g"
export CXX="/usr/vacpp/bin/xlC_r -g"
export CFLAGS="-qlanglvl=extc99   -q64 -I${InstallDir}/include"
export CPPFLAGS="-qlanglvl=extc99 -q64 -I${InstallDir}/include"
export CXXFLAGS="-qlanglvl=extc99 -q64 -I${InstallDir}/include"
export LDFLAGS="-L${InstallDir}/lib"
export Make=${InstallDir}/bin/make
export PATH=${InstallDir}/bin:${PATH}

The first package I build is make-4.0
9010435 at t-lpar3:~/local/src/make-4.0> cat MakeDist
export OBJECT_MODE=64
export PATH=/usr/bin:/usr/vacpp/bin:.
export CC=/usr/vacpp/bin/xlc
unset LIBPATH
export InstallDir=/home/9010435/local
export CFLAGS="-qlanglvl=extc99 -q64"
export Make=/usr/bin/make
./configure --prefix=$InstallDir &&
$Make                            &&
$Make install                    &&
ln -sf ${InstallDir}/bin/make ${InstallDir}/bin/gmake
$Make distclean
./configure --prefix=$InstallDir
$Make                            &&
$Make install                    &&
ln -sf ${InstallDir}/bin/make ${InstallDir}/bin/gmake
$Make distclean
exit $?

Then ldap:
9010435 at t-lpar3:~/local/src/openldap-2.4.23> cat MakeDist
. ../LocalProfile
./configure --prefix=${InstallDir} --enable-slapd=no &&
$Make &&
$Make install &&
$Make distclean
exit $?

Then ncurses:
9010435 at t-lpar3:~/local/src/ncurses-5.9> cat MakeDist
. ../LocalProfile
./configure --prefix=${InstallDir} &&
$Make &&
$Make install &&
$Make distclean
exit $?

Then berkeley db:
9010435 at t-lpar3:~/local/src/db-5.3.21> cat MakeDist
. ../LocalProfile
cd build_unix
../dist/configure -prefix=${InstallDir} --enable-sql_compat --enable-cxx &&
$Make &&
$Make install &&
rm -f ${InstallDir}/lib/libsqlite.a &&
ln -sf ${InstallDir}/lib/libdb-5.3.a ${InstallDir}/lib/libdb.a
exit $?

Now samba:
First I restore the tarfile.
Then I patch source3/wscript as described earlier, but for completeness
here is is:
629,630c629,630
<         conf.CHECK_FUNCS_IN('ldap_init ldap_init_fd ldap_initialize
ldap_set_rebind_proc', 'ldap', headers='ldap.h lber.h')
<         conf.CHECK_FUNCS_IN('ldap_add_result_entry', 'ldap',
headers='ldap.h')
---
>         conf.CHECK_FUNCS_IN('ldap_init ldap_init_fd ldap_initialize
ldap_set_rebind_proc', 'ldap')
>         conf.CHECK_FUNCS_IN('ldap_add_result_entry', 'ldap')


And here is the  MakeDist script I use:

9010435 at t-lpar3:~/local/src/samba-4.1.5> cat MakeDist
. ../LocalProfile
export SambaBase=${InstallDir}/samba4
export LDFLAGS="${LDFLAGS} -lssl -lcrypto -lldap -llber -liconv -lintl"
export PATH=/apps/local/src/samba-4.1.4/buildtools/bin:${PATH}
waf configure --prefix=${SambaBase} --with-ldap --enable-fhs
--sysconfdir=/etc \
--localstatedir=/var --with-privatedir=/etc/samba/private
--with-acl-support \
--with-ads --with-libiconv=/apps/local --with-pam_smbpass --without-gettext
\
--with-winbind  --with-sendfile-support --with-static-modules=ALL
--nonshared-binary=net &&
sed -e "s/define HAVE_STAT_HIRES_TIMESTAMPS 1/undef
HAVE_STAT_HIRES_TIMESTAMPS/g" <bin/default/include/config.h > config.temp &&
mv config.temp bin/default/include/config.h
$Make -j4 &&
$Make install
# Now finish off the installation that Make doesn't do.
cp -p ./bin/default/source4/heimdal_build/*.so ${SambaBase}/lib/
   for loop in `find ./bin/default/lib -name "*.so"`; do
   cp -p $loop ${SambaBase}/lib
done
exit $?


As I mentioned earlier, I am still unit testing.
One of the problems I am still looking at is with the high resolution
timer.  On aix 6.1, config does no enable the hi res timer, but on 7.1, it
does, and this causes compile errors. I still have not sorted that out, and
that's why I modify config.h before the compile is started,
I also have not sorted out why some libs are not deployed during the
install, so for now you can see I'm doing that manually at the end.
I wouldn't put too much stock in setting --with-static and the non-shared
binary stuff. I've set them on and off and it makes no real difference to
the build results.

Lastly, when starting up smbd, I set LIBPATH to:
LIBPATH=/home/9010435/local/samba4/lib:/home/9010435/local/samba4/lib/samba



I hope all this helps you out.

Regards,

Mike






On Tue, Mar 4, 2014 at 6:46 PM, Peter Waeckerle
<peter.waeckerle at ch.ibm.com>wrote:

> I don't really understand (yet) the contence of config.log :- (
> There are #undefine statements for ldap_init, but I have no idea why.
>
> Why does configure say "ldap_initialize : not found" when even I can see it
> in
> /usr/local/samba/samba-4.1.5/include/ldap.h:
> ...
> /*
>  * in open.c:
>  */
> #if LDAP_DEPRECATED
> LDAP_F( LDAP * )
> ldap_init LDAP_P(( /* deprecated, use ldap_create or ldap_initialize */
>         LDAP_CONST char *host,
>         int port ));
>
> LDAP_F( LDAP * )
> ldap_open LDAP_P((      /* deprecated, use ldap_create or ldap_initialize
> */
>         LDAP_CONST char *host,
>         int port ));
> #endif
>
> LDAP_F( int )
> ldap_create LDAP_P((
>         LDAP **ldp ));
>
> LDAP_F( int )
> ldap_initialize LDAP_P((
>         LDAP **ldp,
>         LDAP_CONST char *url ));
>
> It IS there!!! Why does it not find it? - This slowly is driving me
> crazy ;- ) It finds the other functions, why not init?
> Or is this message wrong? Should it be "don't know how to handle" or
> "function returned NULL or whatever"?
>
> Anyway I've uploaded config.log to
> https://bugzilla.samba.org/show_bug.cgi?id=10047 . I hope this is ok...
>
>
> How do I set "-lldap -llber" correctly on LDFLAGS?
>
> I have tried with
> export LDFLAGS="-lldap -llber -L/usr/local/samba/samba-4.1.5/lib"
>
> but I can't see any difference. Still the same error: "LDAP support ist not
> available."
>
> Maybe you could also post your build commands for ldap. I still think there
> may be something wrong with it.
>
> Thanks and regards
> Peter
>
>
>
>
> From:   Mike Noonan <mike.p.noonan at gmail.com>
> To:     Peter Waeckerle/Switzerland/IBM at IBMCH
> Cc:     samba-technical at lists.samba.org
> Date:   04.03.2014 16:21
> Subject:        Re: [Samba] how to enable Active Directory support building
>             samba on AIX?
>
>
>
> Hi Peter,
> Could you have a look in bin/config.log and see what the build error is?
> It should find ldap_init
> I'm also on 7.1 ML02 using xlc 12.1
> However I have -lldap -llber set as well on  LDFLAGS
>
>
>
>
>
>
>
>
> On Tue, Mar 4, 2014 at 1:54 PM, Peter Waeckerle <
> peter.waeckerle at ch.ibm.com
> > wrote:
>   Hi
>
>   unfortunatly I connot confirm that this patch works. Inserting the two
>   lines with "headers='ldap.h...' does not make any difference.
>
>   I'm using AIX 7.1 ML02, xlc 12.1.
>
>   First I build openldap 2.4.39 into /usr/local/samba/samba-4.1.5. This
>   seems
>   to work correctly, there is no error with configure and make:
>
>   ./configure --prefix=/usr/local/samba/samba-4.1.5 \
>             --sysconfdir=/usr/local/samba/conf
>   --localstatedir=/var/samba/openldap \
>             --mandir=/usr/local/samba/samba-4.1.5/man --with-threads=no \
>             --enable-null --enable-dnssrv --enable-bdb=no \
>             --enable-static --enable-backends=no
>
>   Then I configure samba with:
>
>   export LDFLAGS=-L/usr/local/samba/samba-4.1.5/lib
>   export CFLAGS=-I/usr/local/samba/samba-4.1.5/include
>
>   waf configure --prefix=/usr/local/samba/samba-4.1.5 \
>             --sysconfdir=/usr/local/samba/conf \
>             --localstatedir=/var/samba/smb \
>             --mandir=/usr/local/samba/samba-4.1.5/man \
>             --with-privatedir=/usr/local/samba/conf \
>             --with-configdir=/usr/local/samba/conf \
>             --with-piddir=/var/samba/smb/pids \
>             --with-logfilebase=/var/samba/smb/logs \
>             --with-ldap \
>             --with-ads
>
>   configure DOES detect the library, it DOES detect the header files and
>   even
>   the variables which it checks are OK. It just DOES NOT detect the init
>   (ialize) functions, although all is present in ldap.h:
>
>   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.
>
>   I suspect the init function somehow is not working correctly, but I don't
>   know how to check.
>
>
>   Regards
>   Peter
>
>
>
>
>   From:   Andrew Bartlett <abartlet at samba.org>
>   To:     Christian Ambach <ambi at samba.org>
>   Cc:     Mike Noonan <mike.p.noonan at gmail.com>,
>               samba-technical at lists.samba.org, Jelmer Vernooij
>               <jelmer at samba.org>, Peter Waeckerle/Switzerland/IBM at IBMCH
>   Date:   03.03.2014 23:12
>   Subject:        Re: [Samba] how to enable Active Directory support
>   building
>               samba on AIX?
>   Sent by:        samba-technical-bounces at lists.samba.org
>
>
>
>   On Mon, 2014-03-03 at 21:55 +0100, Christian Ambach wrote:
>   > Am 03.03.14 03:01, schrieb Andrew Bartlett:
>   > > On Sun, 2014-03-02 at 19:12 +0100, Mike Noonan wrote:
>   > >> Gents,
>   > >> If that's not the way to do things please let me know.
>   > >>
>   > >> I suppose I'll become fairly active on this list as we are busy
>   > >> getting samba 4.1.x to behave on AIX 7.1 using the native compiler.
>   > >>
>   >
>   > Is this the same issue as in Bug 10047?
>   > (https://bugzilla.samba.org/show_bug.cgi?id=10047)
>   >
>   > Maybe the CC list on that bug can help to verify the patch as I do not
>   > have direct access to AIX machines any more and so it becomes kind of
>   > unefficient when making educated guesses and asking somebody else to
>   > verify if the attempt works out or not.
>   >
>   > > Thanks!  Can you add your signed-off-by per
>   > >
>   > > https://wiki.samba.org/index.php/CodeReview
>   > >
>   > > Then I'll just wait on Christian's OK and we can get this merged.
>   > > Thanks for helping to keep Samba portable!
>   >
>   > I can give my ok, but it would be better to have reports from AIX users
>   > that the problem is really solved before we include it.
>
>   Indeed!  I wasn't aware you had moved out of the AIX world.
>
>   Thanks.
>
>   Andrew Bartlett
>
>   --
>   Andrew Bartlett
>   http://samba.org/~abartlet/
>   Authentication Developer, Samba Team  http://samba.org
>   Samba Developer, Catalyst IT
>   http://catalyst.net.nz/services/samba
>
>
>
>
>
>
>
>
>
> --
> Mike Noonan
> Mobile: +31 65 332 9220
> Mike.P.Noonan at gmail.com
>
>


-- 
Mike Noonan
Mobile: +31 65 332 9220
Mike.P.Noonan at gmail.com


More information about the samba-technical mailing list