[Ocfs2-tools-devel] [RFC] is it necessary to link libcom_err with -lpthread ?

Coly Li coly.li at suse.de
Wed Nov 4 10:37:11 PST 2009


Today when I try to compile ocfs2-tools code on my newly installed openSUSE 11.2-RC2, I encounter link errors from
libcom_err, like this,

../libo2dlm/libo2dlm.a(o2dlm.o): In function `load_fsdlm':
/home/coly/source/ocfs2-tree/ocfs2-tools/libo2dlm/o2dlm.c:716: warning: Using 'dlopen' in statically linked applications
requires at runtime the shared libraries from the glibc version used for linking
/usr/lib64/gcc/x86_64-suse-linux/4.4/../../../../lib64/libcom_err.a(error_message.o): In function `fini_et_lock':
/usr/src/packages/BUILD/e2fsprogs-1.41.9/lib/et/error_message.c:74: undefined reference to `sem_destroy'
/usr/lib64/gcc/x86_64-suse-linux/4.4/../../../../lib64/libcom_err.a(error_message.o): In function `setup_et_lock':
/usr/src/packages/BUILD/e2fsprogs-1.41.9/lib/et/error_message.c:68: undefined reference to `sem_init'
/usr/lib64/gcc/x86_64-suse-linux/4.4/../../../../lib64/libcom_err.a(error_message.o): In function `et_list_unlock':
/usr/src/packages/BUILD/e2fsprogs-1.41.9/lib/et/error_message.c:95: undefined reference to `sem_post'
/usr/lib64/gcc/x86_64-suse-linux/4.4/../../../../lib64/libcom_err.a(error_message.o): In function `et_list_lock':
/usr/src/packages/BUILD/e2fsprogs-1.41.9/lib/et/error_message.c:85: undefined reference to `sem_wait'
collect2: ld returned 1 exit status
make[1]: *** [fsck.ocfs2] Error 1
make[1]: Leaving directory `/home/coly/source/ocfs2-tree/ocfs2-tools/fsck.ocfs2'

the libcom_err version is libbz2-devel-1.0.5-36.6 (from openSUSE 11.2-RC2 update source). It seems libcom_err referenced
symbols from libpthread, but I don't have idea why autoconf/automake can not resolve the dependence automatically.

I try to write a patch to add -lpthread to the necessary places to fix the compiling error. But I know a correct fix
might be in configure or configure.in. I tried to figure out the correct method to fix, but still not find yet,
1) Do we need to add -lpthread on the places from the patch ?
2) If YES, I wish some one can help me to post a correct patch (maybe modify configure/configure.in) to fix the building
issue.

Thanks in advance.

Signed-off-by: Coly Li <coly.li at suse.de>
---
diff --git a/fsck.ocfs2/Makefile b/fsck.ocfs2/Makefile
index aa3e79e..dbffdbb 100644
--- a/fsck.ocfs2/Makefile
+++ b/fsck.ocfs2/Makefile
@@ -68,7 +68,7 @@ dist-subdircreate:
 	$(TOPDIR)/mkinstalldirs $(DIST_DIR)/include

 fsck.ocfs2: $(OBJS) $(LIBOCFS2_DEPS) $(LIBO2DLM_DEPS) $(LIBO2CB_DEPS)
-	$(LINK) $(LIBOCFS2_LIBS) $(LIBO2DLM_LIBS) $(LIBO2CB_LIBS) $(COM_ERR_LIBS)
+	$(LINK) $(LIBOCFS2_LIBS) $(LIBO2DLM_LIBS) $(LIBO2CB_LIBS) $(COM_ERR_LIBS)

 $(OBJS): prompt-codes.h

diff --git a/o2cb_ctl/Makefile b/o2cb_ctl/Makefile
index d2710e6..d6bf610 100644
--- a/o2cb_ctl/Makefile
+++ b/o2cb_ctl/Makefile
@@ -40,6 +40,6 @@ o2cb_config_CPPFLAGS = $(GLIB_CFLAGS) -DG_DISABLE_DEPRECATED
 o2cb_ctl_CPPFLAGS = $(GLIB_CFLAGS) -DG_DISABLE_DEPRECATED

 o2cb_ctl: $(O2CB_CTL_OBJS) $(LIBOCFS2_DEPS) $(LIBO2CB_DEPS)
-	$(LINK) $(LIBO2CB_LIBS) $(GLIB_LIBS) $(LIBOCFS2_LIBS) $(COM_ERR_LIBS)
+	$(LINK) $(LIBO2CB_LIBS) $(GLIB_LIBS) $(LIBOCFS2_LIBS) $(COM_ERR_LIBS) -lpthread

 include $(TOPDIR)/Postamble.make
diff --git a/ocfs2_hb_ctl/Makefile b/ocfs2_hb_ctl/Makefile
index 0e1f583..831b253 100644
--- a/ocfs2_hb_ctl/Makefile
+++ b/ocfs2_hb_ctl/Makefile
@@ -32,6 +32,6 @@ DIST_FILES = $(CFILES) $(HFILES) ocfs2_hb_ctl.8.in
 all: ocfs2_hb_ctl

 ocfs2_hb_ctl: $(OBJS) $(LIBOCFS2_DEPS) $(LIBO2DLM_DEPS) $(LIBO2CB_DEPS)
-	$(LINK) $(LIBOCFS2_LIBS) $(LIBO2DLM_LIBS) $(LIBO2CB_LIBS) $(COM_ERR_LIBS)
+	$(LINK) $(LIBOCFS2_LIBS) $(LIBO2DLM_LIBS) $(LIBO2CB_LIBS) $(COM_ERR_LIBS) -lpthread

 include $(TOPDIR)/Postamble.make

-- 
Coly Li
SuSE Labs



More information about the Ocfs2-tools-devel mailing list