slibtool: 15903b7 openldap: https://git.openldap.org/openldap/openldap/-/commit/c6e521fa98f65f9bc54953df1b5fb8628577a452
When building a shared openldap.
./configure --disable-static
It will still build a few libraries explicitly as static by setting --tag=disable-shared. Additionally specific parts of the code base can be set to build statically by setting the appropriate configure arguments even with --disable-static.
--tag=disable-shared
--disable-static
This fails in slibtool.
rdlibtool --tag=disable-shared --mode=compile cc -g -O2 -I../../../include -I../../../include -I.. -I./.. -c version.c rdlibtool: lconf: {.name="libtool"}. rdlibtool: fdcwd: {.fdcwd=AT_FDCWD, .realpath="/tmp/openldap/servers/slapd/back-ldif"}. rdlibtool: lconf: fstatat(AT_FDCWD,".",...) = 0 {.st_dev = 45, .st_ino = 121396}. rdlibtool: lconf: openat(AT_FDCWD,"libtool",O_RDONLY,0) = -1 [ENOENT]. rdlibtool: lconf: openat(AT_FDCWD,"../",O_DIRECTORY,0) = 3. rdlibtool: lconf: fstat(3,...) = 0 {.st_dev = 45, .st_ino = 121357}. rdlibtool: lconf: openat(3,"libtool",O_RDONLY,0) = -1 [ENOENT]. rdlibtool: lconf: openat(3,"../",O_DIRECTORY,0) = 4. rdlibtool: lconf: fstat(4,...) = 0 {.st_dev = 45, .st_ino = 121355}. rdlibtool: lconf: openat(4,"libtool",O_RDONLY,0) = -1 [ENOENT]. rdlibtool: lconf: openat(4,"../",O_DIRECTORY,0) = 3. rdlibtool: lconf: fstat(3,...) = 0 {.st_dev = 45, .st_ino = 120454}. rdlibtool: lconf: openat(3,"libtool",O_RDONLY,0) = 4. rdlibtool: lconf: found "/tmp/openldap/libtool". ar ruv libback_ldif.a `echo ldif.lo | sed 's/\.lo/.o/g'` version.o ar: creating libback_ldif.a ar: ldif.o: No such file or directory make[3]: *** [Makefile:341: libback_ldif.a] Error 1 make[3]: Leaving directory '/tmp/openldap/servers/slapd/back-ldif' make[2]: *** [Makefile:547: .backend] Error 1 make[2]: Leaving directory '/tmp/openldap/servers/slapd' make[1]: *** [Makefile:295: all-common] Error 1 make[1]: Leaving directory '/tmp/openldap/servers' make: *** [Makefile:316: all-common] Error 1
But can it will then build if -static is also added on top of --tag=disable-shared as done in this patch which GNU libtool also accepts.
-static
diff --git a/build/top.mk b/build/top.mk index f542ded..f07ff77 100644 --- a/build/top.mk +++ b/build/top.mk @@ -86,6 +86,11 @@ LTONLY_yes = --tag=disable-shared LTONLY_mod = --tag=disable-static LTONLY_MOD = $(LTONLY_$(BUILD_MOD)) +# static flag for modules +STATIC_yes = -static +STATIC_mod = +STATIC_MOD = $(STATIC_$(BUILD_MOD)) + # platform-specific libtool flags NT_LTFLAGS_LIB = -no-undefined -avoid-version -rpath $(libdir) NT_LTFLAGS_MOD = -no-undefined -avoid-version -rpath $(moduledir) @@ -116,7 +121,7 @@ LTLINK_LIB = $(LIBTOOL) $(LTONLY_LIB) --mode=link \ $(CC) $(LT_CFLAGS) $(LDFLAGS) $(LTFLAGS_LIB) LTCOMPILE_MOD = $(LIBTOOL) $(LTONLY_MOD) --mode=compile \ - $(CC) $(LT_CFLAGS) $(LT_CPPFLAGS) $(MOD_DEFS) -c + $(CC) $(STATIC_MOD) $(LT_CFLAGS) $(LT_CPPFLAGS) $(MOD_DEFS) -c LTLINK_MOD = $(LIBTOOL) $(LTONLY_MOD) --mode=link \ $(CC) $(LT_CFLAGS) $(LDFLAGS) $(LTFLAGS_MOD)
However should this be required? I could not find much documentation on --tag=disable-shared, but reading the libtool shell script shows:
# The TAGs below are defined such that we never get into a situation # where we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared
And above that:
# Whether or not to build static libraries. build_old_libs=no # Whether or not to build shared libraries. build_libtool_libs=yes
So should --tag=disable-shared be enough in this case? Or should I look into upstreaming the patch to openldap?
Thanks for spotting this semantic discrepancy, fixed in 9582b24. As of commit c9788a2, the counterpart discrepancy (involving ./configure --disable-shared and --tag=disable-static) has been fixed as well.
Seems fixed with the gentoo ebuild too. :)
Metadata Update from @orbea: - Issue status updated to: Closed (was: Open)
Login to comment on this ticket.