Skip to contentSkip to conversation

package/libp11: fix enginesdir

PATCH In review Fabrice Fontaine 3 participants 7 messages May 9, 2024 – Nov 23

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/libp11: fix enginesdir

pkg-config doesn't return a libcrypto enginesdir prefixed with the sysroot so drop unneeded call to xargs, readlink and sed

---
 package/libp11/libp11.mk | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
package/libp11/libp11.mk +1 -3
index cd4ed34297..dc489758aa 100644
@@ -11,10 +11,8 @@ LIBP11_INSTALL_STAGING = YES
 LIBP11_LICENSE = LGPL-2.1+
 LIBP11_LICENSE_FILES = COPYING
 
-# pkg-config returns a libcrypto enginesdir prefixed with the sysroot,
-# so let's rip it out.
 LIBP11_CONF_OPTS = \
-	--with-enginesdir=`$(PKG_CONFIG_HOST_BINARY) --variable enginesdir libcrypto | xargs readlink -f | sed 's%^$(STAGING_DIR)%%'`
+	--with-enginesdir=`$(PKG_CONFIG_HOST_BINARY) --variable enginesdir libcrypto`
 
 ifeq ($(BR2_PACKAGE_P11_KIT),y)
 LIBP11_CONF_OPTS += --with-pkcs11-module=/usr/lib/p11-kit-proxy.so
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 13 lines · On Thu, 9 May 2024 22:42:18 +0200 Fabrice Fontaine…

pkg-config doesn't return a libcrypto enginesdir prefixed with the sysroot so drop unneeded call to xargs, readlink and sed

---
 package/libp11/libp11.mk | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
package/libp11/libp11.mk +0 -0
index cd4ed34297..dc489758aa 100644

package/libp11/libp11.mk LIBP11_INSTALL_STAGING = YES · line 15

Quoted 5 lines
package/libp11/libp11.mk +0 -2
@@ -11,10 +11,8 @@ LIBP11_INSTALL_STAGING = YES
 LIBP11_LICENSE = LGPL-2.1+
 LIBP11_LICENSE_FILES = COPYING
 
-# pkg-config returns a libcrypto enginesdir prefixed with the sysroot,
-# so let's rip it out.

Well, this workaround was here for a reason. Since when it is no longer needed?

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Hello Fabrice,

Quoted 5 lines · On Thu, 9 May 2024 23:10:50 +0200 Thomas Petazzoni via buildroot…

package/libp11/libp11.mk LIBP11_INSTALL_STAGING = YES · line 15

Quoted 2 lines
package/libp11/libp11.mk +0 -2
-# pkg-config returns a libcrypto enginesdir prefixed with the sysroot,
-# so let's rip it out.  

Well, this workaround was here for a reason. Since when it is no longer needed?

Ping on the above question :-)

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

Hello Thomas,

Quoted 6 lines · Thomas Petazzoni

Hello Fabrice,

On Thu, 9 May 2024 23:10:50 +0200
Thomas Petazzoni via buildroot <[email protected]> wrote:

Quoted 7 lines
Quoted 5 lines

package/libp11/libp11.mk LIBP11_INSTALL_STAGING = YES · line 15

Quoted 2 lines
package/libp11/libp11.mk +0 -2
-# pkg-config returns a libcrypto enginesdir prefixed with the sysroot,
-# so let's rip it out.

Well, this workaround was here for a reason. Since when it is no longer needed?

Ping on the above question :-)

It seems that you added this workaround back in 2019 [1]. However, to my understanding pkg-config only prefixes sysroot to a subset of variables since at least 2018 [2] and enginesdir is not one of them.
Finally, since its addition in openssl in 2016 [3], enginesdir has always been set to ${libdir}/engines-...
So, I don't know what triggers the build failure that you fixed at that time.

Quoted 8 lines

Thanks!

Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training
https://bootlin.com

Best Regards,

Fabrice

[1] https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
[2] https://git.buildroot.net/buildroot/commit/package/pkgconf/0001-Only-prefix-with-the-sysroot-a-subset-of-variables.patch?id=7125fc5c1a8a96ff8eee057789358702e1b55835
[3] https://github.com/openssl/openssl/commit/cdbbf9900253e8006868eba948248b1092a057de
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw

Hello Fabrice,

Quoted 7 lines · On Mon, 22 Jul 2024 22:47:04 +0200 Fabrice Fontaine…

It seems that you added this workaround back in 2019 [1]. However, to my understanding pkg-config only prefixes sysroot to a subset of variables since at least 2018 [2] and enginesdir is not one of them.
Finally, since its addition in openssl in 2016 [3], enginesdir has always been set to ${libdir}/engines-...
So, I don't know what triggers the build failure that you fixed at that time.

So, I had a closer look, and you're right... but things are going to get broken again soon.

Back when I introduced this code, enginesdir was expressed in terms of ${libdir}:

enginesdir=${libdir}/engines-3

and because ${libdir} is one of the variables that get sysroot-ed, enginesdir also gets sysrooted, which is why my "hack" was needed.

Then, in OpenSSL commit 2ac569a67b9d0980efa2d8061a6a61e0645f37a7 (first appeared in OpenSSL 3.3.0), they reworked the whole .pc stuff, and changed enginesdir like this:

enginesdir={- $OpenSSL::safe::installdata::ENGINESDIR -}

which ends up as:

enginesdir=/usr/lib/engines-3

so enginesdir is no longer expressed as a relative path to ${libdir}, so it doesn't get sysroot'ed, which is the behaviour you observe right now.

However, more recently (June 2024) commit 30dc37d798a0428fd477d3763086e7e97b3d596f was merged into OpenSSL, which reworks the above logic to:

enginesdir=${libdir}/{- $OpenSSL::safe::installdata::ENGINESDIR_REL_LIBDIR -}

so, starting from the next release of OpenSSL, enginesdir will be back to be defining relatively to ${libdir}, so it will be sysrooted again.

See my quick experiment below. First current situation:

$ grep ^enginesdir output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/pkgconfig/libcrypto.pc
enginesdir=/usr/lib/engines-3
$ ./output/host/bin/pkg-config --variable=enginesdir libcrypto
/usr/lib/engines-3

with the next release of OpenSSL, it will look like this:

$ grep ^enginesdir output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/pkgconfig/libcrypto.pc
enginesdir=${libdir}/engines-3
$ ./output/host/bin/pkg-config --variable=enginesdir libcrypto
./output/host/bin/../arm-buildroot-linux-gnueabihf/sysroot/usr/lib/engines-3

So maybe we should merge your patch.. and revert when a new OpenSSL release is made?

I was wondering whether the problem should be fixed in libcrypto.pc by a tweak in libopenssl.mk, but how can we know when this enginesdir will be used to know the location of the engines at compile time (in which case it must be sysrooted) vs. when it will be used to know the location of the engines at run time (in which case it should not be sysrooted) ?

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#5 lore raw
In reply to Fabrice Fontaine

Hi Fabrice,

Quoted 2 lines · Fabrice Fontaine

pkg-config doesn't return a libcrypto enginesdir prefixed with the sysroot so drop unneeded call to xargs, readlink and sed

I think this patch can be dropped. As Thomas expected, OpenSSL defines enginesdir relative to ${libdir} again. Master has OpenSSL 3.6.5, and its exporters/pkg-config/libcrypto.pc.in has:

  enginesdir=${libdir}/...
  modulesdir=${libdir}/...

So pkg-config returns both prefixed with the sysroot, and the readlink and sed are needed again. fe7ad9e3a2 ("package/libp11: bump version to 0.4.18") applies the same stripping to modulesdir.

Not Applicable: https://patchwork.buildroot.org/project/buildroot/patch/[email protected]/
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#6 lore raw
Quoted 4 lines · Angelo Compagnucci

I think this patch can be dropped. As Thomas expected, OpenSSL defines enginesdir relative to ${libdir} again. Master has OpenSSL 3.6.5, and its exporters/pkg-config/libcrypto.pc.in has:

Quoted 8 lines
  enginesdir=${libdir}/...
  modulesdir=${libdir}/...

So pkg-config returns both prefixed with the sysroot, and the readlink and sed are needed again. fe7ad9e3a2 ("package/libp11: bump version to 0.4.18") applies the same stripping to modulesdir.

Not Applicable: https://patchwork.buildroot.org/project/buildroot/patch/[email protected]/

Thanks, patch status updated.

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot