Message ID | 20130128170500.GC16977@twin.jikos.cz (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, Jan 28, 2013 at 06:05:00PM +0100, David Sterba wrote: > On Sat, Jan 26, 2013 at 01:09:47AM +0100, Ian Kumlien wrote: > > Sometimes, when you least expect it, a static binary is what you need to > > rescue your data... Or just get a good enough handle on things to make > > it work again ;) > > > > "make static" is a gift to you, dear user with filesystem problems! > > Adding the build target does not cost us anything. The result depends on the > distro and set of the needed libraries provided for a static build. Even > the basic 'btrfs' too needs uuid (due to cmds-receive) and I don't have > it in my distro. The other utilities may need static zlib or lzo > (restore) or libblkid (mkfs.btrfs). Yes, this is all part of the static package... > I tried to build 'btrfs' only and moved the static libs definition to > the beginning (still needs the uuid static library though): Which you haven't included - you sould also include btrfsck at bare minimum ;) > --- a/Makefile > +++ b/Makefile > @@ -19,6 +19,7 @@ prefix ?= /usr/local > bindir = $(prefix)/bin > LIBS=-luuid -lm > RESTORE_LIBS=-lz > +STATIC_LIBS= -lpthread > > progs = btrfsctl mkfs.btrfs btrfs-debug-tree btrfs-show btrfs-vol btrfsck \ > btrfs btrfs-map-logical btrfs-image btrfs-zero-log btrfs-convert \ > @@ -117,4 +118,9 @@ install: $(progs) install-man > $(INSTALL) -m755 -d $(DESTDIR)$(bindir) > $(INSTALL) $(progs) $(DESTDIR)$(bindir) > > +static: CFLAGS += -static > +static: LIBS = $(STATIC_LIBS) I think you mean += since this will not build since it misses libuuid If you don't have the libs to do a static build - that is one thing but it should work =) > +static: version btrfs -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Jan 28, 2013 at 07:41:01PM +0100, Ian Kumlien wrote: > > I tried to build 'btrfs' only and moved the static libs definition to > > the beginning (still needs the uuid static library though): > > Which you haven't included - you sould also include btrfsck at bare > minimum ;) > > > --- a/Makefile > > +++ b/Makefile > > @@ -19,6 +19,7 @@ prefix ?= /usr/local > > +STATIC_LIBS= -lpthread > > +static: CFLAGS += -static > > +static: LIBS = $(STATIC_LIBS) > > I think you mean += since this will not build since it misses libuuid > > If you don't have the libs to do a static build - that is one thing but > it should work =) Resume: if the distro contains all required libs as static, then your patch works. I wanted to get an idea how the static build would go so my patch was a dirty workaroud, that did not work in the end anyway. david -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Jan 28, 2013 at 10:46:51PM +0100, David Sterba wrote: > On Mon, Jan 28, 2013 at 07:41:01PM +0100, Ian Kumlien wrote: > > > I tried to build 'btrfs' only and moved the static libs definition to > > > the beginning (still needs the uuid static library though): > > > > Which you haven't included - you sould also include btrfsck at bare > > minimum ;) > > > > > --- a/Makefile > > > +++ b/Makefile > > > @@ -19,6 +19,7 @@ prefix ?= /usr/local > > > +STATIC_LIBS= -lpthread > > > +static: CFLAGS += -static > > > +static: LIBS = $(STATIC_LIBS) > > > > I think you mean += since this will not build since it misses libuuid > > > > If you don't have the libs to do a static build - that is one thing but > > it should work =) > > Resume: if the distro contains all required libs as static, then your > patch works. Yeah... But if it's shipped in a dist i assume they will create static versions and srip them, just like it seems that other dists does. > I wanted to get an idea how the static build would go so my patch > was a dirty workaroud, that did not work in the end anyway. =) I was a bit confused about it - but you are right, 'btrfs' and 'btrfsck' is the only two we really need to have as static... > david -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Jan 28, 2013 at 10:46:51PM +0100, David Sterba wrote: > Resume: if the distro contains all required libs as static, then your > patch works. > > I wanted to get an idea how the static build would go so my patch > was a dirty workaroud, that did not work in the end anyway. To reiterate: ldd btrfs btrfsck btrfs: not a dynamic executable btrfsck: not a dynamic executable du -sh btrfs btrfsck 2,4M btrfs 2,1M btrfsck strip btrfs strip btrfsck du -sh btrfs btrfsck 1,1M btrfs 904K btrfsck --- And now dynamic: du -sh btrfs btrfsck 1,5M btrfs 1,3M btrfsck strip btrfsck ; strip btrfs du -sh btrfs btrfsck 232K btrfs 156K btrfsck --- This means that dists are striping binaries... In which case it would be no problem to have then build the static target, perhaps we could try to verify if they are available and build btrfs.static and btrfsck.static if possible.... (I'm using: 64 bit - gcc 4.7.2) -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Jan 29, 2013 at 12:31:53AM +0100, Ian Kumlien wrote: > This means that dists are striping binaries... > In which case it would be no problem to have then build the static target, > perhaps we could try to verify if they are available and build btrfs.static > and btrfsck.static if possible.... I like that, keeping the .static versions along the dynamic ones, just for the rescue purposes. (And to reduce the total file size even further merge the fsck functionlity into 'btrfs', but this is not a primary goal now.) david -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
--- a/Makefile +++ b/Makefile @@ -19,6 +19,7 @@ prefix ?= /usr/local bindir = $(prefix)/bin LIBS=-luuid -lm RESTORE_LIBS=-lz +STATIC_LIBS= -lpthread progs = btrfsctl mkfs.btrfs btrfs-debug-tree btrfs-show btrfs-vol btrfsck \ btrfs btrfs-map-logical btrfs-image btrfs-zero-log btrfs-convert \ @@ -117,4 +118,9 @@ install: $(progs) install-man $(INSTALL) -m755 -d $(DESTDIR)$(bindir) $(INSTALL) $(progs) $(DESTDIR)$(bindir) +static: CFLAGS += -static +static: LIBS = $(STATIC_LIBS) +static: version btrfs -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html