Skip to content

fix compile, linker error for txring#924

Merged
fklassen merged 2 commits intoappneta:4.5.2-beta1from
markyang92:master
Jul 4, 2025
Merged

fix compile, linker error for txring#924
fklassen merged 2 commits intoappneta:4.5.2-beta1from
markyang92:master

Conversation

@markyang92
Copy link
Copy Markdown
Contributor

Standards checklist:

  • The PR title is descriptive.
  • The PR doesn't replicate another PR which is already open.
  • I have read the contribution guide and followed all the instructions.
  • The code follows the code style guide detailed in the wiki.
  • The code is mine or it's from somewhere with an MIT-compatible license.
  • The code is efficient, to the best of my ability, and does not waste computer resources.
  • The code is stable and I have tested it myself, to the best of my abilities.
  • If the code introduces new aliases, I provide a valid use case for all plugin users down below.

Changes:

  • Change txring.c, txring.h

  • Ensure txring compiles correctly to avoid linker errors.

    • The result of "nm -u txring.o" shows no symbols exist.
    • The config.h has HAVE_TX_RING defined but txring.c is not aware of it.
      txring.c and txring.h include config.h at the beginning.
  • Modify the assignment target for the safe_malloc return value from *txp to txp.

  • This resulted in a successful build in my build environment.

Found similar issue in gcc 15 build environment.
- See more details at: http://errors.yoctoproject.org/Errors/Details/851800/
```
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 result of "nm -u txring.o" shows no symbols exist.

- The config.h has HAVE_TX_RING defined but txring.c is not aware of it.
  txring.c and txring.h include config.h at the beginning.

- This resulted in a successful build in my build environment.

It may
Fixes appneta#731
Fixes appneta#904

Signed-off-by: mark.yang <mark.yang@lge.com>
* There is an incompatible type assignment error in txring.c.
  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 *'}
  200 |     *txp = (txring_t *)safe_malloc(sizeof(txring_t));
      |            ^

  txp is allocated as txring_t *, so I fixed it.

Signed-off-by: mark.yang <mark.yang@lge.com>
@fklassen fklassen changed the base branch from master to 4.5.2-beta1 July 4, 2025 22:27
@fklassen fklassen added the bug label Jul 4, 2025
fklassen added a commit that referenced this pull request Jul 4, 2025
@fklassen fklassen merged commit ae35804 into appneta:4.5.2-beta1 Jul 4, 2025
fklassen added a commit that referenced this pull request Jul 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants