Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
To: Fabien Thomas <fabien.thomas@smile.fr>
Cc: Romain Naour <romain.naour@smile.fr>, buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH] package/nettle: add missing host-gmp dependency
Date: Wed, 1 Nov 2023 12:40:18 +0100	[thread overview]
Message-ID: <20231101124018.3aa5ee54@windsurf> (raw)
In-Reply-To: <20231026095506.876284-1-fabien.thomas@smile.fr>

Hello Fabien,

On Thu, 26 Oct 2023 11:55:06 +0200
Fabien Thomas <fabien.thomas@smile.fr> wrote:

> Since the generic package infrastructure removed auto derivation of
> host dependencies [1] (2016.08), the host dependencies must be
> explicitly set.
> 
> While adding the nettle host variant [2] the gmp dependency was not
> duplicated and host-nettle was built without host-gmp (or built with
> gmp installed on the build machine).
> 
> While building host-gnutls required for building mkeficapsule u-boot
> tool, the configure script check if Libhogweed (nettle's companion
> library) is build with libgmp support.
> 
> If internal toolchain is used, luckily host-gmp is built before
> building host-nettle (and host-gnutls). But when using prebuilt
> external toolchain, following error shows up :
> 
> Libhogweed (nettle's companion library) 3.6 was not found. Note that you must compile nettle with gmp support.
> 
> [1] https://gitlab.com/buildroot.org/buildroot/-/commit/4bdb067e380e72c3a6cb9c6ccf3791a6cf8661e0
> [2] https://gitlab.com/buildroot.org/buildroot/-/commit/dac6e3011883ce3b35cbf64ec156186153bf0032
> [3] https://gitlab.com/gnutls/gnutls/-/commit/eb24bfa808ee029e9b3b198d66d29256eea3fd08
> 
> Signed-off-by: Fabien Thomas <fabien.thomas@smile.fr>
> ---
>  package/nettle/nettle.mk | 2 ++
>  1 file changed, 2 insertions(+)

I have applied, but to be honest, I wasn't sure. Indeed, gmp is
actually an optional dependency of the nettle package. We do handle it
as a mandatory dependency for the target nettle package, which I
believe isn't correct as we really try hard in Buildroot to not make
dependencies mandatory when they really are not.

In addition, it should be associated to the actual feature that needs
it. So I believe we would ideally need to do this:

 NETTLE_VERSION = 3.9.1
 NETTLE_SITE = https://ftp.gnu.org/gnu/nettle
-NETTLE_DEPENDENCIES = host-m4 gmp
+NETTLE_DEPENDENCIES = host-m4
 NETTLE_INSTALL_STAGING = YES
 NETTLE_LICENSE = Dual GPL-2.0+/LGPL-3.0+
 NETTLE_LICENSE_FILES = COPYING.LESSERv3 COPYINGv2
@@ -15,6 +15,13 @@ NETTLE_CPE_ID_VENDOR = nettle_project
 # with static linking
 NETTLE_CONF_OPTS = --disable-openssl
 
+ifeq ($(BR2_PACKAGE_GMP),y)
+NETTLE_CONF_OPTS += --enable-public-key
+NETTLE_DEPENDENCIES += gmp
+else
+NETTLE_CONF_OPTS += --disable-public-key
+endif
+
 HOST_NETTLE_DEPENDENCIES = host-m4 host-gmp
 
 # ARM assembly requires v6+ ISA

But of course this requires analyzing the reverse dependencies of
nettle, to figure out the ones that need vs. the ones that don't need
the public key support. The ones that need public key support would
have to select BR2_PACKAGE_GMP.

For the host variant of nettle, I'm not sure. We are a little bit less
strict on making all dependencies optional for host packages, because
there's no impact on the target root filesystem size, only an impact on
the build time. That's why I applied your patch as-is, even if you're
handling an optional dependency as a mandatory dependency.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

      parent reply	other threads:[~2023-11-01 11:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-26  9:55 [Buildroot] [PATCH] package/nettle: add missing host-gmp dependency Fabien Thomas
2023-10-26 10:27 ` Romain Naour
2023-11-01 11:40 ` Thomas Petazzoni via buildroot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231101124018.3aa5ee54@windsurf \
    --to=buildroot@buildroot.org \
    --cc=fabien.thomas@smile.fr \
    --cc=romain.naour@smile.fr \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox