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

Hitoshi Mitake mitake.hitoshi at gmail.com
Sun Sep 15 19:09:46 CEST 2013


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.

Thanks,
Hitoshi



More information about the sheepdog mailing list