[1/1] boost: correctly disable icu in locale if needed

Message ID 20180713174247.4005-1-fontaine.fabrice@gmail.com
State New
Headers show
Series
  • [1/1] boost: correctly disable icu in locale if needed
Related show

Commit Message

Fabrice Fontaine July 13, 2018, 5:42 p.m.
boost doesn't take into account --without-icu flag and links
libboost_locale with icu if it founds it in staging directory

So use boost.locale.icu to fix this issue

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 package/boost/boost.mk | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Thomas Petazzoni July 14, 2018, 8:41 p.m. | #1
Hello Fabrice,

On Fri, 13 Jul 2018 19:42:47 +0200, Fabrice Fontaine wrote:
> boost doesn't take into account --without-icu flag and links
> libboost_locale with icu if it founds it in staging directory
> 
> So use boost.locale.icu to fix this issue
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
>  package/boost/boost.mk | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/package/boost/boost.mk b/package/boost/boost.mk
> index b2605a70b7..242b60a460 100644
> --- a/package/boost/boost.mk
> +++ b/package/boost/boost.mk
> @@ -116,6 +116,12 @@ ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
>  BOOST_OPTS += boost.locale.posix=off
>  endif
>  
> +ifeq ($(BR2_PACKAGE_ICU),y)
> +BOOST_OPTS += boost.locale.icu=on
> +else
> +BOOST_OPTS += boost.locale.icu=off
> +endif

I'm not sure to fully understand what's going on here.

First, if --without-icu has no effect, why isn't your patch removing
it ?

Second, why are you introducing another BR2_PACKAGE_ICU conditional,
even if there's already one ?

Third, what is the problem with libboost_locale linking with icu if
found in the staging directory ?

Thanks!

Thomas
Fabrice Fontaine July 14, 2018, 9:04 p.m. | #2
Dear Thomas,

2018-07-14 22:41 GMT+02:00 Thomas Petazzoni <thomas.petazzoni@bootlin.com>:

> Hello Fabrice,
>
> On Fri, 13 Jul 2018 19:42:47 +0200, Fabrice Fontaine wrote:
> > boost doesn't take into account --without-icu flag and links
> > libboost_locale with icu if it founds it in staging directory
> >
> > So use boost.locale.icu to fix this issue
> >
> > Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> > ---
> >  package/boost/boost.mk | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/package/boost/boost.mk b/package/boost/boost.mk
> > index b2605a70b7..242b60a460 100644
> > --- a/package/boost/boost.mk
> > +++ b/package/boost/boost.mk
> > @@ -116,6 +116,12 @@ ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
> >  BOOST_OPTS += boost.locale.posix=off
> >  endif
> >
> > +ifeq ($(BR2_PACKAGE_ICU),y)
> > +BOOST_OPTS += boost.locale.icu=on
> > +else
> > +BOOST_OPTS += boost.locale.icu=off
> > +endif
>
> I'm not sure to fully understand what's going on here.
>
> First, if --without-icu has no effect, why isn't your patch removing
> it ?
>
I don't fully understand yet what --without-icu does in the other boost
libraries so I didn't want to remove it.
From my current understanding, icu should also (at least) be used by regex.

>
> Second, why are you introducing another BR2_PACKAGE_ICU conditional,
> even if there's already one ?
>
Because there was already a BR2_PACKAGE_BOOST_LOCALE conditional and it
seems strange to set boost.locale.icu if locale is not enabled. But I can
move it if you think it's better.

>
> Third, what is the problem with libboost_locale linking with icu if
> found in the staging directory ?
>
Because, if it links with icu, boost will also build chrono and thread. To
avoid always selecting these two libraries, I sent a patch to select them
only if BR2_PACKAGE_ICU is set (see http://patchwork.ozlabs.org/patch/943753).
My patch won't always work if boost links with icu when BR2_PACKAGE_ICU is
not set (for example if the user changes his configuration between two
builds). Perhaps, I should sent a patch serie with these two patches to
better reflect the dependencies between them?

>
> Thanks!
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
> Embedded Linux and Kernel engineering
> https://bootlin.com
>
Best Regards,

Fabrice
<div dir="ltr">Dear Thomas,<br><div class="gmail_extra"><br><div class="gmail_quote">2018-07-14 22:41 GMT+02:00 Thomas Petazzoni <span dir="ltr">&lt;<a href="mailto:thomas.petazzoni@bootlin.com" target="_blank">thomas.petazzoni@bootlin.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello Fabrice,<br>
<span class="gmail-"><br>
On Fri, 13 Jul 2018 19:42:47 +0200, Fabrice Fontaine wrote:<br>
&gt; boost doesn&#39;t take into account --without-icu flag and links<br>
&gt; libboost_locale with icu if it founds it in staging directory<br>
&gt; <br>
&gt; So use boost.locale.icu to fix this issue<br>
&gt; <br>
&gt; Signed-off-by: Fabrice Fontaine &lt;<a href="mailto:fontaine.fabrice@gmail.com">fontaine.fabrice@gmail.com</a>&gt;<br>
&gt; ---<br>
&gt;  package/boost/<a href="http://boost.mk" rel="noreferrer" target="_blank">boost.mk</a> | 6 ++++++<br>
&gt;  1 file changed, 6 insertions(+)<br>
&gt; <br>
&gt; diff --git a/package/boost/<a href="http://boost.mk" rel="noreferrer" target="_blank">boost.mk</a> b/package/boost/<a href="http://boost.mk" rel="noreferrer" target="_blank">boost.mk</a><br>
&gt; index b2605a70b7..242b60a460 100644<br>
&gt; --- a/package/boost/<a href="http://boost.mk" rel="noreferrer" target="_blank">boost.mk</a><br>
&gt; +++ b/package/boost/<a href="http://boost.mk" rel="noreferrer" target="_blank">boost.mk</a><br>
&gt; @@ -116,6 +116,12 @@ ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),<wbr>y)<br>
&gt;  BOOST_OPTS += boost.locale.posix=off<br>
&gt;  endif<br>
&gt;  <br>
&gt; +ifeq ($(BR2_PACKAGE_ICU),y)<br>
&gt; +BOOST_OPTS += boost.locale.icu=on<br>
&gt; +else<br>
&gt; +BOOST_OPTS += boost.locale.icu=off<br>
&gt; +endif<br>
<br>
</span>I&#39;m not sure to fully understand what&#39;s going on here.<br>
<br>
First, if --without-icu has no effect, why isn&#39;t your patch removing<br>
it ?<br></blockquote><div>I don&#39;t fully understand yet what --without-icu does in the other boost libraries so I didn&#39;t want to remove it.<br></div><div>From my current understanding, icu should also (at least) be used by regex. <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Second, why are you introducing another BR2_PACKAGE_ICU conditional,<br>
even if there&#39;s already one ?<br></blockquote><div>Because there was already a BR2_PACKAGE_BOOST_LOCALE conditional and it seems strange to set boost.locale.icu if locale is not enabled. But I can move it if you think it&#39;s better.<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Third, what is the problem with libboost_locale linking with icu if<br>
found in the staging directory ?<br></blockquote><div>Because, if it links with icu, boost will also build chrono and thread. To avoid always selecting these two libraries, I sent a patch to select them only if BR2_PACKAGE_ICU is set (see <a href="http://patchwork.ozlabs.org/patch/943753">http://patchwork.ozlabs.org/patch/943753</a>). My patch won&#39;t always work if boost links with icu when BR2_PACKAGE_ICU is not set (for example if the user changes his configuration between two builds). Perhaps, I should sent a patch serie with these two patches to better reflect the dependencies between them?<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Thanks!<br>
<span class="gmail-HOEnZb"><font color="#888888"><br>
Thomas<br>
-- <br>
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)<br>
Embedded Linux and Kernel engineering<br>
<a href="https://bootlin.com" rel="noreferrer" target="_blank">https://bootlin.com</a><br>
</font></span></blockquote></div>Best Regards,<br><br></div><div class="gmail_extra">Fabrice<br></div></div>
Thomas Petazzoni July 14, 2018, 9:21 p.m. | #3
Hello,

On Sat, 14 Jul 2018 23:04:59 +0200, Fabrice Fontaine wrote:

> > First, if --without-icu has no effect, why isn't your patch removing
> > it ?
> >  
> I don't fully understand yet what --without-icu does in the other boost
> libraries so I didn't want to remove it.
> From my current understanding, icu should also (at least) be used by regex.

--without-icu apparently has the effect that ICU_PATH is not defined,
which has an impact in libs/locale/build/Jamfile.v2, but the syntax of
those .v2 files is really weird, so I don't get what's happening
afterwards.

> > Second, why are you introducing another BR2_PACKAGE_ICU conditional,
> > even if there's already one ?
> >  
> Because there was already a BR2_PACKAGE_BOOST_LOCALE conditional and it
> seems strange to set boost.locale.icu if locale is not enabled. But I can
> move it if you think it's better.

I think it would be good to understand the interaction with
--without-icu to have a clean solution.

> > Third, what is the problem with libboost_locale linking with icu if
> > found in the staging directory ?
> >  
> Because, if it links with icu, boost will also build chrono and thread. To
> avoid always selecting these two libraries, I sent a patch to select them
> only if BR2_PACKAGE_ICU is set (see http://patchwork.ozlabs.org/patch/943753).

Indeed, boost_locale will build boost_thread if ICU is enabled:

        if $(found-icu)
        {
            ICU_SOURCES = 
                boundary
                codecvt
                collator
                conversion
                date_time
                formatter
                icu_backend
                numeric
                time_zone
                ;
            
            result += <source>icu/$(ICU_SOURCES).cpp 
                      <library>../../thread/build//boost_thread 
                      ;
        }

However, I don't see this happening for chrono.

> My patch won't always work if boost links with icu when BR2_PACKAGE_ICU is
> not set (for example if the user changes his configuration between two
> builds). Perhaps, I should sent a patch serie with these two patches to
> better reflect the dependencies between them?

If patches have dependencies/interactions, then yes sending them as a
series makes it clear they are related.

However, I still don't see the relation here. We indeed recommend in
Buildroot to explicitly enable/disable features using configuration
options when possible, mainly to avoid target packages incorrectly
detecting some host library and trying to use it. So I'm still confused
by what this patch is *fixing*. That it makes things more correct is
OK, but that it is fixing something, I'm not sure.

Thanks!

Thomas

Patch

diff --git a/package/boost/boost.mk b/package/boost/boost.mk
index b2605a70b7..242b60a460 100644
--- a/package/boost/boost.mk
+++ b/package/boost/boost.mk
@@ -116,6 +116,12 @@  ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
 BOOST_OPTS += boost.locale.posix=off
 endif
 
+ifeq ($(BR2_PACKAGE_ICU),y)
+BOOST_OPTS += boost.locale.icu=on
+else
+BOOST_OPTS += boost.locale.icu=off
+endif
+
 BOOST_DEPENDENCIES += $(if $(BR2_ENABLE_LOCALE),,libiconv)
 endif