Issue 9228 - libldap depends on liblutil (lutil_memcmp) when cross compiling
Summary: libldap depends on liblutil (lutil_memcmp) when cross compiling
Status: VERIFIED WONTFIX
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: build (show other issues)
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-18 19:40 UTC by Ryan Tandy
Modified: 2020-08-28 22:13 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Ryan Tandy 2020-04-18 19:40:48 UTC
cross-compiling for Unix:

./configure --host=arm-linux-gnueabihf CC=arm-linux-gnueabihf-gcc --with-yielding-select && make

...

libtool: link: arm-linux-gnueabihf-gcc -g -O2 -o ldapurl ldapurl.o lduversion.o  ../../libraries/liblutil/liblutil.a ../../libraries/libldap/.libs/libldap.a /home/ryan/tmp/openldap/libraries/liblber/.libs/liblber.a ../../libraries/liblber/.libs/liblber.a -lresolv
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: ../../libraries/libldap/.libs/libldap.a(os-ip.o): in function `ldap_pvt_is_socket_ready':
/home/ryan/tmp/openldap/libraries/libldap/os-ip.c:248: warning: `sys_errlist' is deprecated; use `strerror' or `strerror_r' instead
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: /home/ryan/tmp/openldap/libraries/libldap/os-ip.c:248: warning: `sys_nerr' is deprecated; use `strerror' or `strerror_r' instead
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: ../../libraries/libldap/.libs/libldap.a(result.o): in function `try_read1msg':
/home/ryan/tmp/openldap/libraries/libldap/result.c:935: undefined reference to `lutil_memcmp'


cross-compiling for Windows:

./configure --host=x86_64-w64-mingw32 CC=x86_64-w64-mingw32-gcc && make

...

libtool: link: x86_64-w64-mingw32-gcc -shared  .libs/bind.o .libs/open.o .libs/result.o .libs/error.o .libs/compare.o .libs/search.o .libs/controls.o .libs/messages.o .libs/references.o .libs/extended.o .libs/cyrus.o .libs/modify.o .libs/add.o .libs/modrdn.o .libs/delete.o .libs/abandon.o .libs/sasl.o .libs/sbind.o .libs/unbind.o .libs/cancel.o .libs/filter.o .libs/free.o .libs/sort.o .libs/passwd.o .libs/whoami.o .libs/vc.o .libs/getdn.o .libs/getentry.o .libs/getattr.o .libs/getvalues.o .libs/addentry.o .libs/request.o .libs/os-ip.o .libs/url.o .libs/pagectrl.o .libs/sortctrl.o .libs/vlvctrl.o .libs/init.o .libs/options.o .libs/print.o .libs/string.o .libs/util-int.o .libs/schema.o .libs/charray.o .libs/os-local.o .libs/dnssrv.o .libs/utf-8.o .libs/utf-8-conv.o .libs/tls2.o .libs/tls_o.o .libs/tls_g.o .libs/tls_m.o .libs/turn.o .libs/ppolicy.o .libs/dds.o .libs/txn.o .libs/ldap_sync.o .libs/stctrl.o .libs/assertion.o .libs/deref.o .libs/ldifutil.o .libs/ldif.o .libs/fetch.o .libs/lbase64.o .libs/msctrl.o .libs/psearchctrl.o .libs/version.o   ../../libraries/liblber/.libs/liblber.dll.a -lregex -lws2_32  -g -O2   -o .libs/libldap.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libldap.dll.a
/usr/bin/x86_64-w64-mingw32-ld: .libs/result.o: in function `try_read1msg':
/home/ryan/tmp/openldap/libraries/libldap/result.c:935: undefined reference to `lutil_memcmp'
/usr/bin/x86_64-w64-mingw32-ld: .libs/dnssrv.o: in function `ldap_dn2domain':
/home/ryan/tmp/openldap/libraries/libldap/dnssrv.c:72: undefined reference to `lutil_memcmp'
/usr/bin/x86_64-w64-mingw32-ld: .libs/ldif.o: in function `ldif_must_b64_encode':
/home/ryan/tmp/openldap/libraries/libldap/ldif.c:426: undefined reference to `lutil_memcmp'
collect2: error: ld returned 1 exit status


More similar issues occur with --enable-dynamic.

Workaround: configure with ac_cv_func_memcmp_working=yes
Comment 1 Ryan Tandy 2020-04-18 20:45:07 UTC
TBH this looks like a general issue to me, I would think the link order should be

$(LDAP_LIBLDAP_LA) $(LDAP_LIBLUTIL_A) $(LDAP_LIBLBER_LA)

everywhere.

Apparently there were/are reasons why libldap shouldn't depend on liblutil though, judging from multiple commits (mostly Ando) avoiding them. Can anyone enlighten me?
Comment 2 Howard Chu 2020-08-28 21:59:58 UTC
(In reply to Ryan Tandy from comment #1)
> TBH this looks like a general issue to me, I would think the link order
> should be
> 
> $(LDAP_LIBLDAP_LA) $(LDAP_LIBLUTIL_A) $(LDAP_LIBLBER_LA)
> 
> everywhere.
> 
> Apparently there were/are reasons why libldap shouldn't depend on liblutil
> though, judging from multiple commits (mostly Ando) avoiding them. Can
> anyone enlighten me?

liblutil is only a static library, you can't link it into a shared library like libldap.
Comment 3 Quanah Gibson-Mount 2020-08-28 22:13:20 UTC
The suggested work around is the solution for this:

Workaround: configure with ac_cv_func_memcmp_working=yes