diff mbox series

[meta-oe,v2] cryptopp: add a recipe for version 8.9.0

Message ID 20241122-add-cryptopp-v2-1-19456062f791@bootlin.com
State Under Review
Headers show
Series [meta-oe,v2] cryptopp: add a recipe for version 8.9.0 | expand

Commit Message

Antonin Godard Nov. 22, 2024, 2:11 p.m. UTC
Cryptopp is a library of cryptographic schemes written in C++.

Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
I had issues compiling for qemuarm64, which are close to
https://github.com/weidai11/cryptopp/issues/565. One of the solution is
to disable ASM, so do that for aarch64. I don't observe the issue with
qemuarm.
---
Changes in v2:
- WORKDIR -> UNPACKDIR in S
- remove bb.utils.contains in CXXFLAGS:append:aarch64 (forgot to remove
  after adding aarch64 override)
- Link to v1: https://lore.kernel.org/r/20241121-add-cryptopp-v1-1-36382a60cecb@bootlin.com
---
 meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb | 45 +++++++++++++++++++++++
 1 file changed, 45 insertions(+)


---
base-commit: 71ffb63f60b233722ec9d8b50bfe0488997fbcfa
change-id: 20241121-add-cryptopp-f78794be963c

Best regards,

Comments

Khem Raj Nov. 22, 2024, 4:32 p.m. UTC | #1
On Fri, Nov 22, 2024 at 6:11 AM Antonin Godard via
lists.openembedded.org
<antonin.godard=bootlin.com@lists.openembedded.org> wrote:
>
> Cryptopp is a library of cryptographic schemes written in C++.
>
> Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
> ---
> I had issues compiling for qemuarm64, which are close to
> https://github.com/weidai11/cryptopp/issues/565. One of the solution is
> to disable ASM, so do that for aarch64. I don't observe the issue with
> qemuarm.
> ---
> Changes in v2:
> - WORKDIR -> UNPACKDIR in S
> - remove bb.utils.contains in CXXFLAGS:append:aarch64 (forgot to remove
>   after adding aarch64 override)
> - Link to v1: https://lore.kernel.org/r/20241121-add-cryptopp-v1-1-36382a60cecb@bootlin.com
> ---
>  meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb | 45 +++++++++++++++++++++++
>  1 file changed, 45 insertions(+)
>
> diff --git a/meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb b/meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb
> new file mode 100644
> index 0000000000000000000000000000000000000000..a3d4fedb2f67c0111dcd262081b622cfbdd40b57
> --- /dev/null
> +++ b/meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb
> @@ -0,0 +1,45 @@
> +SUMMARY = "A C++ class library of cryptographic schemes"
> +DESCRIPTION = "Crypto++ Library is a C++ class library of cryptographic schemes"
> +CVE_PRODUCT = "cryptopp"
> +HOMEPAGE = "http://www.cryptopp.com/"
> +SECTION = "libs"
> +LICENSE = "BSL-1.0"
> +LIC_FILES_CHKSUM = "file://License.txt;md5=ca6dacb7ef68b1ab5dfa3bed24c12003"
> +
> +SRC_URI = "git://github.com/weidai11/cryptopp.git;protocol=https;branch=master"
> +SRCREV = "843d74c7c97f9e19a615b8ff3c0ca06599ca501b"
> +
> +S = "${UNPACKDIR}/git"

This should be WORKDIR/git here.

> +
> +inherit pkgconfig
> +
> +CXXFLAGS:append = " -fPIC"

maybe use += here.

> +# Avoid target mismatch error
> +CXXFLAGS:append:aarch64 = " -DCRYPTOPP_DISABLE_ASM=1"

This will build suboptimally. It would be better to fix the issue in
Makefile to use compatible options.

> +EXTRA_OEMAKE += "HAS_SOLIB_VERSION=1"
> +
> +do_compile () {
> +    oe_runmake -f GNUmakefile-cross libcryptopp.a libcryptopp.so cryptest.exe
> +}
> +
> +do_install () {
> +    DESTDIR="${D}" \
> +        BINDIR="${bindir}" \
> +        DATADIR="${datadir}" \
> +        INCLUDEDIR="${includedir}" \
> +        LIBDIR="${libdir}" \
> +        oe_runmake install
> +
> +    # Rename cryptest.exe to cryptest
> +    if [ -f "${D}${bindir}/cryptest.exe" ]; then
> +        mv "${D}${bindir}/cryptest.exe" "${D}${bindir}/cryptest"
> +    fi
> +}
> +
> +PACKAGE_BEFORE_PN += "${PN}-cryptest ${PN}-testdata ${PN}-testvectors"
> +
> +FILES:${PN}-cryptest = "${bindir}/cryptest"
> +FILES:${PN}-testdata = "${datadir}/cryptopp/TestData"
> +FILES:${PN}-testvectors = "${datadir}/cryptopp/TestVectors"
> +
> +BBCLASSEXTEND = "native nativesdk"
>
> ---
> base-commit: 71ffb63f60b233722ec9d8b50bfe0488997fbcfa
> change-id: 20241121-add-cryptopp-f78794be963c
>
> Best regards,
> --
> Antonin Godard <antonin.godard@bootlin.com>
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#114001): https://lists.openembedded.org/g/openembedded-devel/message/114001
> Mute This Topic: https://lists.openembedded.org/mt/109722638/1997914
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Khem Raj Nov. 23, 2024, 8:47 p.m. UTC | #2
also fails on qemux86-64/musl

