Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2] mtd: fix static build with uuid
@ 2015-09-11  4:08 Baruch Siach
  2015-09-11  5:30 ` Gergely Imreh
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Baruch Siach @ 2015-09-11  4:08 UTC (permalink / raw)
  To: buildroot

The uuid library might depend on gettext. Use pkg-config to discover uuid
dependencies at build time, and edit Makefile accordingly to avoid missing
symbols when linking statically.

Based on a patch from Vicente Olivert Riera.

Fixes:
http://autobuild.buildroot.net/results/2dd/2ddd714446d9eb75701bd48c117dc5bbbd291a76/
http://autobuild.buildroot.net/results/3af/3af4ef252c8cb2b22134d91ce48e5930c60ec437/
http://autobuild.buildroot.net/results/648/648341fce974e8f016eee57c95d7511a886eef49/

Cc: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
v2:
   * Use backticks instead of $(shell ...) make function (Arnout)
---
 package/mtd/mtd.mk | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/package/mtd/mtd.mk b/package/mtd/mtd.mk
index 0fb9fc2c1acc..89cfac15756a 100644
--- a/package/mtd/mtd.mk
+++ b/package/mtd/mtd.mk
@@ -16,8 +16,14 @@ ifeq ($(BR2_PACKAGE_MTD_MKFSJFFS2),y)
 MTD_DEPENDENCIES = zlib lzo
 endif
 
+MTD_MKFSUBIFS_LIBS = `$(PKG_CONFIG_HOST_BINARY) --libs uuid`
+
 ifeq ($(BR2_PACKAGE_MTD_MKFSUBIFS),y)
-MTD_DEPENDENCIES += util-linux zlib lzo
+MTD_DEPENDENCIES += util-linux zlib lzo host-pkgconf
+define MTD_ADD_MISSING_LINTL
+	$(SED) "/^LDLIBS_mkfs\.ubifs/ s%$$% $(MTD_MKFSUBIFS_LIBS)%" $(@D)/Makefile
+endef
+MTD_POST_PATCH_HOOKS += MTD_ADD_MISSING_LINTL
 endif
 
 ifeq ($(BR2_PACKAGE_BUSYBOX),y)
-- 
2.5.1

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

* [Buildroot] [PATCH v2] mtd: fix static build with uuid
  2015-09-11  4:08 [Buildroot] [PATCH v2] mtd: fix static build with uuid Baruch Siach
@ 2015-09-11  5:30 ` Gergely Imreh
  2015-09-11  9:16 ` Vicente Olivert Riera
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Gergely Imreh @ 2015-09-11  5:30 UTC (permalink / raw)
  To: buildroot

On 11 September 2015 at 12:08, Baruch Siach <baruch@tkos.co.il> wrote:
> The uuid library might depend on gettext. Use pkg-config to discover uuid
> dependencies at build time, and edit Makefile accordingly to avoid missing
> symbols when linking statically.
>
> Based on a patch from Vicente Olivert Riera.
>
> Fixes:
> http://autobuild.buildroot.net/results/2dd/2ddd714446d9eb75701bd48c117dc5bbbd291a76/
> http://autobuild.buildroot.net/results/3af/3af4ef252c8cb2b22134d91ce48e5930c60ec437/
> http://autobuild.buildroot.net/results/648/648341fce974e8f016eee57c95d7511a886eef49/
>
> Cc: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>

Tested-by: Gergely Imreh <imrehg@gmail.com>
  by compiling the previously failed autobuild configs with this patch added

> ---
> v2:
>    * Use backticks instead of $(shell ...) make function (Arnout)
> ---
>  package/mtd/mtd.mk | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/package/mtd/mtd.mk b/package/mtd/mtd.mk
> index 0fb9fc2c1acc..89cfac15756a 100644
> --- a/package/mtd/mtd.mk
> +++ b/package/mtd/mtd.mk
> @@ -16,8 +16,14 @@ ifeq ($(BR2_PACKAGE_MTD_MKFSJFFS2),y)
>  MTD_DEPENDENCIES = zlib lzo
>  endif
>
> +MTD_MKFSUBIFS_LIBS = `$(PKG_CONFIG_HOST_BINARY) --libs uuid`
> +
>  ifeq ($(BR2_PACKAGE_MTD_MKFSUBIFS),y)
> -MTD_DEPENDENCIES += util-linux zlib lzo
> +MTD_DEPENDENCIES += util-linux zlib lzo host-pkgconf
> +define MTD_ADD_MISSING_LINTL
> +       $(SED) "/^LDLIBS_mkfs\.ubifs/ s%$$% $(MTD_MKFSUBIFS_LIBS)%" $(@D)/Makefile
> +endef
> +MTD_POST_PATCH_HOOKS += MTD_ADD_MISSING_LINTL
>  endif
>
>  ifeq ($(BR2_PACKAGE_BUSYBOX),y)
> --
> 2.5.1
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH v2] mtd: fix static build with uuid
  2015-09-11  4:08 [Buildroot] [PATCH v2] mtd: fix static build with uuid Baruch Siach
  2015-09-11  5:30 ` Gergely Imreh
