diff mbox series

openssl: fix pkg-config file libdir from /usr back to /usr/lib

Message ID 20240503102624.594443-1-mikko.rapeli@linaro.org
State New
Headers show
Series openssl: fix pkg-config file libdir from /usr back to /usr/lib | expand

Commit Message

Mikko Rapeli May 3, 2024, 10:26 a.m. UTC
openssl update from 3.2.1 to 3.3.0 changed pkg-config generators
and libdir changed from /usr/lib to /lib. This breaks builds
of recipes which use openssl pkg-config files for library install
etc paths. For example meta-security tpm2-openssl fails to build:

ERROR: mc:trs-qemuarm64:tpm2-openssl-1.1.1-r0 do_package: QA Issue: tpm2-openssl: Files/directories were installed but not shipped in any package:
  /usr/ossl-modules/tpm2.so

Affected pkg-config files are: libssl.pc, openssl.pc and libcrypto.pc

Fix this by hard coding LIBDIR variable to "lib". Prefix should
be correctly used as before.

Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
---
 .../openssl/openssl_pkg-config_libdir.patch   | 31 +++++++++++++++++++
 .../openssl/openssl_3.3.0.bb                  |  1 +
 2 files changed, 32 insertions(+)
 create mode 100644 meta/recipes-connectivity/openssl/openssl/openssl_pkg-config_libdir.patch

Comments

Alexander Kanavin May 3, 2024, 10:32 a.m. UTC | #1
I’m sorry, this doesn’t look right. Shouldn’t we rather ensure $(LIBDIR) is
correctly set? Besides, hardcoding to lib is certainly incorrect as it will
break multilib. We constantly have to fix upstreams in the opposite
direction.

Alex

On Fri 3. May 2024 at 12.26, Mikko Rapeli via lists.openembedded.org
<mikko.rapeli=linaro.org@lists.openembedded.org> wrote:

> openssl update from 3.2.1 to 3.3.0 changed pkg-config generators
> and libdir changed from /usr/lib to /lib. This breaks builds
> of recipes which use openssl pkg-config files for library install
> etc paths. For example meta-security tpm2-openssl fails to build:
>
> ERROR: mc:trs-qemuarm64:tpm2-openssl-1.1.1-r0 do_package: QA Issue:
> tpm2-openssl: Files/directories were installed but not shipped in any
> package:
>   /usr/ossl-modules/tpm2.so
>
> Affected pkg-config files are: libssl.pc, openssl.pc and libcrypto.pc
>
> Fix this by hard coding LIBDIR variable to "lib". Prefix should
> be correctly used as before.
>
> Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
> ---
>  .../openssl/openssl_pkg-config_libdir.patch   | 31 +++++++++++++++++++
>  .../openssl/openssl_3.3.0.bb                  |  1 +
>  2 files changed, 32 insertions(+)
>  create mode 100644
> meta/recipes-connectivity/openssl/openssl/openssl_pkg-config_libdir.patch
>
> diff --git
> a/meta/recipes-connectivity/openssl/openssl/openssl_pkg-config_libdir.patch
> b/meta/recipes-connectivity/openssl/openssl/openssl_pkg-config_libdir.patch
> new file mode 100644
> index 0000000000..e3b4249a69
> --- /dev/null
> +++
> b/meta/recipes-connectivity/openssl/openssl/openssl_pkg-config_libdir.patch
> @@ -0,0 +1,31 @@
> +openssl: fix pkg-config file libdir from /usr back to /usr/lib
> +
> +openssl update from 3.2.1 to 3.3.0 changed pkg-config generators
> +and libdir changed from /usr/lib to /lib. This breaks builds
> +of recipes which use openssl pkg-config files for library install
> +etc paths. For example meta-security tpm2-openssl fails to build:
> +
> +ERROR: mc:trs-qemuarm64:tpm2-openssl-1.1.1-r0 do_package: QA Issue:
> tpm2-openssl: Files/directories were installed but not shipped in any
> package:
> +  /usr/ossl-modules/tpm2.so
> +
> +Affected pkg-config files are: libssl.pc, openssl.pc and libcrypto.pc
> +
> +Fix this by hard coding LIBDIR variable to "lib". Prefix should
> +be correctly used as before.
> +
> +Upstream-Status: Inappropriate [configuration change]
> +
> +Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
> +
> +--- a/exporters/build.info
> ++++ b/exporters/build.info
> +@@ -19,7 +19,7 @@ DEPEND[openssl.pc]=libcrypto.pc libssl.pc
> + DEPEND[""]=openssl.pc
> +
> + GENERATE[../installdata.pm]=../util/mkinstallvars.pl \
> +-    "PREFIX=$(INSTALLTOP)" BINDIR=bin "LIBDIR=$(LIBDIR)" \
> ++    "PREFIX=$(INSTALLTOP)" BINDIR=bin LIBDIR=lib \
> +     INCLUDEDIR=include APPLINKDIR=include/openssl \
> +     "ENGINESDIR=$(ENGINESDIR)" "MODULESDIR=$(MODULESDIR)" \
> +     "PKGCONFIGDIR=$(PKGCONFIGDIR)" "CMAKECONFIGDIR=$(CMAKECONFIGDIR)" \
> +
> diff --git a/meta/recipes-connectivity/openssl/openssl_3.3.0.bb
> b/meta/recipes-connectivity/openssl/openssl_3.3.0.bb
> index 2cdaf4c75d..5ee8375ebc 100644
> --- a/meta/recipes-connectivity/openssl/openssl_3.3.0.bb
> +++ b/meta/recipes-connectivity/openssl/openssl_3.3.0.bb
> @@ -13,6 +13,7 @@ SRC_URI = "
> http://www.openssl.org/source/openssl-${PV}.tar.gz \
>             file://0001-Configure-do-not-tweak-mips-cflags.patch \
>
> file://0001-Added-handshake-history-reporting-when-test-fails.patch \
>             file://bti.patch \
> +           file://openssl_pkg-config_libdir.patch \
>             "
>
>  SRC_URI:append:class-nativesdk = " \
> --
> 2.34.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#198969):
> https://lists.openembedded.org/g/openembedded-core/message/198969
> Mute This Topic: https://lists.openembedded.org/mt/105885236/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
Mikko Rapeli May 3, 2024, 10:36 a.m. UTC | #2
Hi,

On Fri, May 03, 2024 at 12:32:42PM +0200, Alexander Kanavin wrote:
> I’m sorry, this doesn’t look right. Shouldn’t we rather ensure $(LIBDIR) is
> correctly set? Besides, hardcoding to lib is certainly incorrect as it will
> break multilib. We constantly have to fix upstreams in the opposite
> direction.

Yes, you and Ross on #yocto are right. This is not right. I tried also setting
LIBDIR=${BASELIB} in do_install() and do_configure but those did not work
either. openssl builds scripts are quite hard to work with...

Cheers,

-Mikko
Martin Jansa May 3, 2024, 10:43 a.m. UTC | #3
On Fri, May 3, 2024 at 12:37 PM Mikko Rapeli via
lists.openembedded.org
<mikko.rapeli=linaro.org@lists.openembedded.org> wrote:
>
> Hi,
>
> On Fri, May 03, 2024 at 12:32:42PM +0200, Alexander Kanavin wrote:
> > I’m sorry, this doesn’t look right. Shouldn’t we rather ensure $(LIBDIR) is
> > correctly set? Besides, hardcoding to lib is certainly incorrect as it will
> > break multilib. We constantly have to fix upstreams in the opposite
> > direction.
>
> Yes, you and Ross on #yocto are right. This is not right. I tried also setting
> LIBDIR=${BASELIB} in do_install() and do_configure but those did not work
> either. openssl builds scripts are quite hard to work with...

Isn't it easier to fix tpm2-openssl then?

I had similar issue in chip which was using "pkg-config
--variable=prefix openssl" and didn't expect it to be empty in "if
prefix[-4] == '/usr'" and rather patched chip than changing openssl.
Mikko Rapeli May 3, 2024, 10:46 a.m. UTC | #4
Hi,

On Fri, May 03, 2024 at 12:43:29PM +0200, Martin Jansa wrote:
> On Fri, May 3, 2024 at 12:37 PM Mikko Rapeli via
> lists.openembedded.org
> <mikko.rapeli=linaro.org@lists.openembedded.org> wrote:
> >
> > Hi,
> >
> > On Fri, May 03, 2024 at 12:32:42PM +0200, Alexander Kanavin wrote:
> > > I’m sorry, this doesn’t look right. Shouldn’t we rather ensure $(LIBDIR) is
> > > correctly set? Besides, hardcoding to lib is certainly incorrect as it will
> > > break multilib. We constantly have to fix upstreams in the opposite
> > > direction.
> >
> > Yes, you and Ross on #yocto are right. This is not right. I tried also setting
> > LIBDIR=${BASELIB} in do_install() and do_configure but those did not work
> > either. openssl builds scripts are quite hard to work with...
> 
> Isn't it easier to fix tpm2-openssl then?
> 
> I had similar issue in chip which was using "pkg-config
> --variable=prefix openssl" and didn't expect it to be empty in "if
> prefix[-4] == '/usr'" and rather patched chip than changing openssl.

To me this is a bug/regression in openssl pkg-config since libdir changed
from /usr/lib to /usr which doesn't work for same use cases anymore.

Cheers,

-Mikko
Ross Burton May 3, 2024, 10:48 a.m. UTC | #5
On 3 May 2024, at 11:43, Martin Jansa via lists.openembedded.org <martin.jansa=gmail.com@lists.openembedded.org> wrote:
> Isn't it easier to fix tpm2-openssl then?
> 
> I had similar issue in chip which was using "pkg-config
> --variable=prefix openssl" and didn't expect it to be empty in "if
> prefix[-4] == '/usr'" and rather patched chip than changing openssl.

The libdir variable in the .pc _is_ wrong and the documentation clearly states that —libdir is the name of the directory under prefix (is ${baselib).  Building it outside of Yocto with —prefix=/foo —libdir=bar correctly sets libdir as /foo/bar so we should be able to do the right thing and indeed I have a patch that fixes this and cleans up some other nonsense:

/work/ross/build/tmp/sysroots-components/cortexa57/openssl$ cat usr/lib/pkgconfig/openssl.pc
libdir=/usr/lib

Ross
Martin Jansa May 3, 2024, 10:49 a.m. UTC | #6
On Fri, May 3, 2024 at 12:46 PM Mikko Rapeli <mikko.rapeli@linaro.org> wrote:
>
> Hi,
>
> On Fri, May 03, 2024 at 12:43:29PM +0200, Martin Jansa wrote:
> > On Fri, May 3, 2024 at 12:37 PM Mikko Rapeli via
> > lists.openembedded.org
> > <mikko.rapeli=linaro.org@lists.openembedded.org> wrote:
> > >
> > > Hi,
> > >
> > > On Fri, May 03, 2024 at 12:32:42PM +0200, Alexander Kanavin wrote:
> > > > I’m sorry, this doesn’t look right. Shouldn’t we rather ensure $(LIBDIR) is
> > > > correctly set? Besides, hardcoding to lib is certainly incorrect as it will
> > > > break multilib. We constantly have to fix upstreams in the opposite
> > > > direction.
> > >
> > > Yes, you and Ross on #yocto are right. This is not right. I tried also setting
> > > LIBDIR=${BASELIB} in do_install() and do_configure but those did not work
> > > either. openssl builds scripts are quite hard to work with...
> >
> > Isn't it easier to fix tpm2-openssl then?
> >
> > I had similar issue in chip which was using "pkg-config
> > --variable=prefix openssl" and didn't expect it to be empty in "if
> > prefix[-4] == '/usr'" and rather patched chip than changing openssl.
>
> To me this is a bug/regression in openssl pkg-config since libdir changed
> from /usr/lib to /usr which doesn't work for same use cases anymore.

OK, then it would be appropriate to report and resolve with openssl
upstream, right? Not with Inappropriate .patch :).
diff mbox series

Patch

diff --git a/meta/recipes-connectivity/openssl/openssl/openssl_pkg-config_libdir.patch b/meta/recipes-connectivity/openssl/openssl/openssl_pkg-config_libdir.patch
new file mode 100644
index 0000000000..e3b4249a69
--- /dev/null
+++ b/meta/recipes-connectivity/openssl/openssl/openssl_pkg-config_libdir.patch
@@ -0,0 +1,31 @@ 
+openssl: fix pkg-config file libdir from /usr back to /usr/lib
+
+openssl update from 3.2.1 to 3.3.0 changed pkg-config generators
+and libdir changed from /usr/lib to /lib. This breaks builds
+of recipes which use openssl pkg-config files for library install
+etc paths. For example meta-security tpm2-openssl fails to build:
+
+ERROR: mc:trs-qemuarm64:tpm2-openssl-1.1.1-r0 do_package: QA Issue: tpm2-openssl: Files/directories were installed but not shipped in any package:
+  /usr/ossl-modules/tpm2.so
+
+Affected pkg-config files are: libssl.pc, openssl.pc and libcrypto.pc
+
+Fix this by hard coding LIBDIR variable to "lib". Prefix should
+be correctly used as before.
+
+Upstream-Status: Inappropriate [configuration change]
+
+Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
+
+--- a/exporters/build.info
++++ b/exporters/build.info
+@@ -19,7 +19,7 @@ DEPEND[openssl.pc]=libcrypto.pc libssl.pc
+ DEPEND[""]=openssl.pc
+ 
+ GENERATE[../installdata.pm]=../util/mkinstallvars.pl \
+-    "PREFIX=$(INSTALLTOP)" BINDIR=bin "LIBDIR=$(LIBDIR)" \
++    "PREFIX=$(INSTALLTOP)" BINDIR=bin LIBDIR=lib \
+     INCLUDEDIR=include APPLINKDIR=include/openssl \
+     "ENGINESDIR=$(ENGINESDIR)" "MODULESDIR=$(MODULESDIR)" \
+     "PKGCONFIGDIR=$(PKGCONFIGDIR)" "CMAKECONFIGDIR=$(CMAKECONFIGDIR)" \
+
diff --git a/meta/recipes-connectivity/openssl/openssl_3.3.0.bb b/meta/recipes-connectivity/openssl/openssl_3.3.0.bb
index 2cdaf4c75d..5ee8375ebc 100644
--- a/meta/recipes-connectivity/openssl/openssl_3.3.0.bb
+++ b/meta/recipes-connectivity/openssl/openssl_3.3.0.bb
@@ -13,6 +13,7 @@  SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \
            file://0001-Configure-do-not-tweak-mips-cflags.patch \
            file://0001-Added-handshake-history-reporting-when-test-fails.patch \
            file://bti.patch \
+           file://openssl_pkg-config_libdir.patch \
            "
 
 SRC_URI:append:class-nativesdk = " \