Message ID | F9C551623D2CBB4C9488801D14F864C628A986@ex-mb1.corp.adtran.com |
---|---|
State | Accepted |
Headers | show |
On 11/05/12 17:55, ANDY KENNEDY wrote: > The following changes LDFLAGS from += -static to += --static if building > with BR2_PREFER_STATIC_LIB so that various components actually build > statically. > > Signed-off-by: Andy Kennedy<andy.kennedy@adtran.com> Although I'm OK with this patch, I have been unable to reproduce the problem and I'd like to know why it is going wrong with -static. Can you post a defconfig that I can rebuild and that exposes the problem? Note: a few autobuilders with BR2_PREFER_STATIC_LIB enabled could be nice - or maybe not, because many packages _will_break. Regards, Arnout > --- > diff -Naur a/package/Makefile.in b/package/Makefile.in > --- a/package/Makefile.in 2012-08-31 03:49:41.000000000 -0500 > +++ b/package/Makefile.in 2012-11-05 10:45:45.000000000 -0600 > @@ -299,7 +299,7 @@ > > ifeq ($(BR2_PREFER_STATIC_LIB),y) > SHARED_STATIC_LIBS_OPTS=--enable-static --disable-shared > -TARGET_LDFLAGS += -static > +TARGET_LDFLAGS += --static > else > SHARED_STATIC_LIBS_OPTS=--enable-static --enable-shared > endif > > _______________________________________________ > buildroot mailing list > buildroot@busybox.net > http://lists.busybox.net/mailman/listinfo/buildroot >
On Tue, 06 Nov 2012 00:35:51 +0100, Arnout Vandecappelle wrote: > Although I'm OK with this patch, I have been unable to reproduce the problem > and I'd like to know why it is going wrong with -static. Can you post a > defconfig that I can rebuild and that exposes the problem? Yes, I also would like more details about why this is needed. I think the TARGET_LDFLAGS thing is currently quite confusing: some packages are using it as flags for gcc at the link stage, some other packages are using it as flags for ld directly. Maybe this is what should be clarified somehow? > Note: a few autobuilders with BR2_PREFER_STATIC_LIB enabled could be nice - > or maybe not, because many packages _will_break. I intended to make my autobuilder script randomly select BR2_PREFER_STATIC_LIB, BR2_CCACHE and a few other "big" options, but until now, I had the feeling that the autobuilder results already provided enough failures to keep us busy :-) Thomas
> > Although I'm OK with this patch, I have been unable to reproduce the problem > and I'd like to know why it is going wrong with -static. Can you post a > defconfig that I can rebuild and that exposes the problem? > > Note: a few autobuilders with BR2_PREFER_STATIC_LIB enabled could be nice - > or maybe not, because many packages _will_break. > > Regards, > Arnout First off, I built again with a clean copy of BuildRoot (2012.08) and produced this output this time: root@akennedy_lin:~/deleteme/buildroot-2012.08# find output/target/ \ -exec file {} \; 2>&1 | grep dynamic | awk -F: '{print $1}' output/target/usr/bin/ldd output/target/usr/bin/htop output/target/usr/bin/getconf output/target/usr/sbin/kdump output/target/usr/sbin/proftpd output/target/sbin/ldconfig Note that htop and proftpd got linked dynamically. The odd part is that kexec built static this time. What's up with that? I repeated this twice and kexec builds static every time. . . though I really thought I did this last week and it was dynamically linked. Perhaps I'm smokin' something. . . BTW, I have _NEVER_ been able to build kdump static through their build. I can reproduce it manually, but there seems to be no way to do it with their current Makefile. Attached is the config file. You may want to change the primary download site as I have it set to ftp://localhost/pub/dl. Andy
On 11/06/12 16:06, ANDY KENNEDY wrote: >> > Although I'm OK with this patch, I have been unable to reproduce the problem >> > and I'd like to know why it is going wrong with -static. Can you post a >> > defconfig that I can rebuild and that exposes the problem? >> > >> > Note: a few autobuilders with BR2_PREFER_STATIC_LIB enabled could be nice - >> > or maybe not, because many packages _will_break. >> > >> > Regards, >> > Arnout > First off, I built again with a clean copy of BuildRoot (2012.08) and > produced this output this time: > > root@akennedy_lin:~/deleteme/buildroot-2012.08# find output/target/ \ > -exec file {} \; 2>&1 | grep dynamic | awk -F: '{print $1}' > output/target/usr/bin/ldd > output/target/usr/bin/htop > output/target/usr/bin/getconf > output/target/usr/sbin/kdump > output/target/usr/sbin/proftpd > output/target/sbin/ldconfig I finally understand what's going on - it's exactly what Andy said in his first mail :-) libtool interpret -static as linking statically with libraries that will not be installed to the libdir; you have to pass it -all-static to force static linking. Or, as Andy proposes, pass --static, which libtool passes on blindly to gcc. gcc and (GNU) ld both interpret --static the same as -static (although this isn't documented). Therefore, this gets my Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Regards, Arnout
All, I just pulled the latest snapshot (buildroot-20130114.tar.bz2), did a quick grep to see if the patch was applied: buildroot/package# grep static * Makefile.in:SHARED_STATIC_LIBS_OPTS=--enable-static --disable-shared Makefile.in:TARGET_LDFLAGS += -static Makefile.in:SHARED_STATIC_LIBS_OPTS=--enable-static --enable-shared pkg-autotools.mk: --enable-shared --disable-static \ and see that it wasn't. Is it on anyone's tree right now or did it get lost in the shuffle? Thanks! Andy > -----Original Message----- > From: ANDY KENNEDY > Sent: Monday, November 05, 2012 10:55 AM > To: 'buildroot@busybox.net' > Subject: [PATCH] BR2_PREFER_STATIC_LIB and LDFLAGS+= -static > > The following changes LDFLAGS from += -static to += --static if building > with BR2_PREFER_STATIC_LIB so that various components actually build > statically. > > Signed-off-by: Andy Kennedy <andy.kennedy@adtran.com> > Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> > --- > diff -Naur a/package/Makefile.in b/package/Makefile.in > --- a/package/Makefile.in 2012-08-31 03:49:41.000000000 -0500 > +++ b/package/Makefile.in 2012-11-05 10:45:45.000000000 -0600 > @@ -299,7 +299,7 @@ > > ifeq ($(BR2_PREFER_STATIC_LIB),y) > SHARED_STATIC_LIBS_OPTS=--enable-static --disable-shared > -TARGET_LDFLAGS += -static > +TARGET_LDFLAGS += --static > else > SHARED_STATIC_LIBS_OPTS=--enable-static --enable-shared > endif >
>>>>> "ANDY" == ANDY KENNEDY <ANDY.KENNEDY@adtran.com> writes:
ANDY> All,
ANDY> I just pulled the latest snapshot (buildroot-20130114.tar.bz2), did a
ANDY> quick grep to see if the patch was applied:
ANDY> buildroot/package# grep static *
ANDY> Makefile.in:SHARED_STATIC_LIBS_OPTS=--enable-static --disable-shared
ANDY> Makefile.in:TARGET_LDFLAGS += -static
ANDY> Makefile.in:SHARED_STATIC_LIBS_OPTS=--enable-static --enable-shared
ANDY> pkg-autotools.mk: --enable-shared --disable-static \
ANDY> and see that it wasn't. Is it on anyone's tree right now or did it
ANDY> get lost in the shuffle?
Committed now with Arnout's explanation about why it is needed. Please
consider documenting WHY a change is needed rather than just what the
change is to get this kind of patches merged faster in the future.
> > Committed now with Arnout's explanation about why it is needed. Please > consider documenting WHY a change is needed rather than just what the > change is to get this kind of patches merged faster in the future. My bad. I'll try to be more verbose next time! Andy > > -- > Bye, Peter Korsgaard
diff -Naur a/package/Makefile.in b/package/Makefile.in --- a/package/Makefile.in 2012-08-31 03:49:41.000000000 -0500 +++ b/package/Makefile.in 2012-11-05 10:45:45.000000000 -0600 @@ -299,7 +299,7 @@ ifeq ($(BR2_PREFER_STATIC_LIB),y) SHARED_STATIC_LIBS_OPTS=--enable-static --disable-shared -TARGET_LDFLAGS += -static +TARGET_LDFLAGS += --static else SHARED_STATIC_LIBS_OPTS=--enable-static --enable-shared endif
The following changes LDFLAGS from += -static to += --static if building with BR2_PREFER_STATIC_LIB so that various components actually build statically. Signed-off-by: Andy Kennedy <andy.kennedy@adtran.com> ---