@ 2015-09-11  9:16 ` Vicente Olivert Riera
  2015-09-13  4:45   ` Baruch Siach
  2015-09-13 10:50 ` Thomas Petazzoni
  2015-09-13 20:46 ` Peter Korsgaard
  3 siblings, 1 reply; 6+ messages in thread
From: Vicente Olivert Riera @ 2015-09-11  9:16 UTC (permalink / raw)
  To: buildroot

Dear Baruch Siach,

On 09/11/2015 05:08 AM, Baruch Siach wrote:
> The uuid library might depend on gettext. Use pkg-config to discover uuid
> dependencies at build time, and edit Makefile accordingly to avoid missing
> symbols when linking statically.
> 
> Based on a patch from Vicente Olivert Riera.
> 
> Fixes:
> http://autobuild.buildroot.net/results/2dd/2ddd714446d9eb75701bd48c117dc5bbbd291a76/
> http://autobuild.buildroot.net/results/3af/3af4ef252c8cb2b22134d91ce48e5930c60ec437/
> http://autobuild.buildroot.net/results/648/648341fce974e8f016eee57c95d7511a886eef49/
> 
> Cc: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> ---
> v2:
>    * Use backticks instead of $(shell ...) make function (Arnout)
> ---
>  package/mtd/mtd.mk | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/package/mtd/mtd.mk b/package/mtd/mtd.mk
> index 0fb9fc2c1acc..89cfac15756a 100644
> --- a/package/mtd/mtd.mk
> +++ b/package/mtd/mtd.mk
> @@ -16,8 +16,14 @@ ifeq ($(BR2_PACKAGE_MTD_MKFSJFFS2),y)
>  MTD_DEPENDENCIES = zlib lzo
>  endif
>  
> +MTD_MKFSUBIFS_LIBS = `$(PKG_CONFIG_HOST_BINARY) --libs uuid`
> +
>  ifeq ($(BR2_PACKAGE_MTD_MKFSUBIFS),y)
> -MTD_DEPENDENCIES += util-linux zlib lzo
> +MTD_DEPENDENCIES += util-linux zlib lzo host-pkgconf
> +define MTD_ADD_MISSING_LINTL
> +	$(SED) "/^LDLIBS_mkfs\.ubifs/ s%$$% $(MTD_MKFSUBIFS_LIBS)%" $(@D)/Makefile
> +endef
> +MTD_POST_PATCH_HOOKS += MTD_ADD_MISSING_LINTL
>  endif
>  
>  ifeq ($(BR2_PACKAGE_BUSYBOX),y)
> 

I have tested it and it works. My mistake was using / instead of % in
the sed command.

Since this fails only for static, why don't you put your changes
enclosed into an "ifeq ($(BR2_STATIC_LIBS),y)" clause?


 ifeq ($(BR2_PACKAGE_MTD_MKFSUBIFS),y)
 MTD_DEPENDENCIES += util-linux zlib lzo
+ifeq ($(BR2_STATIC_LIBS),y)
+MTD_DEPENDENCIES += host-pkgconf
+MTD_MKFSUBIFS_LIBS = `$(PKG_CONFIG_HOST_BINARY) --libs uuid`
+define MTD_ADD_MISSING_LINTL
+       $(SED) "/^LDLIBS_mkfs\.ubifs/ s%$$% $(MTD_MKFSUBIFS_LIBS)%"
$(@D)/Makefile
+endef
+MTD_POST_PATCH_HOOKS += MTD_ADD_MISSING_LINTL
+endif
 endif

 ifeq ($(BR2_PACKAGE_BUSYBOX),y)


Regards,

Vincent.

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

* [Buildroot] [PATCH v2] mtd: fix static build with uuid
  2015-09-11  9:16 ` Vicente Olivert Riera
@ 2015-09-13  4:45   ` Baruch Siach
  0 siblings, 0 replies; 6+ messages in thread
From: Baruch Siach @ 2015-09-13  4:45 UTC (permalink / raw)
  To: buildroot

Hi Vincent,

