Sunday, May 26, 2013

Cross-compiling openldap on Debian Wheezy

Notes on problems cross-compiling openldap on Debian Wheezy and how I overcome some of the problems. I was trying to build smbkrb5pwd into openldap.
  • Problem: setting up build prerequisites:
    • Use emdebian gcc-4.4-arm-linux-gnueabi toolchain.
    • Use xapt -a armel -m <builddep> and xdeb.
  • Problem: configure couldn't find gnutls or some other dependencies.
    • Solution: use xapt -a armel -m <package> to install them (-m is for multiarch, which only works on Wheezy). Then xdeb -aarmel openldap should build it from local source.
  • Problem: libtool link complained about "liblutil.a: could not read symbols: Archive has no index; run ranlib to add one"
    • Solution: change and replace AC_CHECK_PROGS with AC_CHECK_TOOLS.  Rerun autoreconf.
  • Problem: unresolved external symbol lutil_memcmp ...
    • Solution: the library order in several and build/ are messed up. Reorder so that $(LDAP_LIBLUTIL_A) comes after $(LDAP_LIBLDAP_R_LA) or $(LDAP_LIBLDAP_LA).
  • Problem: /usr/arm-linux-gnueabi/lib/ No such file or directory
    • Solution: the specified the wrong directory ... dpkg-cross has it installed under /usr/arm-linux-gnueabi/lib/heimdal instead. Either symlink the .so or modify the .la.
  • Problem: contrib/.../Makefile sets CC=gcc.
    • Solution: in debian/rules, override in the command line like this: $(MAKE) -C ... CC=$(DEB_HOST_MULTIARCH)-gcc
  • Problem: dpkg-cross on libkrb5-dev removes /usr/arm-linux-gnueabi/lib/mit-krb5/...
    • I give up. There's gotta be a gooder way to do this...
It turns out that building smbkrb5pwd into openldap is a bad idea. It requires krb5 as a dependency, but krb5 requires libldap-dev provided by openldap, which means it a recursive dependency. Rather than putting smbkrb5pwd into the contrib package, the right way seems to be building it standalone.
Post a Comment