Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] musl: Honor BR2_STATIC_LIBS / BR2_SHARED_LIBS
@ 2015-10-14  4:29 Charles Duffy
  2015-10-14 21:35 ` Thomas Petazzoni
  2015-10-18 13:09 ` Thomas Petazzoni
  0 siblings, 2 replies; 10+ messages in thread
From: Charles Duffy @ 2015-10-14  4:29 UTC (permalink / raw)
  To: buildroot

From: Charles Duffy <charles@dyfis.net>

Signed-off-by: Charles Duffy <chaduffy@cisco.com>
---
 package/musl/musl.mk | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/package/musl/musl.mk b/package/musl/musl.mk
index 22589f5..aca78ab 100644
--- a/package/musl/musl.mk
+++ b/package/musl/musl.mk
@@ -28,7 +28,9 @@ define MUSL_CONFIGURE_CMDS
 			--host=$(GNU_TARGET_NAME) \
 			--prefix=/usr \
 			--libdir=/lib \
-			--disable-gcc-wrapper)
+			--disable-gcc-wrapper \
+			$(if $(BR2_STATIC_LIBS),--disable-shared) \
+			$(if $(BR2_SHARED_LIBS),--disable-static))
 endef
 
 define MUSL_BUILD_CMDS
-- 
2.0.0

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

* [Buildroot] [PATCH 1/1] musl: Honor BR2_STATIC_LIBS / BR2_SHARED_LIBS
  2015-10-14  4:29 [Buildroot] [PATCH 1/1] musl: Honor BR2_STATIC_LIBS / BR2_SHARED_LIBS Charles Duffy
@ 2015-10-14 21:35 ` Thomas Petazzoni
  2015-10-14 22:23   ` Charles Duffy
  2015-10-18 13:09 ` Thomas Petazzoni
  1 sibling, 1 reply; 10+ messages in thread
From: Thomas Petazzoni @ 2015-10-14 21:35 UTC (permalink / raw)
  To: buildroot

Charles,

On Tue, 13 Oct 2015 23:29:37 -0500, Charles Duffy wrote:
> From: Charles Duffy <charles@dyfis.net>
> 
> Signed-off-by: Charles Duffy <chaduffy@cisco.com>

Thanks for the patch!

> diff --git a/package/musl/musl.mk b/package/musl/musl.mk
> index 22589f5..aca78ab 100644
> --- a/package/musl/musl.mk
> +++ b/package/musl/musl.mk
> @@ -28,7 +28,9 @@ define MUSL_CONFIGURE_CMDS
>  			--host=$(GNU_TARGET_NAME) \
>  			--prefix=/usr \
>  			--libdir=/lib \
> -			--disable-gcc-wrapper)
> +			--disable-gcc-wrapper \
> +			$(if $(BR2_STATIC_LIBS),--disable-shared) \
> +			$(if $(BR2_SHARED_LIBS),--disable-static))

Could you instead try the following change:

-			--disable-gcc-wrapper)
+			--disable-gcc-wrapper \
+			$(SHARED_STATIC_LIBS_OPTS))


The SHARED_STATIC_LIBS_OPTS variable, defined in package/Makefile.in,
already contains the right combination of
--{enable,disable}-{static,shared} depending on BR2_STATIC_LIBS,
BR2_SHARED_LIBS and BR2_STATIC_SHARED_LIBS.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 1/1] musl: Honor BR2_STATIC_LIBS / BR2_SHARED_LIBS
  2015-10-14 21:35 ` Thomas Petazzoni
@ 2015-10-14 22:23   ` Charles Duffy
  2015-10-15  7:38     ` Thomas Petazzoni
  0 siblings, 1 reply; 10+ messages in thread
From: Charles Duffy @ 2015-10-14 22:23 UTC (permalink / raw)
  To: buildroot

On Wed, Oct 14, 2015 at 4:35 PM Thomas Petazzoni <
thomas.petazzoni@free-electrons.com> wrote:

> Could you instead try the following change:
>
> -                       --disable-gcc-wrapper)
> +                       --disable-gcc-wrapper \
> +                       $(SHARED_STATIC_LIBS_OPTS))
>
>
Works perfectly. Should I bother resubmitting, or are you inclined to make
the change directly?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20151014/c6a2d855/attachment.html>

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

* [Buildroot] [PATCH 1/1] musl: Honor BR2_STATIC_LIBS / BR2_SHARED_LIBS
  2015-10-14 22:23   ` Charles Duffy
@ 2015-10-15  7:38     ` Thomas Petazzoni
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas Petazzoni @ 2015-10-15  7:38 UTC (permalink / raw)
  To: buildroot

Charles,

On Wed, 14 Oct 2015 22:23:12 +0000, Charles Duffy wrote:
> On Wed, Oct 14, 2015 at 4:35 PM Thomas Petazzoni <
> thomas.petazzoni at free-electrons.com> wrote:
> 
> > Could you instead try the following change:
> >
> > -                       --disable-gcc-wrapper)
> > +                       --disable-gcc-wrapper \
> > +                       $(SHARED_STATIC_LIBS_OPTS))
> >
> >
> Works perfectly. Should I bother resubmitting, or are you inclined to make
> the change directly?

I did the change and applied. See
http://git.buildroot.net/buildroot/commit/?id=bb41933d3642f44c8d2db07886b2e5bf18b97fad.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 1/1] musl: Honor BR2_STATIC_LIBS / BR2_SHARED_LIBS
  2015-10-14  4:29 [Buildroot] [PATCH 1/1] musl: Honor BR2_STATIC_LIBS / BR2_SHARED_LIBS Charles Duffy
  2015-10-14 21:35 ` Thomas Petazzoni
@ 2015-10-18 13:09 ` Thomas Petazzoni
  2015-10-18 15:58   ` Yann E. MORIN
  1 sibling, 1 reply; 10+ messages in thread
From: Thomas Petazzoni @ 2015-10-18 13:09 UTC (permalink / raw)
  To: buildroot

Charles, Peter, Arnout, Yann,

On Tue, 13 Oct 2015 23:29:37 -0500, Charles Duffy wrote:
> From: Charles Duffy <charles@dyfis.net>
> 
> Signed-off-by: Charles Duffy <chaduffy@cisco.com>
> ---
>  package/musl/musl.mk | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/package/musl/musl.mk b/package/musl/musl.mk
> index 22589f5..aca78ab 100644
> --- a/package/musl/musl.mk
> +++ b/package/musl/musl.mk
> @@ -28,7 +28,9 @@ define MUSL_CONFIGURE_CMDS
>  			--host=$(GNU_TARGET_NAME) \
>  			--prefix=/usr \
>  			--libdir=/lib \
> -			--disable-gcc-wrapper)
> +			--disable-gcc-wrapper \
> +			$(if $(BR2_STATIC_LIBS),--disable-shared) \
> +			$(if $(BR2_SHARED_LIBS),--disable-static))
>  endef

In fact, this patch is causing some problems. Now, when
BR2_SHARED_LIBS=y, musl is built with --disable-static. Due to this,
there is no libc.a generated for musl. For the internal toolchain
backend, this is OK.

But when the produced toolchain gets re-used as an external toolchain,
it fails because the external toolchain logic in Buildroot uses "gcc
-print-file-name=libc.a" to find the sysroot. Since there is no libc.a,
it fails and the toolchain cannot be used.

Arnout, Yann, Peter, what do you think about this?

Should we always produce a libc.a in the musl case, so that it's more
like glibc and uClibc.

Or should we adjust our external toolchain logic to fallback on
searching for a different file than libc.a when libc.a is not available?

Thanks for your feedback,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 1/1] musl: Honor BR2_STATIC_LIBS / BR2_SHARED_LIBS
  2015-10-18 13:09 ` Thomas Petazzoni
@ 2015-10-18 15:58   ` Yann E. MORIN
  2015-10-18 16:18     ` Charles Duffy
  0 siblings, 1 reply; 10+ messages in thread
From: Yann E. MORIN @ 2015-10-18 15:58 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2015-10-18 15:09 +0200, Thomas Petazzoni spake thusly:
> On Tue, 13 Oct 2015 23:29:37 -0500, Charles Duffy wrote:
> > From: Charles Duffy <charles@dyfis.net>
> > 
> > Signed-off-by: Charles Duffy <chaduffy@cisco.com>
> > ---
> >  package/musl/musl.mk | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/package/musl/musl.mk b/package/musl/musl.mk
> > index 22589f5..aca78ab 100644
> > --- a/package/musl/musl.mk
> > +++ b/package/musl/musl.mk
> > @@ -28,7 +28,9 @@ define MUSL_CONFIGURE_CMDS
> >  			--host=$(GNU_TARGET_NAME) \
> >  			--prefix=/usr \
> >  			--libdir=/lib \
> > -			--disable-gcc-wrapper)
> > +			--disable-gcc-wrapper \
> > +			$(if $(BR2_STATIC_LIBS),--disable-shared) \
> > +			$(if $(BR2_SHARED_LIBS),--disable-static))
> >  endef
> 
> In fact, this patch is causing some problems. Now, when
> BR2_SHARED_LIBS=y, musl is built with --disable-static. Due to this,
> there is no libc.a generated for musl. For the internal toolchain
> backend, this is OK.
> 
> But when the produced toolchain gets re-used as an external toolchain,
> it fails because the external toolchain logic in Buildroot uses "gcc
> -print-file-name=libc.a" to find the sysroot. Since there is no libc.a,
> it fails and the toolchain cannot be used.
> 
> Arnout, Yann, Peter, what do you think about this?
> 
> Should we always produce a libc.a in the musl case, so that it's more
> like glibc and uClibc.
> 
> Or should we adjust our external toolchain logic to fallback on
> searching for a different file than libc.a when libc.a is not available?

Hmmm... I have to admit that this is a tough one...

On the one hand, there's no reason to produce libc.a when we really want
dynamically-linked executables.

On the other hand, the toolchain is always a bit "special", and it still
makes sense to have libc.a even in the purely-shared scenario.

Really, I am totally unsure which way to go.

The quick fix to our build failures would be to revert this patch, of
course, until we have a better solution.

Charles, was there a hard resaon you provided this patch, or was it more
like "hey, let's not build static or shared when not needed" ?

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 1/1] musl: Honor BR2_STATIC_LIBS / BR2_SHARED_LIBS
  2015-10-18 15:58   ` Yann E. MORIN
@ 2015-10-18 16:18     ` Charles Duffy
  2015-10-18 16:33       ` Thomas Petazzoni
  0 siblings, 1 reply; 10+ messages in thread
From: Charles Duffy @ 2015-10-18 16:18 UTC (permalink / raw)
  To: buildroot

I provided this patch because my build results were unnecessarily enlarged
by dynamic libraries on an otherwise static-only system.

It sounds to me like we could optionally disable only dynamic libraries;
leave static libraries always enabled; and end up in a place that works for
everyone.

On Sun, Oct 18, 2015 at 10:58 AM Yann E. MORIN <yann.morin.1998@free.fr>
wrote:

> Thomas, All,
>
> On 2015-10-18 15:09 +0200, Thomas Petazzoni spake thusly:
> > On Tue, 13 Oct 2015 23:29:37 -0500, Charles Duffy wrote:
> > > From: Charles Duffy <charles@dyfis.net>
> > >
> > > Signed-off-by: Charles Duffy <chaduffy@cisco.com>
> > > ---
> > >  package/musl/musl.mk | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/package/musl/musl.mk b/package/musl/musl.mk
> > > index 22589f5..aca78ab 100644
> > > --- a/package/musl/musl.mk
> > > +++ b/package/musl/musl.mk
> > > @@ -28,7 +28,9 @@ define MUSL_CONFIGURE_CMDS
> > >                     --host=$(GNU_TARGET_NAME) \
> > >                     --prefix=/usr \
> > >                     --libdir=/lib \
> > > -                   --disable-gcc-wrapper)
> > > +                   --disable-gcc-wrapper \
> > > +                   $(if $(BR2_STATIC_LIBS),--disable-shared) \
> > > +                   $(if $(BR2_SHARED_LIBS),--disable-static))
> > >  endef
> >
> > In fact, this patch is causing some problems. Now, when
> > BR2_SHARED_LIBS=y, musl is built with --disable-static. Due to this,
> > there is no libc.a generated for musl. For the internal toolchain
> > backend, this is OK.
> >
> > But when the produced toolchain gets re-used as an external toolchain,
> > it fails because the external toolchain logic in Buildroot uses "gcc
> > -print-file-name=libc.a" to find the sysroot. Since there is no libc.a,
> > it fails and the toolchain cannot be used.
> >
> > Arnout, Yann, Peter, what do you think about this?
> >
> > Should we always produce a libc.a in the musl case, so that it's more
> > like glibc and uClibc.
> >
> > Or should we adjust our external toolchain logic to fallback on
> > searching for a different file than libc.a when libc.a is not available?
>
> Hmmm... I have to admit that this is a tough one...
>
> On the one hand, there's no reason to produce libc.a when we really want
> dynamically-linked executables.
>
> On the other hand, the toolchain is always a bit "special", and it still
> makes sense to have libc.a even in the purely-shared scenario.
>
> Really, I am totally unsure which way to go.
>
> The quick fix to our build failures would be to revert this patch, of
> course, until we have a better solution.
>
> Charles, was there a hard resaon you provided this patch, or was it more
> like "hey, let's not build static or shared when not needed" ?
>
> Regards,
> Yann E. MORIN.
>
> --
>
> .-----------------.--------------------.------------------.--------------------.
> |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics'
> conspiracy: |
> | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___
>      |
> | +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is
> no  |
> | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v
>  conspiracy.  |
>
> '------------------------------^-------^------------------^--------------------'
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20151018/4b3de436/attachment-0001.html>

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

* [Buildroot] [PATCH 1/1] musl: Honor BR2_STATIC_LIBS / BR2_SHARED_LIBS
  2015-10-18 16:18     ` Charles Duffy