On Fri, Sep 11, 2015 at 10:16:56AM +0100, Vicente Olivert Riera wrote:
> On 09/11/2015 05:08 AM, Baruch Siach wrote:
> > The uuid library might depend on gettext. Use pkg-config to discover uuid
> > dependencies at build time, and edit Makefile accordingly to avoid missing
> > symbols when linking statically.
> > 
> > Based on a patch from Vicente Olivert Riera.
> > 
> > Fixes:
> > http://autobuild.buildroot.net/results/2dd/2ddd714446d9eb75701bd48c117dc5bbbd291a76/
> > http://autobuild.buildroot.net/results/3af/3af4ef252c8cb2b22134d91ce48e5930c60ec437/
> > http://autobuild.buildroot.net/results/648/648341fce974e8f016eee57c95d7511a886eef49/
> > 
> > Cc: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
> > Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> > ---
> > v2:
> >    * Use backticks instead of $(shell ...) make function (Arnout)
> > ---
> >  package/mtd/mtd.mk | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> > 
> > diff --git a/package/mtd/mtd.mk b/package/mtd/mtd.mk
> > index 0fb9fc2c1acc..89cfac15756a 100644
> > --- a/package/mtd/mtd.mk
> > +++ b/package/mtd/mtd.mk
> > @@ -16,8 +16,14 @@ ifeq ($(BR2_PACKAGE_MTD_MKFSJFFS2),y)
> >  MTD_DEPENDENCIES = zlib lzo
> >  endif
> >  
> > +MTD_MKFSUBIFS_LIBS = `$(PKG_CONFIG_HOST_BINARY) --libs uuid`
> > +
> >  ifeq ($(BR2_PACKAGE_MTD_MKFSUBIFS),y)
> > -MTD_DEPENDENCIES += util-linux zlib lzo
> > +MTD_DEPENDENCIES += util-linux zlib lzo host-pkgconf
> > +define MTD_ADD_MISSING_LINTL
> > +	$(SED) "/^LDLIBS_mkfs\.ubifs/ s%$$% $(MTD_MKFSUBIFS_LIBS)%" $(@D)/Makefile
> > +endef
> > +MTD_POST_PATCH_HOOKS += MTD_ADD_MISSING_LINTL
> >  endif
> >  
> >  ifeq ($(BR2_PACKAGE_BUSYBOX),y)
> 
> I have tested it and it works. My mistake was using / instead of % in
> the sed command.

Also the use of single quotes instead of double quotes as Arnout has noted.

> Since this fails only for static, why don't you put your changes
> enclosed into an "ifeq ($(BR2_STATIC_LIBS),y)" clause?

$(PKG_CONFIG_HOST_BINARY) should output the correct list of libraries for both
static and dynamic builds. I think that the mtd.mk simplification and wider 
test coverage outweighs the added overhead. Are there any other drawbacks to 
running $(PKG_CONFIG_HOST_BINARY) unconditionally?

Thanks for reviewing and testing.

baruch

>  ifeq ($(BR2_PACKAGE_MTD_MKFSUBIFS),y)
>  MTD_DEPENDENCIES += util-linux zlib lzo
> +ifeq ($(BR2_STATIC_LIBS),y)
> +MTD_DEPENDENCIES += host-pkgconf
> +MTD_MKFSUBIFS_LIBS = `$(PKG_CONFIG_HOST_BINARY) --libs uuid`
> +define MTD_ADD_MISSING_LINTL
> +       $(SED) "/^LDLIBS_mkfs\.ubifs/ s%$$% $(MTD_MKFSUBIFS_LIBS)%"
> $(@D)/Makefile
> +endef
> +MTD_POST_PATCH_HOOKS += MTD_ADD_MISSING_LINTL
> +endif
>  endif
> 
>  ifeq ($(BR2_PACKAGE_BUSYBOX),y)

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

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

* [Buildroot] [PATCH v2] mtd: fix static build with uuid
  2015-09-11  4:08 [Buildroot] [PATCH v2] mtd: fix static build with uuid Baruch Siach
  2015-09-11  5:30 ` Gergely Imreh
  2015-09-11  9:16 ` Vicente Olivert Riera
@ 2015-09-13 10:50 ` Thomas Petazzoni
  2015-09-13 20:46 ` Peter Korsgaard
  3 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2015-09-13 10:50 UTC (permalink / raw)
  To: buildroot

Dear Baruch Siach,

