Skip to contentSkip to conversation

cryptopp: add a recipe for version 8.9.0

PATCH Superseded Antonin Godard 3 participants 5 messages Nov 22, 2024 – Apr 10, 2025

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 cryptopp: add a recipe for version 8.9.0

Cryptopp is a library of cryptographic schemes written in C++.

---
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/[email protected]

---
 meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb | 45 +++++++++++++++++++++++
 1 file changed, 45 insertions(+)
meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb new file +45 -0
new file mode 100644
index 0000000000000000000000000000000000000000..a3d4fedb2f67c0111dcd262081b622cfbdd40b57
@@ -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"

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

Best regards,

Signature · 1 line
Antonin Godard <[email protected]>
#1 lore raw
Quoted 27 lines · Antonin Godard via lists.openembedded.org

Cryptopp is a library of cryptographic schemes written in C++.

---
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/[email protected]

---
 meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb | 45 +++++++++++++++++++++++
 1 file changed, 45 insertions(+)
meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb new file +2 -0
new file mode 100644
index 0000000000000000000000000000000000000000..a3d4fedb2f67c0111dcd262081b622cfbdd40b57
@@ -0,0 +1,45 @@
+SUMMARY = "A C++ class library of cryptographic schemes"
+DESCRIPTION = "Crypto++ Library is a C++ class library of cryptographic schemes"

meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb line 12

Quoted 10 lines
meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb new file +10 -0
+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.

meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb line 16

Quoted 4 lines
meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb new file +4 -0
+
+inherit pkgconfig
+
+CXXFLAGS:append = " -fPIC"

maybe use += here.

meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb line 18

Quoted 2 lines
meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb new file +2 -0
+# 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.

Quoted 45 lines
meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb new file +27 -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"
 
---

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

Best regards,
--
Antonin Godard <[email protected]>

-=-=-=-=-=-=-=-=-=-=-=-
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: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw

also fails on qemux86-64/musl

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

Quoted 102 lines · Khem Raj
Quoted 27 lines · Antonin Godard via lists.openembedded.org

Cryptopp is a library of cryptographic schemes written in C++.

---
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/[email protected]

---
 meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb | 45 +++++++++++++++++++++++
 1 file changed, 45 insertions(+)
meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb new file +2 -0
new file mode 100644
index 0000000000000000000000000000000000000000..a3d4fedb2f67c0111dcd262081b622cfbdd40b57
@@ -0,0 +1,45 @@
+SUMMARY = "A C++ class library of cryptographic schemes"
+DESCRIPTION = "Crypto++ Library is a C++ class library of cryptographic schemes"

meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb line 12

Quoted 10 lines
meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb new file +10 -0
+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.

meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb line 16

Quoted 4 lines
meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb new file +4 -0
+
+inherit pkgconfig
+
+CXXFLAGS:append = " -fPIC"

maybe use += here.

meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb line 18

Quoted 2 lines
meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb new file +2 -0
+# 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.

Quoted 45 lines
meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb new file +27 -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"
 
---

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

Best regards,
--
Antonin Godard <[email protected]>

-=-=-=-=-=-=-=-=-=-=-=-
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: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw

Hi Antonin,

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

Cheers,

Quoted 111 lines · Khem Raj via lists.openembedded.org

also fails on qemux86-64/musl

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

Quoted 89 lines · Khem Raj
Quoted 27 lines · Antonin Godard via lists.openembedded.org

Cryptopp is a library of cryptographic schemes written in C++.

---
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/[email protected]

---
 meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb | 45 +++++++++++++++++++++++
 1 file changed, 45 insertions(+)
meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb new file +2 -0
new file mode 100644
index 0000000000000000000000000000000000000000..a3d4fedb2f67c0111dcd262081b622cfbdd40b57
@@ -0,0 +1,45 @@
+SUMMARY = "A C++ class library of cryptographic schemes"
+DESCRIPTION = "Crypto++ Library is a C++ class library of cryptographic schemes"

meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb line 12

Quoted 10 lines
meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb new file +10 -0
+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.

meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb line 16

Quoted 4 lines
meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb new file +4 -0
+
+inherit pkgconfig
+
+CXXFLAGS:append = " -fPIC"

maybe use += here.

meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb line 18

Quoted 2 lines
meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb new file +2 -0
+# 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.

Quoted 32 lines
meta-oe/recipes-crypto/cryptopp/cryptopp_8.9.0.bb new file +27 -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"
 
---

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

Quoted 7 lines
Quoted 7 lines

Best regards,
--
Antonin Godard <[email protected]>

-=-=-=-=-=-=-=-=-=-=-=-
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: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#4 lore raw

Hi Martin,

Quoted 4 lines · Martin Jansa

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