@ 2015-10-18 16:33       ` Thomas Petazzoni
  2015-10-18 18:52         ` Yann E. MORIN
  2015-10-18 19:06         ` Peter Korsgaard
  0 siblings, 2 replies; 10+ messages in thread
From: Thomas Petazzoni @ 2015-10-18 16:33 UTC (permalink / raw)
  To: buildroot

Charles, Yann,

On Sun, 18 Oct 2015 16:18:10 +0000, Charles Duffy wrote:
> I provided this patch because my build results were unnecessarily enlarged
> by dynamic libraries on an otherwise static-only system.
> 
> It sounds to me like we could optionally disable only dynamic libraries;
> leave static libraries always enabled; and end up in a place that works for
> everyone.

Yeah, that's also my thought. In uClibc, you can enable/disable the
shared library build, but not the static library build. So maybe we
should do:

	--enable-static \
	$(if $(BR2_STATIC_LIBS),--disable-shared,--enable-shared)

I.e, always static, and shared as soon as BR2_STATIC_LIBS is disabled.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 1/1] musl: Honor BR2_STATIC_LIBS / BR2_SHARED_LIBS
  2015-10-18 16:33       ` Thomas Petazzoni
@ 2015-10-18 18:52         ` Yann E. MORIN
  2015-10-18 19:06         ` Peter Korsgaard
  1 sibling, 0 replies; 10+ messages in thread
From: Yann E. MORIN @ 2015-10-18 18:52 UTC (permalink / raw)
  To: buildroot

Thomas, Charles, All,

On 2015-10-18 18:33 +0200, Thomas Petazzoni spake thusly:
> Charles, Yann,
> 
> On Sun, 18 Oct 2015 16:18:10 +0000, Charles Duffy wrote:
> > I provided this patch because my build results were unnecessarily enlarged
> > by dynamic libraries on an otherwise static-only system.
> > 
> > It sounds to me like we could optionally disable only dynamic libraries;
> > leave static libraries always enabled; and end up in a place that works for
> > everyone.
> 
> Yeah, that's also my thought. In uClibc, you can enable/disable the
> shared library build, but not the static library build. So maybe we
> should do:
> 
> 	--enable-static \
> 	$(if $(BR2_STATIC_LIBS),--disable-shared,--enable-shared)
> 
> I.e, always static, and shared as soon as BR2_STATIC_LIBS is disabled.

Yes, I think this would be the best solution.

Charles, care to send the patch, please?

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 1/1] musl: Honor BR2_STATIC_LIBS / BR2_SHARED_LIBS
  2015-10-18 16:33       ` Thomas Petazzoni
  2015-10-18 18:52         ` Yann E. MORIN
@ 2015-10-18 19:06         ` Peter Korsgaard
  1 sibling, 0 replies; 10+ messages in thread
From: Peter Korsgaard @ 2015-10-18 19:06 UTC (permalink / raw)
  To: buildroot

>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:

 > Charles, Yann,
 > On Sun, 18 Oct 2015 16:18:10 +0000, Charles Duffy wrote:
 >> I provided this patch because my build results were unnecessarily enlarged
 >> by dynamic libraries on an otherwise static-only system.
 >> 
 >> It sounds to me like we could optionally disable only dynamic libraries;
 >> leave static libraries always enabled; and end up in a place that works for
 >> everyone.

 > Yeah, that's also my thought. In uClibc, you can enable/disable the
 > shared library build, but not the static library build. So maybe we
 > should do:

 > 	--enable-static \
 > 	$(if $(BR2_STATIC_LIBS),--disable-shared,--enable-shared)

 > I.e, always static, and shared as soon as BR2_STATIC_LIBS is disabled.

Yes, I think that's the safest/easiest/best-matching-the-other-libcs
approach.

-- 
Venlig hilsen,
Peter Korsgaard 

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

end of thread, other threads:[~2015-10-18 19:06 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-14  4:29 [Buildroot] [PATCH 1/1] musl: Honor BR2_STATIC_LIBS / BR2_SHARED_LIBS Charles Duffy
2015-10-14 21:35 ` Thomas Petazzoni
2015-10-14 22:23   ` Charles Duffy
2015-10-15  7:38     ` Thomas Petazzoni
2015-10-18 13:09 ` Thomas Petazzoni
2015-10-18 15:58   ` Yann E. MORIN
2015-10-18 16:18     ` Charles Duffy
2015-10-18 16:33       ` Thomas Petazzoni
2015-10-18 18:52         ` Yann E. MORIN
2015-10-18 19:06         ` Peter Korsgaard

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