[sheepdog] [PATCH] sheepfs: add -lpthread to the linker option

MORITA Kazutaka morita.kazutaka at gmail.com
Tue Sep 24 09:54:34 CEST 2013


At Wed, 18 Sep 2013 01:03:27 +0900,
Hitoshi Mitake wrote:
> 
> At Mon, 16 Sep 2013 10:43:24 +0800,
> Liu Yuan wrote:
> > 
> > On Mon, Sep 16, 2013 at 02:09:46AM +0900, Hitoshi Mitake wrote:
> > > At Thu, 12 Sep 2013 10:58:51 +0800,
> > > Liu Yuan wrote:
> > > > 
> > > > On Thu, Sep 12, 2013 at 01:38:38AM +0900, Hitoshi Mitake wrote:
> > > > > Because libsheepdog wraps pthread reader writer lock, the flag is
> > > > > required for building sheepfs too.
> > > > > 
> > > > > Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
> > > > > ---
> > > > >  sheepfs/Makefile.am | 2 +-
> > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > 
> > > > > diff --git a/sheepfs/Makefile.am b/sheepfs/Makefile.am
> > > > > index 10b8c3b..1e571ae 100644
> > > > > --- a/sheepfs/Makefile.am
> > > > > +++ b/sheepfs/Makefile.am
> > > > > @@ -26,7 +26,7 @@ sbin_PROGRAMS		= sheepfs
> > > > >  sheepfs_SOURCES		= core.c cluster.c vdi.c shadow_file.c volume.c node.c \
> > > > >  			  config.c
> > > > >  
> > > > > -sheepfs_LDADD	  	= ../lib/libsheepdog.a $(fuse_LIBS) $(LIBS)
> > > > > +sheepfs_LDADD	  	= ../lib/libsheepdog.a $(fuse_LIBS) $(LIBS) -lpthread
> > > > >  sheepfs_DEPENDENCIES	= ../lib/libsheepdog.a
> > > > >  
> > > > >  noinst_HEADERS		= sheepfs.h
> > > > 
> > > > What does this patch tries to fix? I can complie without problems for sheepfs on
> > > > my box. And you can't?
> > > 
> > > I faced the build error during building sheepfs like this:
> > > 
> > >   CCLD   sheepfs
> > > /usr/bin/ld: volume.o: undefined reference to symbol 'pthread_rwlock_wrlock@@GLIBC_2.2.5'
> > > /usr/bin/ld: note: 'pthread_rwlock_wrlock@@GLIBC_2.2.5' is defined in DSO /lib/x86_64-linux-gnu/libpthread.so.0 so try adding it to the linker command line
> > > /lib/x86_64-linux-gnu/libpthread.so.0: could not read symbols: Invalid operation
> > > collect2: error: ld returned 1 exit status
> > > make[1]: *** [sheepfs] Error 1
> > > 
> > > My environment is Ubuntu 13.04. But I could build sheepfs successfully
> > > on my debian box. I'll seek the root cause of this error and report
> > > later. Please ignore this patch now, sorry.
> > > 
> > 
> > Probably better fix should go add -lpthread in lib/Makefile.am then dog, sheep
> > and others include sheepfs won't need to addit manually.
> 
> OK, I'll refine it and resend tomorrow.

Any progress on this?  I upgraded my ubuntu to 13.04 too, and I cannot
even compile without this patch.

Yuan, how about merging this patch for now, and improving dependency
later?

Thanks,

Kazutaka



More information about the sheepdog mailing list