diff options
| author | mark.yang <mark.yang@lge.com> | 2025-04-10 19:19:14 +0900 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2025-04-10 08:31:06 -0700 |
| commit | 8586c9e2e80614837df182a9a2d838629423ce93 (patch) | |
| tree | 37cfd1210e6cffc338ec0b75e593445a731aef09 /meta-networking | |
| parent | 86b20b84ec278cacf4975b7933d46b894d74796e (diff) | |
| download | meta-openembedded-8586c9e2e80614837df182a9a2d838629423ce93.tar.gz | |
tcpreplay: fix build error with gcc-15
There are two types of errors:
1. Linker errors for txring.c
TOPDIR/tmp/work/core2-64-oe-linux/tcpreplay/4.5.1/recipe-sysroot-native/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/15.0.1/ld: ./common/libcommon.a(sendpacket.o): in function `sendpacket':
/usr/src/debug/tcpreplay/4.5.1/src/common/sendpacket.c:328:(.text+0x1be): undefined reference to `txring_put'
TOPDIR/tmp/work/core2-64-oe-linux/tcpreplay/4.5.1/recipe-sysroot-native/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/15.0.1/ld: ./common/libcommon.a(sendpacket.o): in function `sendpacket_open_pf':
/usr/src/debug/tcpreplay/4.5.1/src/common/sendpacket.c:1088:(.text+0x7ea): undefined reference to `txring_init'
TOPDIR/tmp/work/core2-64-oe-linux/tcpreplay/4.5.1/recipe-sysroot-native/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/15.0.1/ld: ./common/libcommon.a(sendpacket.o): in function `sendpacket':
/usr/src/debug/tcpreplay/4.5.1/src/common/sendpacket.c:328:(.text+0x1be): undefined reference to `txring_put'
TOPDIR/tmp/work/core2-64-oe-linux/tcpreplay/4.5.1/recipe-sysroot-native/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/15.0.1/ld: ./common/libcommon.a(sendpacket.o): in function `sendpacket_open_pf':
/usr/src/debug/tcpreplay/4.5.1/src/common/sendpacket.c:1088:(.text+0x7ea): undefined reference to `txring_init'
TOPDIR/tmp/work/core2-64-oe-linux/tcpreplay/4.5.1/recipe-sysroot-native/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/15.0.1/ld: ./common/libcommon.a(sendpacket.o): in function `sendpacket':
/usr/src/debug/tcpreplay/4.5.1/src/common/sendpacket.c:328:(.text+0x1be): undefined reference to `txring_put'
TOPDIR/tmp/work/core2-64-oe-linux/tcpreplay/4.5.1/recipe-sysroot-native/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/15.0.1/ld: ./common/libcommon.a(sendpacket.o): in function `sendpacket_open_pf':
/usr/src/debug/tcpreplay/4.5.1/src/common/sendpacket.c:1088:(.text+0x7ea): undefined reference to `txring_init'
The txring file needs to include config.h to build properly.
Surprisingly, in the same environment with gcc14, HAVE_TX_RING is not declared in config.h because it fails during the configure stage.
The config.log below is from the same environment with gcc14.
configure:26549: result: no
configure:26557: checking for TX_RING socket sending support
configure:26579: conftest.c >&5
In file included from conftest.c:130:
/linux/if_packet.h:14:8: error: redefinition of 'struct sockaddr_ll'
14 | struct sockaddr_ll {
| ^~~~~~~~~~~
Therefore, it seems that the linker error did not occur previously.
2. Incompatible type assignment in txring.c when allocating memory for txring_t structure
Signed-off-by: mark.yang <mark.yang@lge.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-networking')
3 files changed, 104 insertions, 0 deletions
diff --git a/meta-networking/recipes-support/tcpreplay/tcpreplay/0001-Fix-linker-error-for-TX_RING.patch b/meta-networking/recipes-support/tcpreplay/tcpreplay/0001-Fix-linker-error-for-TX_RING.patch new file mode 100644 index 0000000000..d8f0ab270c --- /dev/null +++ b/meta-networking/recipes-support/tcpreplay/tcpreplay/0001-Fix-linker-error-for-TX_RING.patch | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | From 36e038d9e4047ae42a148f671f18971cc6a68558 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: "mark.yang" <mark.yang@lge.com> | ||
| 3 | Date: Thu, 10 Apr 2025 18:30:52 +0900 | ||
| 4 | Subject: [PATCH] Fix linker error for TX_RING | ||
| 5 | |||
| 6 | Found similar issue in gcc 15 build environment. | ||
| 7 | - See more details at: http://errors.yoctoproject.org/Errors/Details/851800/ | ||
| 8 | ``` | ||
| 9 | TOPDIR/tmp/work/core2-64-oe-linux/tcpreplay/4.5.1/recipe-sysroot-native/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/15.0.1/ld: ./common/libcommon.a(sendpacket.o): in function `sendpacket': | ||
| 10 | /usr/src/debug/tcpreplay/4.5.1/src/common/sendpacket.c:328:(.text+0x1be): undefined reference to `txring_put' | ||
| 11 | TOPDIR/tmp/work/core2-64-oe-linux/tcpreplay/4.5.1/recipe-sysroot-native/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/15.0.1/ld: ./common/libcommon.a(sendpacket.o): in function `sendpacket_open_pf': | ||
| 12 | /usr/src/debug/tcpreplay/4.5.1/src/common/sendpacket.c:1088:(.text+0x7ea): undefined reference to `txring_init' | ||
| 13 | TOPDIR/tmp/work/core2-64-oe-linux/tcpreplay/4.5.1/recipe-sysroot-native/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/15.0.1/ld: ./common/libcommon.a(sendpacket.o): in function `sendpacket': | ||
| 14 | /usr/src/debug/tcpreplay/4.5.1/src/common/sendpacket.c:328:(.text+0x1be): undefined reference to `txring_put' | ||
| 15 | TOPDIR/tmp/work/core2-64-oe-linux/tcpreplay/4.5.1/recipe-sysroot-native/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/15.0.1/ld: ./common/libcommon.a(sendpacket.o): in function `sendpacket_open_pf': | ||
| 16 | /usr/src/debug/tcpreplay/4.5.1/src/common/sendpacket.c:1088:(.text+0x7ea): undefined reference to `txring_init' | ||
| 17 | TOPDIR/tmp/work/core2-64-oe-linux/tcpreplay/4.5.1/recipe-sysroot-native/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/15.0.1/ld: ./common/libcommon.a(sendpacket.o): in function `sendpacket': | ||
| 18 | /usr/src/debug/tcpreplay/4.5.1/src/common/sendpacket.c:328:(.text+0x1be): undefined reference to `txring_put' | ||
| 19 | TOPDIR/tmp/work/core2-64-oe-linux/tcpreplay/4.5.1/recipe-sysroot-native/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/15.0.1/ld: ./common/libcommon.a(sendpacket.o): in function `sendpacket_open_pf': | ||
| 20 | /usr/src/debug/tcpreplay/4.5.1/src/common/sendpacket.c:1088:(.text+0x7ea): undefined reference to `txring_init' | ||
| 21 | ``` | ||
| 22 | - The result of "nm -u txring.o" shows no symbols exist. | ||
| 23 | |||
| 24 | - The config.h has HAVE_TX_RING defined but txring.c is not aware of it. | ||
| 25 | txring.c and txring.h include config.h at the beginning. | ||
| 26 | |||
| 27 | - This resulted in a successful build in my build environment. | ||
| 28 | |||
| 29 | It may | ||
| 30 | Fixes #731 | ||
| 31 | Fixes #904 | ||
| 32 | |||
| 33 | Upstream-Status: Submitted [https://github.com/appneta/tcpreplay/pull/924] | ||
| 34 | Signed-off-by: mark.yang <mark.yang@lge.com> | ||
| 35 | --- | ||
| 36 | src/common/txring.c | 3 +++ | ||
| 37 | src/common/txring.h | 4 ++-- | ||
| 38 | 2 files changed, 5 insertions(+), 2 deletions(-) | ||
| 39 | |||
| 40 | diff --git a/src/common/txring.c b/src/common/txring.c | ||
| 41 | index d5768d75..f522893d 100644 | ||
| 42 | --- a/src/common/txring.c | ||
| 43 | +++ b/src/common/txring.c | ||
| 44 | @@ -31,6 +31,9 @@ | ||
| 45 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 46 | */ | ||
| 47 | |||
| 48 | +#include "defines.h" | ||
| 49 | +#include "config.h" | ||
| 50 | + | ||
| 51 | #ifdef HAVE_TX_RING | ||
| 52 | |||
| 53 | #include "txring.h" | ||
| 54 | diff --git a/src/common/txring.h b/src/common/txring.h | ||
| 55 | index 309da84c..3f14cac0 100644 | ||
| 56 | --- a/src/common/txring.h | ||
| 57 | +++ b/src/common/txring.h | ||
| 58 | @@ -33,11 +33,11 @@ | ||
| 59 | |||
| 60 | #pragma once | ||
| 61 | |||
| 62 | -#ifdef HAVE_TX_RING | ||
| 63 | - | ||
| 64 | #include "defines.h" | ||
| 65 | #include "config.h" | ||
| 66 | |||
| 67 | +#ifdef HAVE_TX_RING | ||
| 68 | + | ||
| 69 | #if __GLIBC__ >= 2 && __GLIBC_MINOR >= 1 | ||
| 70 | #include <net/ethernet.h> /* the L2 protocols */ | ||
| 71 | #include <netpacket/packet.h> | ||
diff --git a/meta-networking/recipes-support/tcpreplay/tcpreplay/0002-fix-incompatible-type-assignment-in-txring.c.patch b/meta-networking/recipes-support/tcpreplay/tcpreplay/0002-fix-incompatible-type-assignment-in-txring.c.patch new file mode 100644 index 0000000000..906c30e147 --- /dev/null +++ b/meta-networking/recipes-support/tcpreplay/tcpreplay/0002-fix-incompatible-type-assignment-in-txring.c.patch | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | From 5615e8f7bbf83f03acacd6d6ba9ff8dc6fdc91df Mon Sep 17 00:00:00 2001 | ||
| 2 | From: "mark.yang" <mark.yang@lge.com> | ||
| 3 | Date: Thu, 10 Apr 2025 18:49:51 +0900 | ||
| 4 | Subject: [PATCH] fix incompatible type assignment in txring.c | ||
| 5 | |||
| 6 | * There is an incompatible type assignment error in txring.c. | ||
| 7 | txring.c:200:12: error: incompatible types when assigning to type 'txring_t' {aka 'struct txring_s'} from type 'txring_t *' {aka 'struct txring_s *'} | ||
| 8 | 200 | *txp = (txring_t *)safe_malloc(sizeof(txring_t)); | ||
| 9 | | ^ | ||
| 10 | |||
| 11 | txp is allocated as txring_t *, so I fixed it. | ||
| 12 | |||
| 13 | Upstream-Status: Submitted [https://github.com/appneta/tcpreplay/pull/924] | ||
| 14 | Signed-off-by: mark.yang <mark.yang@lge.com> | ||
| 15 | --- | ||
| 16 | src/common/txring.c | 2 +- | ||
| 17 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 18 | |||
| 19 | diff --git a/src/common/txring.c b/src/common/txring.c | ||
| 20 | index f522893d..b062dac2 100644 | ||
| 21 | --- a/src/common/txring.c | ||
| 22 | +++ b/src/common/txring.c | ||
| 23 | @@ -197,7 +197,7 @@ txring_init(int fd, unsigned int mtu) | ||
| 24 | txring_t *txp; | ||
| 25 | |||
| 26 | /* allocate memory for structure and fill it with different stuff*/ | ||
| 27 | - *txp = (txring_t *)safe_malloc(sizeof(txring_t)); | ||
| 28 | + txp = (txring_t *)safe_malloc(sizeof(txring_t)); | ||
| 29 | txp->treq = (struct tpacket_req *)safe_malloc(sizeof(struct tpacket_req)); | ||
| 30 | |||
| 31 | txring_mkreq(txp->treq, mtu); | ||
diff --git a/meta-networking/recipes-support/tcpreplay/tcpreplay_4.5.1.bb b/meta-networking/recipes-support/tcpreplay/tcpreplay_4.5.1.bb index f01bbb95a5..46e06a928e 100644 --- a/meta-networking/recipes-support/tcpreplay/tcpreplay_4.5.1.bb +++ b/meta-networking/recipes-support/tcpreplay/tcpreplay_4.5.1.bb | |||
| @@ -9,6 +9,8 @@ LIC_FILES_CHKSUM = "file://docs/LICENSE;md5=10f0474a2f0e5dccfca20f69d6598ad8" | |||
| 9 | 9 | ||
| 10 | SRC_URI = "https://github.com/appneta/${BPN}/releases/download/v${PV}/${BP}.tar.gz \ | 10 | SRC_URI = "https://github.com/appneta/${BPN}/releases/download/v${PV}/${BP}.tar.gz \ |
| 11 | file://0001-libopts.m4-set-POSIX_SHELL-to-bin-sh.patch \ | 11 | file://0001-libopts.m4-set-POSIX_SHELL-to-bin-sh.patch \ |
| 12 | file://0001-Fix-linker-error-for-TX_RING.patch \ | ||
| 13 | file://0002-fix-incompatible-type-assignment-in-txring.c.patch \ | ||
| 12 | " | 14 | " |
| 13 | 15 | ||
| 14 | SRC_URI[sha256sum] = "2de79bfd67ec92ca9ae2ffb50456dd1d53ff40f3fa71b422c65e8062013c9e85" | 16 | SRC_URI[sha256sum] = "2de79bfd67ec92ca9ae2ffb50456dd1d53ff40f3fa71b422c65e8062013c9e85" |