On Fri, 11 Sep 2015 07:08:37 +0300, Baruch Siach wrote:
> The uuid library might depend on gettext. Use pkg-config to discover uuid
> dependencies at build time, and edit Makefile accordingly to avoid missing
> symbols when linking statically.
> 
> Based on a patch from Vicente Olivert Riera.
> 
> Fixes:
> http://autobuild.buildroot.net/results/2dd/2ddd714446d9eb75701bd48c117dc5bbbd291a76/
> http://autobuild.buildroot.net/results/3af/3af4ef252c8cb2b22134d91ce48e5930c60ec437/
> http://autobuild.buildroot.net/results/648/648341fce974e8f016eee57c95d7511a886eef49/
> 
> Cc: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> ---
> v2:
>    * Use backticks instead of $(shell ...) make function (Arnout)
> ---
>  package/mtd/mtd.mk | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/package/mtd/mtd.mk b/package/mtd/mtd.mk
> index 0fb9fc2c1acc..89cfac15756a 100644
> --- a/package/mtd/mtd.mk
> +++ b/package/mtd/mtd.mk
> @@ -16,8 +16,14 @@ ifeq ($(BR2_PACKAGE_MTD_MKFSJFFS2),y)
>  MTD_DEPENDENCIES = zlib lzo
>  endif
>  
> +MTD_MKFSUBIFS_LIBS = `$(PKG_CONFIG_HOST_BINARY) --libs uuid`

Is there any reason for this definition to be outside of the
BR2_PACKAGE_MTD_MKFSUBIFS=y condition? It would be more logical, and
people wouldn't wonder why you're using PKG_CONFIG_HOST_BINARY outside
of the condition, while host-pkgconf is only added to the dependencies
inside the condition.

Also, ideally we should be patching the mtd Makefile to use pkg-config,
and submit that upstream (with maybe a fallback on a default value if
pkg-config is not available).

Thanks!

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

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

* [Buildroot] [PATCH v2] mtd: fix static build with uuid
  2015-09-11  4:08 [Buildroot] [PATCH v2] mtd: fix static build with uuid Baruch Siach
                   ` (2 preceding siblings ...)
  2015-09-13 10:50 ` Thomas Petazzoni
@ 2015-09-13 20:46 ` Peter Korsgaard
  3 siblings, 0 replies; 6+ messages in thread
From: Peter Korsgaard @ 2015-09-13 20:46 UTC (permalink / raw)
  To: buildroot

>>>>> "Baruch" == Baruch Siach <baruch@tkos.co.il> writes:

 > The uuid library might depend on gettext. Use pkg-config to discover uuid
 > dependencies at build time, and edit Makefile accordingly to avoid missing
 > symbols when linking statically.

 > Based on a patch from Vicente Olivert Riera.

 > Fixes:
 > http://autobuild.buildroot.net/results/2dd/2ddd714446d9eb75701bd48c117dc5bbbd291a76/
 > http://autobuild.buildroot.net/results/3af/3af4ef252c8cb2b22134d91ce48e5930c60ec437/
 > http://autobuild.buildroot.net/results/648/648341fce974e8f016eee57c95d7511a886eef49/

 > Cc: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
 > Signed-off-by: Baruch Siach <baruch@tkos.co.il>
 > ---
 > v2:
 >    * Use backticks instead of $(shell ...) make function (Arnout)
 > ---
 >  package/mtd/mtd.mk | 8 +++++++-
 >  1 file changed, 7 insertions(+), 1 deletion(-)

 > diff --git a/package/mtd/mtd.mk b/package/mtd/mtd.mk
 > index 0fb9fc2c1acc..89cfac15756a 100644
 > --- a/package/mtd/mtd.mk
 > +++ b/package/mtd/mtd.mk
 > @@ -16,8 +16,14 @@ ifeq ($(BR2_PACKAGE_MTD_MKFSJFFS2),y)
 >  MTD_DEPENDENCIES = zlib lzo
 >  endif
 
 > +MTD_MKFSUBIFS_LIBS = `$(PKG_CONFIG_HOST_BINARY) --libs uuid`
 > +
 >  ifeq ($(BR2_PACKAGE_MTD_MKFSUBIFS),y)
 > -MTD_DEPENDENCIES += util-linux zlib lzo
 > +MTD_DEPENDENCIES += util-linux zlib lzo host-pkgconf
 > +define MTD_ADD_MISSING_LINTL
 > +	$(SED) "/^LDLIBS_mkfs\.ubifs/ s%$$% $(MTD_MKFSUBIFS_LIBS)%" $(@D)/Makefile

The helper variable is only used once, so I've removed it and directly
added the pkg-config call here.

Committed, thanks.

With that said, it would be good to get upstream to use pkg-config
directly.

-- 
Bye, Peter Korsgaard

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

end of thread, other threads:[~2015-09-13 20:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-11  4:08 [Buildroot] [PATCH v2] mtd: fix static build with uuid Baruch Siach
2015-09-11  5:30 ` Gergely Imreh
2015-09-11  9:16 ` Vicente Olivert Riera
2015-09-13  4:45   ` Baruch Siach
2015-09-13 10:50 ` Thomas Petazzoni
2015-09-13 20:46 ` Peter Korsgaard

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