https://0x0.st/X5_h.do_compi

On Fri, Nov 22, 2024 at 8:32 AM Khem Raj <raj.khem@gmail.com> wrote:
>
> On Fri, Nov 22, 2024 at 6:11 AM Antonin Godard via
> lists.openembedded.org
> <antonin.godard=bootlin.com@lists.openembedded.org> wrote:
> >
> > Cryptopp is a library of cryptographic schemes written in C++.
> >
> > Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
> > ---
> > I had issues compiling for qemuarm64, which are close to
> > https://github.com/weidai11/cryptopp/issues/565. One of the solution is
> > to disable ASM, so do that for aarch64. I don't observe the issue with
> > qemuarm.
> > ---
> > Changes in v2:
> > - WORKDIR -> UNPACKDIR in S
> > - remove bb.utils.contains in CXXFLAGS:append:aarch64 (forgot to remove
> >   after adding aarch64 override)
> > - Link to v1: https://lore.kernel.org/r/20241121-add-cryptopp-v1-1-36382a60cecb@bootlin.com
> > ---
> >  meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb | 45 +++++++++++++++++++++++
> >  1 file changed, 45 insertions(+)
> >
> > diff --git a/meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb b/meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb
> > new file mode 100644
> > index 0000000000000000000000000000000000000000..a3d4fedb2f67c0111dcd262081b622cfbdd40b57
> > --- /dev/null
> > +++ b/meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb
> > @@ -0,0 +1,45 @@
> > +SUMMARY = "A C++ class library of cryptographic schemes"
> > +DESCRIPTION = "Crypto++ Library is a C++ class library of cryptographic schemes"
> > +CVE_PRODUCT = "cryptopp"
> > +HOMEPAGE = "http://www.cryptopp.com/"
> > +SECTION = "libs"
> > +LICENSE = "BSL-1.0"
> > +LIC_FILES_CHKSUM = "file://License.txt;md5=ca6dacb7ef68b1ab5dfa3bed24c12003"
> > +
> > +SRC_URI = "git://github.com/weidai11/cryptopp.git;protocol=https;branch=master"
> > +SRCREV = "843d74c7c97f9e19a615b8ff3c0ca06599ca501b"
> > +
> > +S = "${UNPACKDIR}/git"
>
> This should be WORKDIR/git here.
>
> > +
> > +inherit pkgconfig
> > +
> > +CXXFLAGS:append = " -fPIC"
>
> maybe use += here.
>
> > +# Avoid target mismatch error
> > +CXXFLAGS:append:aarch64 = " -DCRYPTOPP_DISABLE_ASM=1"
>
> This will build suboptimally. It would be better to fix the issue in
> Makefile to use compatible options.
>
> > +EXTRA_OEMAKE += "HAS_SOLIB_VERSION=1"
> > +
> > +do_compile () {
> > +    oe_runmake -f GNUmakefile-cross libcryptopp.a libcryptopp.so cryptest.exe
> > +}
> > +
> > +do_install () {
> > +    DESTDIR="${D}" \
> > +        BINDIR="${bindir}" \
> > +        DATADIR="${datadir}" \
> > +        INCLUDEDIR="${includedir}" \
> > +        LIBDIR="${libdir}" \
> > +        oe_runmake install
> > +
> > +    # Rename cryptest.exe to cryptest
> > +    if [ -f "${D}${bindir}/cryptest.exe" ]; then
> > +        mv "${D}${bindir}/cryptest.exe" "${D}${bindir}/cryptest"
> > +    fi
> > +}
> > +
> > +PACKAGE_BEFORE_PN += "${PN}-cryptest ${PN}-testdata ${PN}-testvectors"
> > +
> > +FILES:${PN}-cryptest = "${bindir}/cryptest"
> > +FILES:${PN}-testdata = "${datadir}/cryptopp/TestData"
> > +FILES:${PN}-testvectors = "${datadir}/cryptopp/TestVectors"
> > +
> > +BBCLASSEXTEND = "native nativesdk"
> >
> > ---
> > base-commit: 71ffb63f60b233722ec9d8b50bfe0488997fbcfa
> > change-id: 20241121-add-cryptopp-f78794be963c
> >
> > Best regards,
> > --
> > Antonin Godard <antonin.godard@bootlin.com>
> >
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#114001): https://lists.openembedded.org/g/openembedded-devel/message/114001
> > Mute This Topic: https://lists.openembedded.org/mt/109722638/1997914
> > Group Owner: openembedded-devel+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [raj.khem@gmail.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
Martin Jansa April 10, 2025, 7:09 a.m. UTC | #3
Hi Antonin,

are you going to address the failures reported by Khem? it would be
nice to get this merged.

Cheers,

On Sat, Nov 23, 2024 at 9:48 PM Khem Raj via lists.openembedded.org
<raj.khem=gmail.com@lists.openembedded.org> wrote:
>
> also fails on qemux86-64/musl
>
> https://0x0.st/X5_h.do_compi
>
> On Fri, Nov 22, 2024 at 8:32 AM Khem Raj <raj.khem@gmail.com> wrote:
> >
> > On Fri, Nov 22, 2024 at 6:11 AM Antonin Godard via
> > lists.openembedded.org
> > <antonin.godard=bootlin.com@lists.openembedded.org> wrote:
> > >
> > > Cryptopp is a library of cryptographic schemes written in C++.
> > >
> > > Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
> > > ---
> > > I had issues compiling for qemuarm64, which are close to
> > > https://github.com/weidai11/cryptopp/issues/565. One of the solution is
> > > to disable ASM, so do that for aarch64. I don't observe the issue with
> > > qemuarm.
> > > ---
> > > Changes in v2:
> > > - WORKDIR -> UNPACKDIR in S
> > > - remove bb.utils.contains in CXXFLAGS:append:aarch64 (forgot to remove
> > >   after adding aarch64 override)
> > > - Link to v1: https://lore.kernel.org/r/20241121-add-cryptopp-v1-1-36382a60cecb@bootlin.com
> > > ---
> > >  meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb | 45 +++++++++++++++++++++++
> > >  1 file changed, 45 insertions(+)
> > >
> > > diff --git a/meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb b/meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb
> > > new file mode 100644
> > > index 0000000000000000000000000000000000000000..a3d4fedb2f67c0111dcd262081b622cfbdd40b57
> > > --- /dev/null
> > > +++ b/meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb
> > > @@ -0,0 +1,45 @@
> > > +SUMMARY = "A C++ class library of cryptographic schemes"
> > > +DESCRIPTION = "Crypto++ Library is a C++ class library of cryptographic schemes"
> > > +CVE_PRODUCT = "cryptopp"
> > > +HOMEPAGE = "http://www.cryptopp.com/"
> > > +SECTION = "libs"
> > > +LICENSE = "BSL-1.0"
> > > +LIC_FILES_CHKSUM = "file://License.txt;md5=ca6dacb7ef68b1ab5dfa3bed24c12003"
> > > +
> > > +SRC_URI = "git://github.com/weidai11/cryptopp.git;protocol=https;branch=master"
> > > +SRCREV = "843d74c7c97f9e19a615b8ff3c0ca06599ca501b"
> > > +
> > > +S = "${UNPACKDIR}/git"
> >
> > This should be WORKDIR/git here.
> >
> > > +
> > > +inherit pkgconfig
> > > +
> > > +CXXFLAGS:append = " -fPIC"
> >
> > maybe use += here.
> >
> > > +# Avoid target mismatch error
> > > +CXXFLAGS:append:aarch64 = " -DCRYPTOPP_DISABLE_ASM=1"
> >
> > This will build suboptimally. It would be better to fix the issue in
> > Makefile to use compatible options.
> >
> > > +EXTRA_OEMAKE += "HAS_SOLIB_VERSION=1"
> > > +
> > > +do_compile () {
> > > +    oe_runmake -f GNUmakefile-cross libcryptopp.a libcryptopp.so cryptest.exe
> > > +}
> > > +
> > > +do_install () {
> > > +    DESTDIR="${D}" \
> > > +        BINDIR="${bindir}" \
> > > +        DATADIR="${datadir}" \
> > > +        INCLUDEDIR="${includedir}" \
> > > +        LIBDIR="${libdir}" \
> > > +        oe_runmake install
> > > +
> > > +    # Rename cryptest.exe to cryptest
> > > +    if [ -f "${D}${bindir}/cryptest.exe" ]; then
> > > +        mv "${D}${bindir}/cryptest.exe" "${D}${bindir}/cryptest"
> > > +    fi
> > > +}
> > > +
> > > +PACKAGE_BEFORE_PN += "${PN}-cryptest ${PN}-testdata ${PN}-testvectors"
> > > +
> > > +FILES:${PN}-cryptest = "${bindir}/cryptest"
> > > +FILES:${PN}-testdata = "${datadir}/cryptopp/TestData"
> > > +FILES:${PN}-testvectors = "${datadir}/cryptopp/TestVectors"
> > > +
> > > +BBCLASSEXTEND = "native nativesdk"
> > >
> > > ---
> > > base-commit: 71ffb63f60b233722ec9d8b50bfe0488997fbcfa
> > > change-id: 20241121-add-cryptopp-f78794be963c
> > >
> > > Best regards,
> > > --
> > > Antonin Godard <antonin.godard@bootlin.com>
> > >
> > >
> > >
> > >
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#114023): https://lists.openembedded.org/g/openembedded-devel/message/114023
> Mute This Topic: https://lists.openembedded.org/mt/109722638/3617156
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [martin.jansa@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Antonin Godard April 10, 2025, 7:48 a.m. UTC | #4
Hi Martin,

On Thu Apr 10, 2025 at 9:09 AM CEST, Martin Jansa wrote:
> Hi Antonin,
>
> are you going to address the failures reported by Khem? it would be
> nice to get this merged.

I'd love to, but I tried digging deeper into this and kept hitting various
errors on the aarch64 build when removing CRYPTOPP_DISABLE_ASM (target mismatch
errors). From memory, cryptopp's makefile tries to guess a lot of processor
optimizations, which doesn't really make sense in our context since OE sets all
of that already. But even removing all of those still doesn't cut it, and I was
basically out of time to spend on this. :/

We could perhaps live with CRYPTOPP_DISABLE_ASM on aarch64, but other errors on
qemux86-64/musl needs to be dealt with.

If you want to take a look I can send you more details about what I tried doing.
I'd be happy to have this merged in meta-oe too.

Regards,
Antonin

--
Antonin Godard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
diff mbox series

Patch

diff --git a/meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb b/meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb
new file mode 100644
index 0000000000000000000000000000000000000000..a3d4fedb2f67c0111dcd262081b622cfbdd40b57
--- /dev/null
+++ b/meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb
@@ -0,0 +1,45 @@ 
+SUMMARY = "A C++ class library of cryptographic schemes"
+DESCRIPTION = "Crypto++ Library is a C++ class library of cryptographic schemes"
+CVE_PRODUCT = "cryptopp"
+HOMEPAGE = "http://www.cryptopp.com/"
+SECTION = "libs"
+LICENSE = "BSL-1.0"
+LIC_FILES_CHKSUM = "file://License.txt;md5=ca6dacb7ef68b1ab5dfa3bed24c12003"
+
+SRC_URI = "git://github.com/weidai11/cryptopp.git;protocol=https;branch=master"
+SRCREV = "843d74c7c97f9e19a615b8ff3c0ca06599ca501b"
+
+S = "${UNPACKDIR}/git"
+
+inherit pkgconfig
+
+CXXFLAGS:append = " -fPIC"
+# Avoid target mismatch error
+CXXFLAGS:append:aarch64 = " -DCRYPTOPP_DISABLE_ASM=1"
+EXTRA_OEMAKE += "HAS_SOLIB_VERSION=1"
+
+do_compile () {
+    oe_runmake -f GNUmakefile-cross libcryptopp.a libcryptopp.so cryptest.exe
+}
+
+do_install () {
+    DESTDIR="${D}" \
+        BINDIR="${bindir}" \
+        DATADIR="${datadir}" \
+        INCLUDEDIR="${includedir}" \
+        LIBDIR="${libdir}" \
+        oe_runmake install
+
+    # Rename cryptest.exe to cryptest
+    if [ -f "${D}${bindir}/cryptest.exe" ]; then
+        mv "${D}${bindir}/cryptest.exe" "${D}${bindir}/cryptest"
+    fi
+}
+
+PACKAGE_BEFORE_PN += "${PN}-cryptest ${PN}-testdata ${PN}-testvectors"
+
+FILES:${PN}-cryptest = "${bindir}/cryptest"
+FILES:${PN}-testdata = "${datadir}/cryptopp/TestData"
+FILES:${PN}-testvectors = "${datadir}/cryptopp/TestVectors"
+
+BBCLASSEXTEND = "native nativesdk"