unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Andreas Enge <andreas@enge.fr>
Cc: bug-guix@gnu.org
Subject: Re: [PATCH] gnu: Add openldap.
Date: Sat, 26 Jan 2013 23:36:53 +0100	[thread overview]
Message-ID: <87zjzv8tbu.fsf@gnu.org> (raw)
In-Reply-To: <201301262037.22115.andreas@enge.fr> (Andreas Enge's message of "Sat, 26 Jan 2013 20:37:22 +0100")

Andreas Enge <andreas@enge.fr> skribis:

> Attached a patch for openldap, the test phase of which was really tricky.

Builds fine for me when tests are turned off.

> Since there are dynamically linked independent server and client programs, 
> I had to set LD_LIBRARY_PATH.

That’s a problem.  The problem is that the servers/slapd executable ends
up without libdb in its RUNPATH:

--8<---------------cut here---------------start------------->8---
$ objdump -x /tmp/nix-build-openldap-2.4.33.drv-0/openldap-2.4.33/tests/../servers/slapd/slapd |grep RUNPATH
  RUNPATH              /nix/store/n0m40arwkv84ispnah1hma7526bw0llk-cyrus-sasl-2.1.26/lib:/nix/store/9fnjjsbarscbmakr44ixfv9yhg6z12mw-glibc-2.17/lib:/nix/store/lwc6sygaglzfk17v3w15cc2xv97fjgci-gcc-4.7.2/lib64:/nix/store/lwc6sygaglzfk17v3w15cc2xv97fjgci-gcc-4.7.2/lib:/nix/store/b8vagvbwasqwy8wv8545np40ra468c3p-icu4c-50.1.1/lib:/nix/store/ip943rzyiak1k06h7p2srily1wz73hsd-openssl-1.0.1c/lib
--8<---------------cut here---------------end--------------->8---

That binary gets built like this:

--8<---------------cut here---------------start------------->8---
/nix/store/ryk1ywzz31kp4biclxq3yq6hpjycalyy-bash-4.2/bin/sh ../../libtool --mode=link gcc -static -g -O2     -o slapd main.o globals.o bconfig.o config.o daemon.o connection.o search.o filter.o add.o cr.o attr.o entry.o backend.o backends.o result.o operation.o dn.o compare.o modify.o delete.o modrdn.o ch_malloc.o value.o ava.o bind.o unbind.o abandon.o filterentry.o phonetic.o acl.o str2filter.o aclparse.o init.o user.o lock.o controls.o extended.o passwd.o schema.o schema_check.o schema_init.o schema_prep.o schemaparse.o ad.o at.o mr.o syntax.o oc.o saslauthz.o oidm.o starttls.o index.o sets.o referral.o root_dse.o sasl.o module.o mra.o mods.o sl_malloc.o zn_malloc.o limits.o operational.o matchedValues.o cancel.o syncrepl.o backglue.o backover.o ctxcsn.o ldapsync.o frontend.o slapadd.o slapcat.o slapcommon.o slapdn.o slapindex.o slappasswd.o slaptest.o slapauth.o slapacl.o component.o aci.o alock.o txn.o slapschema.o  version.o libbackends.a liboverlays.a ../../libraries/liblunicode/liblunicode.a ../../libraries/librewrite/librewrite.a ../../libraries/liblutil/liblutil.a ../../libraries/libldap_r/libldap_r.la ../../libraries/liblber/liblber.la  -ldb-5.3      -licuuc -licudata -lsasl2  -lssl -lcrypto   -lresolv  -pthread  \
	
mkdir .libs
gcc -g -O2 -o slapd main.o globals.o bconfig.o config.o daemon.o connection.o search.o filter.o add.o cr.o attr.o entry.o backend.o backends.o result.o operation.o dn.o compare.o modify.o delete.o modrdn.o ch_malloc.o value.o ava.o bind.o unbind.o abandon.o filterentry.o phonetic.o acl.o str2filter.o aclparse.o init.o user.o lock.o controls.o extended.o passwd.o schema.o schema_check.o schema_init.o schema_prep.o schemaparse.o ad.o at.o mr.o syntax.o oc.o saslauthz.o oidm.o starttls.o index.o sets.o referral.o root_dse.o sasl.o module.o mra.o mods.o sl_malloc.o zn_malloc.o limits.o operational.o matchedValues.o cancel.o syncrepl.o backglue.o backover.o ctxcsn.o ldapsync.o frontend.o slapadd.o slapcat.o slapcommon.o slapdn.o slapindex.o slappasswd.o slaptest.o slapauth.o slapacl.o component.o aci.o alock.o txn.o slapschema.o version.o -pthread  libbackends.a liboverlays.a ../../libraries/liblunicode/liblunicode.a ../../libraries/librewrite/librewrite.a ../../libraries/liblutil/liblutil.a ../../libraries/libldap_r/.libs/libldap_r.a /tmp/nix-build-openldap-2.4.33.drv-0/openldap-2.4.33/libraries/liblber/.libs/liblber.a ../../libraries/liblber/.libs/liblber.a /nix/store/c6hmllvdzgphyfb9pwaad42mzdf3kx8w-bdb-5.3.21/lib/libdb-5.3.so -lpthread -licuuc -licudata /nix/store/n0m40arwkv84ispnah1hma7526bw0llk-cyrus-sasl-2.1.26/lib/libsasl2.so -ldl -lssl -lcrypto -lresolv -pthread -Wl,--rpath -Wl,/nix/store/n0m40arwkv84ispnah1hma7526bw0llk-cyrus-sasl-2.1.26/lib -Wl,--rpath -Wl,/nix/store/n0m40arwkv84ispnah1hma7526bw0llk-cyrus-sasl-2.1.26/lib
--8<---------------cut here---------------end--------------->8---

As you can see, libtool replaced -ldb-5.3 by the corresponding absolute
file name.

However, our ld-wrapper only adds to the RUNPATH directories when they
contain libraries passed via -l.  We can fix that eventually, but that’s
not the problem here.

Here’s a hint:

--8<---------------cut here---------------start------------->8---
$ /tmp/nix-build-openldap-2.4.33.drv-0/openldap-2.4.33/libtool --version
ltmain.sh (GNU libtool) 1.5.22-OpenLDAP (1.1220.2.365 2005/12/18 22:14:06)
--8<---------------cut here---------------end--------------->8---

This is not only old, but also hacked in unknown ways.

So, here’s what I tried:

--8<---------------cut here---------------start------------->8---
[ludo@pluto:/tmp/nix-build-openldap-2.4.33.drv-0/openldap-2.4.33]$ cp `type -P libtool` .

[ludo@pluto:/tmp/nix-build-openldap-2.4.33.drv-0/openldap-2.4.33]$ ./libtool --version
libtool (GNU libtool) 2.4.2
Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996

Copyright (C) 2011 Free Software Foundation, Inc.  
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[ludo@pluto:/tmp/nix-build-openldap-2.4.33.drv-0/openldap-2.4.33]$ bash

[ludo@pluto:/tmp/nix-build-openldap-2.4.33.drv-0/openldap-2.4.33]$ source ../environment-variables
[ludo@pluto:/tmp/nix-build-openldap-2.4.33.drv-0]$ rm servers/slapd/slapd

[ludo@pluto:/tmp/nix-build-openldap-2.4.33.drv-0]$ make -C servers/slapd/

[...]

/nix/store/ryk1ywzz31kp4biclxq3yq6hpjycalyy-bash-4.2/bin/sh ../../libtool --mode=link gcc -static -g -O2     -o slapd main.o globals.o bconfig.o config.o daemon.o connection.o search.o filter.o add.o cr.o attr.o entry.o backend.o backends.o result.o operation.o dn.o compare.o modify.o delete.o modrdn.o ch_malloc.o value.o ava.o bind.o unbind.o abandon.o filterentry.o phonetic.o acl.o str2filter.o aclparse.o init.o user.o lock.o controls.o extended.o passwd.o schema.o schema_check.o schema_init.o schema_prep.o schemaparse.o ad.o at.o mr.o syntax.o oc.o saslauthz.o oidm.o starttls.o index.o sets.o referral.o root_dse.o sasl.o module.o mra.o mods.o sl_malloc.o zn_malloc.o limits.o operational.o matchedValues.o cancel.o syncrepl.o backglue.o backover.o ctxcsn.o ldapsync.o frontend.o slapadd.o slapcat.o slapcommon.o slapdn.o slapindex.o slappasswd.o slaptest.o slapauth.o slapacl.o component.o aci.o alock.o txn.o slapschema.o  version.o libbackends.a liboverlays.a ../../libraries/liblunicode/liblunicode.a ../../libraries/librewrite/librewrite.a ../../libraries/liblutil/liblutil.a ../../libraries/libldap_r/libldap_r.la ../../libraries/liblber/liblber.la  -ldb-5.3      -licuuc -licudata -lsasl2  -lssl -lcrypto   -lresolv  -pthread  \

libtool: link: gcc -g -O2 -o slapd main.o globals.o bconfig.o config.o daemon.o connection.o search.o filter.o add.o cr.o attr.o entry.o backend.o backends.o result.o operation.o dn.o compare.o modify.o delete.o modrdn.o ch_malloc.o value.o ava.o bind.o unbind.o abandon.o filterentry.o phonetic.o acl.o str2filter.o aclparse.o init.o user.o lock.o controls.o extended.o passwd.o schema.o schema_check.o schema_init.o schema_prep.o schemaparse.o ad.o at.o mr.o syntax.o oc.o saslauthz.o oidm.o starttls.o index.o sets.o referral.o root_dse.o sasl.o module.o mra.o mods.o sl_malloc.o zn_malloc.o limits.o operational.o matchedValues.o cancel.o syncrepl.o backglue.o backover.o ctxcsn.o ldapsync.o frontend.o slapadd.o slapcat.o slapcommon.o slapdn.o slapindex.o slappasswd.o slaptest.o slapauth.o slapacl.o component.o aci.o alock.o txn.o slapschema.o version.o -pthread  libbackends.a liboverlays.a ../../libraries/liblunicode/liblunicode.a ../../libraries/librewrite/librewrite.a ../../libraries/liblutil/liblutil.a ../../libraries/libldap_r/.libs/libldap_r.a /tmp/nix-build-openldap-2.4.33.drv-0/openldap-2.4.33/libraries/liblber/.libs/liblber.a ../../libraries/liblber/.libs/liblber.a -ldb-5.3 -licuuc -licudata /nix/store/n0m40arwkv84ispnah1hma7526bw0llk-cyrus-sasl-2.1.26/lib/libsasl2.so -ldl -lssl -lcrypto -lresolv -pthread -Wl,-rpath -Wl,/nix/store/n0m40arwkv84ispnah1hma7526bw0llk-cyrus-sasl-2.1.26/lib -Wl,-rpath -Wl,/nix/store/n0m40arwkv84ispnah1hma7526bw0llk-cyrus-sasl-2.1.26/lib
rm -f slapadd slapcat slapdn slapindex slappasswd slaptest slapauth slapacl slapschema
--8<---------------cut here---------------end--------------->8---

Surprise, -ldb5.3 is used now, and thus it ends up in the RPATH.

So I would suggest adding Libtool/bin as an input, and adding a phase
that does (copy-file (which "libtool") "libtool") right after ‘configure’.

> Still, one test failed, but not all the time: It succeeded once when
> run in the build tree. So I took it out. Even then, some test fails
> from time to time; sometimes after an hour of different tests passing,
> sometimes after 15 minutes.

Did you check whether it does DNS lookups or similar?

If it turns out to be this unreliable, then yes, it’s safer to disable
them.

Thanks,
Ludo’.

  reply	other threads:[~2013-01-26 22:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-26 19:37 [PATCH] gnu: Add openldap Andreas Enge
2013-01-26 22:36 ` Ludovic Courtès [this message]
2013-01-29 18:58   ` Andreas Enge
2013-01-29 20:44     ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zjzv8tbu.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=andreas@enge.fr \
    --cc=bug-guix@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).