[sheepdog] [PATCH] sheepfs: add -lpthread to the linker option
Hitoshi Mitake
mitake.hitoshi at gmail.com
Wed Sep 25 16:54:41 CEST 2013
At Tue, 24 Sep 2013 16:02:46 +0800,
YunQiang Su wrote:
>
> On Tue, Sep 24, 2013 at 3:54 PM, MORITA Kazutaka
> <morita.kazutaka at gmail.com> wrote:
> > 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.
> Why Debian Sid successfully build?
> It must be a bug of gcc of Debian.
I agree, it seems that we've depende on bugs or version-dependent
behavior of ld or related tools.
Thanks,
Hitoshi
More information about the sheepdog
mailing list