Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] 4.4.4 fails to build with clang: incomplete definition of the 'struct next' type #809

Open
ehaupt opened this issue Jun 12, 2023 · 6 comments
Assignees
Labels
Projects

Comments

@ehaupt
Copy link

ehaupt commented Jun 12, 2023

Describe the bug
Version 4.4.4 fails to build with clang (previous version 4.4.3 builds fine):

Compiler version:

$ clang --version
FreeBSD clang version 14.0.5 (https://github.com/llvm/llvm-project.git llvmorg-14.0.5-0-gc12386ae247c)
Target: x86_64-unknown-freebsd13.2
Thread model: posix
InstalledDir: /usr/bin

In 'mod.c', a fatal error occurs due to an incomplete definition of the 'struct next' type, resulting in a build failure.

cc -DHAVE_CONFIG_H -I. -I../../src    -I./.. -I./../.. -I/usr/local/include -D_U_="__attribute__((unused))" -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing   -Wno-variadic-macros -Wfatal-errors  -I/usr/lib -I/usr/include -MT libfragroute_a-fragroute.o -MD -MP -MF .deps/libfragroute_a-fragroute.Tpo -c -o libfragroute_a-fragroute.o `test -f 'fragroute.c' || echo './'`fragroute.c
mv -f .deps/libfragroute_a-fragroute.Tpo .deps/libfragroute_a-fragroute.Po
cc -DHAVE_CONFIG_H -I. -I../../src    -I./.. -I./../.. -I/usr/local/include -D_U_="__attribute__((unused))" -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing   -Wno-variadic-macros -Wfatal-errors  -I/usr/lib -I/usr/include -MT libfragroute_a-bget.o -MD -MP -MF .deps/libfragroute_a-bget.Tpo -c -o libfragroute_a-bget.o `test -f 'bget.c' || echo './'`bget.c
mv -f .deps/libfragroute_a-bget.Tpo .deps/libfragroute_a-bget.Po
cc -DHAVE_CONFIG_H -I. -I../../src    -I./.. -I./../.. -I/usr/local/include -D_U_="__attribute__((unused))" -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing   -Wno-variadic-macros -Wfatal-errors  -I/usr/lib -I/usr/include -MT libfragroute_a-mod.o -MD -MP -MF .deps/libfragroute_a-mod.Tpo -c -o libfragroute_a-mod.o `test -f 'mod.c' || echo './'`mod.c
mod.c:180:5: fatal error: incomplete definition of type 'struct next'
    TAILQ_FOREACH_REVERSE(rule, &rules, next, head)
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/sys/queue.h:750:15: note: expanded from macro 'TAILQ_FOREACH_REVERSE'
        for ((var) = TAILQ_LAST((head), headname);                      \
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/sys/queue.h:824:44: note: expanded from macro 'TAILQ_LAST'
        (*(((struct headname *)((head)->tqh_last))->tqh_last))
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
mod.c:180:41: note: forward declaration of 'struct next'
    TAILQ_FOREACH_REVERSE(rule, &rules, next, head)
                                        ^

Full build log: tcpreplay-4.4.4.log

To Reproduce

  1. Download a FreeBSD vagrant image
  2. Try to compile 4.4.4

System (please complete the following information):

  • OS: FreeBSD
  • OS version: 13.1-RELEASE-p7
  • Tcpreplay Version: 4.4.4
@fklassen
Copy link
Member

I tried with clang-13 and clang-17 on Debian Linux. No failure. Do you see this fail on 4.4.3?

@ehaupt
Copy link
Author

ehaupt commented Jun 12, 2023

4.4.3 builds fine.

@fklassen
Copy link
Member

OK, I'll build up a FreeBSD VM to test on.

@fklassen fklassen self-assigned this Jun 12, 2023
@fklassen fklassen added the bug label Jun 12, 2023
@fklassen fklassen added this to To do in 4.4.5 via automation Jun 12, 2023
@ehaupt
Copy link
Author

ehaupt commented Jun 13, 2023

OK, I'll build up a FreeBSD VM to test on.

Quick setup to have all deps:

Vagrant.configure("2") do |config|
  config.vm.box = "freebsd/FreeBSD-13.2-RELEASE"
  config.vm.box_version = "2023.04.07"

  config.vm.provision "shell", inline: <<-SHELL
    sed -i'' -e 's|quarterly|latest|' /etc/pkg/FreeBSD.conf
    pkg install -y bash git
    portsnap --interactive fetch extract
    sh -c '(cd /usr/ports/net-mgmt/tcpreplay; make missing | xargs pkg install -y)'
  SHELL
end

@ehaupt
Copy link
Author

ehaupt commented Jun 16, 2023

Just to verify, I attempted compiling with a different compiler (gcc 12.2.0), but it failed as well.

See tcpreplay-4.4.4_gcc_freebsd_13_1.log

The title of the issue should probably be changed to:

[Bug] 4.4.4 fails to build on FreeBSD: incomplete definition of the 'struct next' type

@ehaupt
Copy link
Author

ehaupt commented Aug 29, 2023

According to repology, no other *BSD has updated to 4.4.4 so this bug likely exists on those platforms as well.

freebsd-git pushed a commit to freebsd/freebsd-ports that referenced this issue Mar 24, 2024
Issues with the latest release ramain unresolved for > 6 months:

appneta/tcpreplay#809

Back to the unmaintained pool.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
4.4.5
To do
Development

No branches or pull requests

2 participants