Parted doesn't compile with LDFLAGS="-Wl,--as-needed", because
libparted.so is not linked to libdl, and thus has unresolved symbols.

mkdir .libs
gcc -D_REENTRANT -D_FILE_OFFSET_BITS=64
-DLOCALEDIR=\"/usr/local/share/locale\"
-DLOCALEDIR=\"/usr/local/share/locale\" -W -Wall -Wno-unused
-Wno-switch -Wno-format -Werror -Wl,--as-needed -o .libs/partprobe
partprobe.o  ../libparted/.libs/libparted.so -luuid -lreadline -ldl
-lncurses ../libparted/.libs/libparted.so: undefined reference to
`dlerror' ../libparted/.libs/libparted.so: undefined reference to
`dlclose' ../libparted/.libs/libparted.so: undefined reference to
`dlopen' ../libparted/.libs/libparted.so: undefined reference to
`dlsym' 
collect2: ld returned 1 exit status 
make[2]: *** [partprobe] Erreur 1 
make[2]: quittant le répertoire « /tmp/parted/partprobe »

This also breaks compilation of other tools (qparted/gparted) with this
linker flag. See this Gentoo bug report:
https://bugs.gentoo.org/show_bug.cgi?id=131841

The attached patch (for today trunk) fixes that by adding the -ldl to
libparted_LIBADD.

-- 
TGL.
--- configure.ac.orig	2006-05-14 14:59:18.857023672 +0200
+++ configure.ac	2006-05-14 15:00:41.899399312 +0200
@@ -197,8 +197,10 @@
 CFLAGS="$CFLAGS -DLOCALEDIR=\"\\\"$datadir/locale\\\"\""
 
 dnl Check for libdl, if we are doing dynamic loading
+DL_LIBS=""
 if test "$enable_dynamic_loading" = yes; then
 	AC_CHECK_LIB(dl, dlopen,
+		DL_LIBS="-ldl"
 		PARTED_LIBS="$PARTED_LIBS -ldl"
 		AC_DEFINE(DYNAMIC_LOADING, 1, [Lazy linking to fs libs]),
 		AC_MSG_ERROR(
@@ -207,6 +209,7 @@
 		exit
 	)
 fi
+AC_SUBST(DL_LIBS)
 
 dnl Check for libuuid
 UUID_LIBS=""
--- libparted/Makefile.am.orig	2006-05-14 15:01:01.223461608 +0200
+++ libparted/Makefile.am	2006-05-14 15:02:40.971297632 +0200
@@ -31,6 +31,7 @@
 				arch/beos.c
 
 libparted_la_LIBADD   = @OS_LIBS@			\
+			@DL_LIBS@			\
 			fs/libfs.la			\
 			labels/liblabels.la
 
_______________________________________________
bug-parted mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-parted

Reply via email to