Skip to contentSkip to conversation

pcapplusplus: add new recipe

PATCH In review Christian Eggers 3 participants 5 messages Feb 17, 2022 – Feb 21, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pcapplusplus: add new recipe

"A multiplatform C++ library for capturing, parsing and crafting of network packets"

PcapPlusPlus uses as custom build system (shell script + Makefile). There were attempts for using cmake but this work has never been finished.

---
 .../pcapplusplus/pcapplusplus_21.11.bb        | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_21.11.bb
meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_21.11.bb new file +40 -0
new file mode 100644
index 000000000000..0d2f83cf4af7
@@ -0,0 +1,40 @@
+SUMMARY = "A multiplatform C++ library for capturing, parsing and crafting of network packets"
+HOMEPAGE = "https://pcapplusplus.github.io/"
+BUGTRACKER = "https://github.com/seladb/PcapPlusPlus/issues"
+SECTION = "libs/network"
+LICENSE = "Unlicense"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=911690f51af322440237a253d695d19f"
+
+DEPENDS = "libpcap"
+
+SRC_URI = "git://github.com/seladb/PcapPlusPlus.git;protocol=https;branch=master"
+SRCREV = "ddce58723a4ef7ab19bf1507e6323990b4d2d15e"
+
+S = "${WORKDIR}/git"
+
+EXTRA_CONF:libc-musl += "--musl"
+# PcapPlusPlus uses a custom shell script for configuration
+do_configure () {
+    # must use the --default switch only if no other switches are set
+    mkdir -p "${D}${prefix}"
+    ./configure-linux.sh --install-dir "${D}${prefix}" ${EXTRA_CONF}
+}
+
+do_compile () {
+    # build only libs
+    oe_runmake libs
+}
+
+do_install () {
+    # install script uses PKG_CONFIG_PATH as destination path for .pc files
+    export PKG_CONFIG_PATH="${D}${libdir}/pkgconfig"
+    oe_runmake install
+    # remove example makefile
+    rm -rf "${D}${prefix}/etc"
+    # remove ${D} in .pc file
+    sed -i "s@${D}@@g" ${D}${libdir}/pkgconfig/*.pc
+    chown -R root:root ${D}${libdir}/pkgconfig/*.pc
+}
+
+# main package is empty
+RDEPENDS:${PN}-dev = ""
Signature · 1 line
2.34.1
#1 lore raw

Hi Christian,

Quoted 7 lines · Christian Eggers

"A multiplatform C++ library for capturing, parsing and crafting of network packets"

PcapPlusPlus uses as custom build system (shell script + Makefile). There were attempts for using cmake but this work has never been finished.

Work is still ongoing by me
(https://github.com/seladb/PcapPlusPlus/pull/652), Review and help is welcome :)

Quoted 18 lines
---
 .../pcapplusplus/pcapplusplus_21.11.bb        | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_21.11.bb
meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_21.11.bb new file +5 -0
new file mode 100644
index 000000000000..0d2f83cf4af7
@@ -0,0 +1,40 @@
+SUMMARY = "A multiplatform C++ library for capturing, parsing and crafting of network packets"
+HOMEPAGE = "https://pcapplusplus.github.io/"
+BUGTRACKER = "https://github.com/seladb/PcapPlusPlus/issues"
+SECTION = "libs/network"
+LICENSE = "Unlicense"

meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_21.11.bb line 15

Quoted 10 lines
meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_21.11.bb new file +10 -0
+LIC_FILES_CHKSUM = "file://LICENSE;md5=911690f51af322440237a253d695d19f"
+
+DEPENDS = "libpcap"
+
+SRC_URI = "git://github.com/seladb/PcapPlusPlus.git;protocol=https;branch=master"
+SRCREV = "ddce58723a4ef7ab19bf1507e6323990b4d2d15e"
+
+S = "${WORKDIR}/git"
+
+EXTRA_CONF:libc-musl += "--musl"

I think there is one fix required to build musl
https://github.com/seladb/PcapPlusPlus/commit/0607f5ccb7a26bc1567908507e46603e7c16b1ac

Quoted 15 lines
meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_21.11.bb new file +15 -0
+# PcapPlusPlus uses a custom shell script for configuration
+do_configure () {
+    # must use the --default switch only if no other switches are set
+    mkdir -p "${D}${prefix}"
+    ./configure-linux.sh --install-dir "${D}${prefix}" ${EXTRA_CONF}
+}
+
+do_compile () {
+    # build only libs
+    oe_runmake libs
+}
+
+do_install () {
+    # install script uses PKG_CONFIG_PATH as destination path for .pc files
+    export PKG_CONFIG_PATH="${D}${libdir}/pkgconfig"

meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_21.11.bb line 40

Quoted 10 lines
meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_21.11.bb new file +10 -0
+    oe_runmake install
+    # remove example makefile
+    rm -rf "${D}${prefix}/etc"
+    # remove ${D} in .pc file
+    sed -i "s@${D}@@g" ${D}${libdir}/pkgconfig/*.pc
+    chown -R root:root ${D}${libdir}/pkgconfig/*.pc
+}
+
+# main package is empty
+RDEPENDS:${PN}-dev = ""

Why not use ALLOW_EMPTY here ?

Quoted 12 lines

--
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#95358): https://lists.openembedded.org/g/openembedded-devel/message/95358
Mute This Topic: https://lists.openembedded.org/mt/89210336/4240582
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw
Quoted 8 lines · Clément Péron

Hi Christian,

Quoted 4 lines · Christian Eggers

"A multiplatform C++ library for capturing, parsing and crafting of network packets"

Quoted 7 lines
Quoted 3 lines

PcapPlusPlus uses as custom build system (shell script + Makefile). There were attempts for using cmake but this work has never been finished.

Work is still ongoing by me
(https://github.com/seladb/PcapPlusPlus/pull/652), Review and help is welcome :)

this fails on riscv32 which has 64bit time_t on by default unlike older 32bit architectures
see
https://errors.yoctoproject.org/Errors/Details/629829/

Quoted 23 lines
Quoted 23 lines
---
 .../pcapplusplus/pcapplusplus_21.11.bb        | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_21.11.bb
meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_21.11.bb new file +9 -0
new file mode 100644
index 000000000000..0d2f83cf4af7
@@ -0,0 +1,40 @@
+SUMMARY = "A multiplatform C++ library for capturing, parsing and crafting of network packets"
+HOMEPAGE = "https://pcapplusplus.github.io/"
+BUGTRACKER = "https://github.com/seladb/PcapPlusPlus/issues"
+SECTION = "libs/network"
+LICENSE = "Unlicense"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=911690f51af322440237a253d695d19f"
+
+DEPENDS = "libpcap"
+
Quoted 9 lines

meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_21.11.bb line 15

Quoted 6 lines
meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_21.11.bb new file +6 -0
+SRC_URI = "git://github.com/seladb/PcapPlusPlus.git;protocol=https;branch=master"
+SRCREV = "ddce58723a4ef7ab19bf1507e6323990b4d2d15e"
+
+S = "${WORKDIR}/git"
+
+EXTRA_CONF:libc-musl += "--musl"

I think there is one fix required to build musl
https://github.com/seladb/PcapPlusPlus/commit/0607f5ccb7a26bc1567908507e46603e7c16b1ac

additionally we should be using

EXTRA_CONF:append:libc-musl = " --musl"

Quoted 19 lines
Quoted 19 lines
meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_21.11.bb new file +19 -0
+# PcapPlusPlus uses a custom shell script for configuration
+do_configure () {
+    # must use the --default switch only if no other switches are set
+    mkdir -p "${D}${prefix}"
+    ./configure-linux.sh --install-dir "${D}${prefix}" ${EXTRA_CONF}
+}
+
+do_compile () {
+    # build only libs
+    oe_runmake libs
+}
+
+do_install () {
+    # install script uses PKG_CONFIG_PATH as destination path for .pc files
+    export PKG_CONFIG_PATH="${D}${libdir}/pkgconfig"
+    oe_runmake install
+    # remove example makefile
+    rm -rf "${D}${prefix}/etc"
+    # remove ${D} in .pc file
Quoted 8 lines

meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_21.11.bb line 40

Quoted 6 lines
meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_21.11.bb new file +6 -0
+    sed -i "s@${D}@@g" ${D}${libdir}/pkgconfig/*.pc
+    chown -R root:root ${D}${libdir}/pkgconfig/*.pc
+}
+
+# main package is empty
+RDEPENDS:${PN}-dev = ""

Why not use ALLOW_EMPTY here ?

lesser of two evils.

Quoted 16 lines
Quoted 7 lines

--
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#95390): https://lists.openembedded.org/g/openembedded-devel/message/95390
Mute This Topic: https://lists.openembedded.org/mt/89210336/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw
Quoted 13 lines · Khem Raj
Quoted 12 lines · Clément Péron

Hi Christian,

Quoted 7 lines · Christian Eggers

"A multiplatform C++ library for capturing, parsing and crafting of network packets"

PcapPlusPlus uses as custom build system (shell script + Makefile). There were attempts for using cmake but this work has never been finished.

Quoted 8 lines
Quoted 3 lines

Work is still ongoing by me
(https://github.com/seladb/PcapPlusPlus/pull/652), Review and help is welcome :)

this fails on riscv32 which has 64bit time_t on by default unlike older 32bit architectures
see
https://errors.yoctoproject.org/Errors/Details/629829/

I see the same problem locally on 32 bit ARM/musl, but only as a warning, not as an error.

The C++ code converts from from struct timeval to struct timespec:
https://github.com/seladb/PcapPlusPlus/blob/master/Pcap%2B%2B/src/NetworkUtils.cpp#L172

struct timeval uses 'suseconds_t' for tv_usec which is _Int64 on musl, while struct timespec uses 'long' for tv_nsec.

1. I think that conversion from useconds to nseconds requires multiplication with 1000.
2. Is there any problem casting from 'suseconds_t' to 'long'? I guess that nanoseconds cannot exceed 32 bit.

Quoted 9 lines
Quoted 5 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+EXTRA_CONF:libc-musl += "--musl"

I think there is one fix required to build musl
https://github.com/seladb/PcapPlusPlus/commit/0607f5ccb7a26bc1567908507e46603e7c16b1ac

additionally we should be using

EXTRA_CONF:append:libc-musl = " --musl"

From bitbake user manual:

Quoted 1 line

These operators differ from the ":=", ".=", "=.", "+=", and "=+" operators in that their effects are applied at variable expansion time rather than being immediately applied.

What is the reason for using override style here?

Quoted 6 lines
Quoted 4 lines

meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_21.11.bb line 40

Quoted 2 lines
meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_21.11.bb new file +2 -0
+# main package is empty
+RDEPENDS:${PN}-dev = ""

Why not use ALLOW_EMPTY here ?

lesser of two evils.

RDEPENDS:${PN}-dev = "" is used several times in oe-core / meta-openembedded. Some comments show that this is for the same reason (empty main package). Would it be useful to covert some/all occurrences?

#4 lore raw
In reply to Christian Eggers

it seems to suffer from build race as well see
https://autobuilder.yoctoproject.org/typhoon/#/builders/88/builds/1447

DEBUG: Executing shell function do_compile

| NOTE: make -j 16 -l 52 libs
| ==== Building target: Common++ ====
| Building file: src/MacAddress.cpp
| Assembler messages:
| Fatal error: can't create Obj/MacAddress.o: No such file or
directory
| make[1]: *** [Makefile:51: Obj/MacAddress.o] Error 2
| make: *** [Makefile:91: libs] Error 2
| ERROR: oe_runmake failed
Quoted 72 lines · Christian Eggers

"A multiplatform C++ library for capturing, parsing and crafting of network packets"

PcapPlusPlus uses as custom build system (shell script + Makefile). There were attempts for using cmake but this work has never been finished.

---
 .../pcapplusplus/pcapplusplus_21.11.bb        | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_21.11.bb
meta-oe/recipes-connectivity/pcapplusplus/pcapplusplus_21.11.bb new file +40 -1
new file mode 100644
index 000000000000..0d2f83cf4af7
@@ -0,0 +1,40 @@
+SUMMARY = "A multiplatform C++ library for capturing, parsing and crafting of network packets"
+HOMEPAGE = "https://pcapplusplus.github.io/"
+BUGTRACKER = "https://github.com/seladb/PcapPlusPlus/issues"
+SECTION = "libs/network"
+LICENSE = "Unlicense"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=911690f51af322440237a253d695d19f"
+
+DEPENDS = "libpcap"
+
+SRC_URI = "git://github.com/seladb/PcapPlusPlus.git;protocol=https;branch=master"
+SRCREV = "ddce58723a4ef7ab19bf1507e6323990b4d2d15e"
+
+S = "${WORKDIR}/git"
+
+EXTRA_CONF:libc-musl += "--musl"
+# PcapPlusPlus uses a custom shell script for configuration
+do_configure () {
+    # must use the --default switch only if no other switches are set
+    mkdir -p "${D}${prefix}"
+    ./configure-linux.sh --install-dir "${D}${prefix}" ${EXTRA_CONF}
+}
+
+do_compile () {
+    # build only libs
+    oe_runmake libs
+}
+
+do_install () {
+    # install script uses PKG_CONFIG_PATH as destination path for .pc files
+    export PKG_CONFIG_PATH="${D}${libdir}/pkgconfig"
+    oe_runmake install
+    # remove example makefile
+    rm -rf "${D}${prefix}/etc"
+    # remove ${D} in .pc file
+    sed -i "s@${D}@@g" ${D}${libdir}/pkgconfig/*.pc
+    chown -R root:root ${D}${libdir}/pkgconfig/*.pc
+}
+
+# main package is empty
+RDEPENDS:${PN}-dev = ""
--

2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#95358): https://lists.openembedded.org/g/openembedded-devel/message/95358
Mute This Topic: https://lists.openembedded.org/mt/89210336/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-