Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] BR2_PREFER_STATIC_LIB and LDFLAGS+= -static
@ 2012-11-05 16:55 ANDY KENNEDY
  2012-11-05 23:35 ` Arnout Vandecappelle
  2013-01-14 18:51 ` [Buildroot] [PATCH][poke] " ANDY KENNEDY
  0 siblings, 2 replies; 8+ messages in thread
From: ANDY KENNEDY @ 2012-11-05 16:55 UTC (permalink / raw)
  To: buildroot

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>
---
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
 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH] BR2_PREFER_STATIC_LIB and LDFLAGS+= -static
  2012-11-05 16:55 [Buildroot] [PATCH] BR2_PREFER_STATIC_LIB and LDFLAGS+= -static ANDY KENNEDY
@ 2012-11-05 23:35 ` Arnout Vandecappelle
  2012-11-06  7:14   ` Thomas Petazzoni
  2012-11-06 15:06   ` ANDY KENNEDY
  2013-01-14 18:51 ` [Buildroot] [PATCH][poke] " ANDY KENNEDY
  1 sibling, 2 replies; 8+ messages in thread
From: Arnout Vandecappelle @ 2012-11-05 23:35 UTC (permalink / raw)
  To: buildroot

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 at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>

-- 
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH] BR2_PREFER_STATIC_LIB and LDFLAGS+= -static
  2012-11-05 23:35 ` Arnout Vandecappelle
@ 2012-11-06  7:14   ` Thomas Petazzoni
  2012-11-06 15:06   ` ANDY KENNEDY
  1 sibling, 0 replies; 8+ messages in thread
From: Thomas Petazzoni @ 2012-11-06  7:14 UTC (permalink / raw)
  To: 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
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH] BR2_PREFER_STATIC_LIB and LDFLAGS+= -static
  2012-11-05 23:35 ` Arnout Vandecappelle
  2012-11-06  7:14   ` Thomas Petazzoni
@ 2012-11-06 15:06   ` ANDY KENNEDY
  2012-11-06 22:32     ` Arnout Vandecappelle
  1 sibling, 1 reply; 8+ messages in thread
From: ANDY KENNEDY @ 2012-11-06 15:06 UTC (permalink / raw)
  To: buildroot

> 
>   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 at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: buildroot-2012_08.config
Type: application/octet-stream
Size: 25887 bytes
Desc: buildroot-2012_08.config
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20121106/a48d4e15/attachment-0001.obj>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH] BR2_PREFER_STATIC_LIB and LDFLAGS+= -static
  2012-11-06 15:06   ` ANDY KENNEDY
@ 2012-11-06 22:32     ` Arnout Vandecappelle
  0 siblings, 0 replies; 8+ messages in thread
From: Arnout Vandecappelle @ 2012-11-06 22:32 UTC (permalink / raw)
  To: buildroot

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 at 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

-- 
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH][poke] BR2_PREFER_STATIC_LIB and LDFLAGS+= -static
  2012-11-05 16:55 [Buildroot] [PATCH] BR2_PREFER_STATIC_LIB and LDFLAGS+= -static ANDY KENNEDY
  2012-11-05 23:35 ` Arnout Vandecappelle
@ 2013-01-14 18:51 ` ANDY KENNEDY
  2013-01-14 19:36   ` Peter Korsgaard
  1 sibling, 1 reply; 8+ messages in thread
From: ANDY KENNEDY @ 2013-01-14 18:51 UTC (permalink / raw)
  To: buildroot

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 at 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
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH][poke] BR2_PREFER_STATIC_LIB and LDFLAGS+= -static
  2013-01-14 18:51 ` [Buildroot] [PATCH][poke] " ANDY KENNEDY
@ 2013-01-14 19:36   ` Peter Korsgaard
  2013-01-14 19:39     ` ANDY KENNEDY
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Korsgaard @ 2013-01-14 19:36 UTC (permalink / raw)
  To: buildroot

>>>>> "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.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH][poke] BR2_PREFER_STATIC_LIB and LDFLAGS+= -static
  2013-01-14 19:36   ` Peter Korsgaard
@ 2013-01-14 19:39     ` ANDY KENNEDY
  0 siblings, 0 replies; 8+ messages in thread
From: ANDY KENNEDY @ 2013-01-14 19:39 UTC (permalink / raw)
  To: buildroot

> 
> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-01-14 19:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-05 16:55 [Buildroot] [PATCH] BR2_PREFER_STATIC_LIB and LDFLAGS+= -static ANDY KENNEDY
2012-11-05 23:35 ` Arnout Vandecappelle
2012-11-06  7:14   ` Thomas Petazzoni
2012-11-06 15:06   ` ANDY KENNEDY
2012-11-06 22:32     ` Arnout Vandecappelle
2013-01-14 18:51 ` [Buildroot] [PATCH][poke] " ANDY KENNEDY
2013-01-14 19:36   ` Peter Korsgaard
2013-01-14 19:39     ` ANDY KENNEDY

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox