[linux-lvm] [PATCH] Fix static build

Thomas Koeller thomas at koeller.dyndns.org
Sun Aug 28 13:44:43 UTC 2011


I tried a statically-linked build of LVM2.2.02.86 on Linux 3.0 x86_64
using glibc 2.14, binutils 2.21.1, gcc 4.6.1. The linking step failed
because of "-Wl,--export-dynamic" being present in LDFLAGS. This
patch fixes it:

--- LVM2.2.02.86-orig/configure.in	2011-04-28 18:54:33.000000000 +0200
+++ LVM2.2.02.86/configure.in	2011-08-28 15:18:14.000000000 +0200
@@ -34,7 +34,7 @@ case "$host_os" in
 		CLDWHOLEARCHIVE="-Wl,-whole-archive"
 		CLDNOWHOLEARCHIVE="-Wl,-no-whole-archive"
 		LDDEPS="$LDDEPS .export.sym"
-		LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+		DYNAMIC_LDFLAGS="-Wl,--export-dynamic"
 		LIB_SUFFIX=so
 		DEVMAPPER=yes
 		ODIRECT=yes
@@ -49,6 +49,7 @@ case "$host_os" in
 		CLDFLAGS="$CLDFLAGS"
 		CLDWHOLEARCHIVE="-all_load"
 		CLDNOWHOLEARCHIVE=
+		DYNAMIC_LDFLAGS=
 		LIB_SUFFIX=dylib
 		DEVMAPPER=yes
 		ODIRECT=no
@@ -153,6 +154,10 @@ AC_ARG_ENABLE(static_link,
 	      STATIC_LINK=$enableval, STATIC_LINK=no)
 AC_MSG_RESULT($STATIC_LINK)

+if test "$STATIC_LINK" != "yes"; then
+	LDFLAGS="$LDFLAGS $DYNAMIC_LDFLAGS"
+fi
+
 ################################################################################
 dnl -- Prefix is /usr by default, the exec_prefix default is setup later
 AC_PREFIX_DEFAULT(/usr)


Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/linux-lvm/attachments/20110828/90e8dda2/attachment.sig>


More information about the linux-lvm mailing list