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

error: flexible array member not at end of struct #3369

Closed
wcohen opened this issue Aug 24, 2022 · 1 comment
Closed

error: flexible array member not at end of struct #3369

wcohen opened this issue Aug 24, 2022 · 1 comment

Comments

@wcohen
Copy link
Contributor

wcohen commented Aug 24, 2022

I looks like the Fedora rawhide gcc-12.2.1-1.fc38.x86_64 is picker than earlier compilers (gcc-12.1.1-3.fc37.1) about where variable length fields are in structures. rr compiled with gcc-12.1.1-3.fc37 compiled but when trying to compile a updated git checkout of rr on Fedora rawhide with the newer compiler got the following error:

/usr/bin/g++ -DEXECINFO_H=1 -DFANOTIFY_H=1 -DMQUEUE_H=1 -DPROC_SERVICE_H=1 -DRR_VERSION=\"5.6.0\" -Drr_EXPORTS -I/home/wcohen/rpmbuild/BUILD/rr-fc63ee66416c31b2588b07e1d7f0b083de0ae51f/include -I/home/wcohen/rpmbuild/BUILD/rr-fc63ee66416c31b2588b07e1d7f0b083de0ae51f/third-party/proc-service -I/home/wcohen/rpmbuild/BUILD/rr-fc63ee66416c31b2588b07e1d7f0b083de0ae51f/third-party/brotli/include -I/home/wcohen/rpmbuild/BUILD/rr-fc63ee66416c31b2588b07e1d7f0b083de0ae51f/redhat-linux-build -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D__USE_LARGEFILE64 -pthread -msse2 -D__MMX__ -D__SSE__ -D__SSE2__ -fmacro-prefix-map=/home/wcohen/rpmbuild/BUILD/rr-fc63ee66416c31b2588b07e1d7f0b083de0ae51f/= -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -std=c++14  -pthread  -DNDEBUG -Wall -Wextra -UDEBUG -DNDEBUG -g3 -flto -MD -MT CMakeFiles/rr.dir/src/record_syscall.cc.o -MF CMakeFiles/rr.dir/src/record_syscall.cc.o.d -o CMakeFiles/rr.dir/src/record_syscall.cc.o -c /home/wcohen/rpmbuild/BUILD/rr-fc63ee66416c31b2588b07e1d7f0b083de0ae51f/src/record_syscall.cc
In file included from /home/wcohen/rpmbuild/BUILD/rr-fc63ee66416c31b2588b07e1d7f0b083de0ae51f/src/record_syscall.cc:12:
/home/wcohen/rpmbuild/BUILD/rr-fc63ee66416c31b2588b07e1d7f0b083de0ae51f/src/record_syscall.cc: In instantiation of 'struct rr::get_ethtool_gstrings_arch<X86Arch>(RecordTask*)::SingleStringSet':
/home/wcohen/rpmbuild/BUILD/rr-fc63ee66416c31b2588b07e1d7f0b083de0ae51f/src/record_syscall.cc:1456:3:   required from 'void rr::get_ethtool_gstrings_arch(RecordTask*) [with Arch = X86Arch]'
/home/wcohen/rpmbuild/BUILD/rr-fc63ee66416c31b2588b07e1d7f0b083de0ae51f/src/record_syscall.cc:1486:3:   required from here
/usr/include/linux/ethtool.h:778:17: error: flexible array member 'ethtool_sset_info::data' not at end of 'struct rr::get_ethtool_gstrings_arch<X86Arch>(RecordTask*)::SingleStringSet'
  778 |         __u32   data[];
      |                 ^~~~
/home/wcohen/rpmbuild/BUILD/rr-fc63ee66416c31b2588b07e1d7f0b083de0ae51f/src/record_syscall.cc:1455:14: note: next member 'uint32_t rr::get_ethtool_gstrings_arch<X86Arch>(RecordTask*)::SingleStringSet::data' declared here
 1455 |     uint32_t data;
      |              ^~~~
/home/wcohen/rpmbuild/BUILD/rr-fc63ee66416c31b2588b07e1d7f0b083de0ae51f/src/record_syscall.cc:1453:10: note: in the definition of 'struct rr::get_ethtool_gstrings_arch<X86Arch>(RecordTask*)::SingleStringSet'
 1453 |   struct SingleStringSet {
      |          ^~~~~~~~~~~~~~~
/home/wcohen/rpmbuild/BUILD/rr-fc63ee66416c31b2588b07e1d7f0b083de0ae51f/src/record_syscall.cc: In instantiation of 'struct rr::get_ethtool_gstrings_arch<X64Arch>(RecordTask*)::SingleStringSet':
/home/wcohen/rpmbuild/BUILD/rr-fc63ee66416c31b2588b07e1d7f0b083de0ae51f/src/record_syscall.cc:1456:3:   required from 'void rr::get_ethtool_gstrings_arch(RecordTask*) [with Arch = X64Arch]'
/home/wcohen/rpmbuild/BUILD/rr-fc63ee66416c31b2588b07e1d7f0b083de0ae51f/src/record_syscall.cc:1486:3:   required from here
/usr/include/linux/ethtool.h:778:17: error: flexible array member 'ethtool_sset_info::data' not at end of 'struct rr::get_ethtool_gstrings_arch<X64Arch>(RecordTask*)::SingleStringSet'
  778 |         __u32   data[];
      |                 ^~~~
/home/wcohen/rpmbuild/BUILD/rr-fc63ee66416c31b2588b07e1d7f0b083de0ae51f/src/record_syscall.cc:1455:14: note: next member 'uint32_t rr::get_ethtool_gstrings_arch<X64Arch>(RecordTask*)::SingleStringSet::data' declared here
 1455 |     uint32_t data;
      |              ^~~~
/home/wcohen/rpmbuild/BUILD/rr-fc63ee66416c31b2588b07e1d7f0b083de0ae51f/src/record_syscall.cc:1453:10: note: in the definition of 'struct rr::get_ethtool_gstrings_arch<X64Arch>(RecordTask*)::SingleStringSet'
 1453 |   struct SingleStringSet {
      |          ^~~~~~~~~~~~~~~
/home/wcohen/rpmbuild/BUILD/rr-fc63ee66416c31b2588b07e1d7f0b083de0ae51f/src/record_syscall.cc: In instantiation of 'struct rr::get_ethtool_gstrings_arch<ARM64Arch>(RecordTask*)::SingleStringSet':
/home/wcohen/rpmbuild/BUILD/rr-fc63ee66416c31b2588b07e1d7f0b083de0ae51f/src/record_syscall.cc:1456:3:   required from 'void rr::get_ethtool_gstrings_arch(RecordTask*) [with Arch = ARM64Arch]'
/home/wcohen/rpmbuild/BUILD/rr-fc63ee66416c31b2588b07e1d7f0b083de0ae51f/src/record_syscall.cc:1486:3:   required from here
/usr/include/linux/ethtool.h:778:17: error: flexible array member 'ethtool_sset_info::data' not at end of 'struct rr::get_ethtool_gstrings_arch<ARM64Arch>(RecordTask*)::SingleStringSet'
  778 |         __u32   data[];
      |                 ^~~~
/home/wcohen/rpmbuild/BUILD/rr-fc63ee66416c31b2588b07e1d7f0b083de0ae51f/src/record_syscall.cc:1455:14: note: next member 'uint32_t rr::get_ethtool_gstrings_arch<ARM64Arch>(RecordTask*)::SingleStringSet::data' declared here
 1455 |     uint32_t data;
      |              ^~~~
/home/wcohen/rpmbuild/BUILD/rr-fc63ee66416c31b2588b07e1d7f0b083de0ae51f/src/record_syscall.cc:1453:10: note: in the definition of 'struct rr::get_ethtool_gstrings_arch<ARM64Arch>(RecordTask*)::SingleStringSet'
 1453 |   struct SingleStringSet {
      |          ^~~~~~~~~~~~~~~
gmake[2]: *** [CMakeFiles/rr.dir/build.make:744: CMakeFiles/rr.dir/src/record_syscall.cc.o] Error 1
gmake[2]: Leaving directory '/home/wcohen/rpmbuild/BUILD/rr-fc63ee66416c31b2588b07e1d7f0b083de0ae51f/redhat-linux-build'
gmake[1]: *** [CMakeFiles/Makefile2:1468: CMakeFiles/rr.dir/all] Error 2
gmake[1]: Leaving directory '/home/wcohen/rpmbuild/BUILD/rr-fc63ee66416c31b2588b07e1d7f0b083de0ae51f/redhat-linux-build'
gmake: *** [Makefile:169: all] Error 2

@vcunat
Copy link

vcunat commented Oct 20, 2022

For reference, the cause wasn't update of gcc but kernel headers: torvalds/linux@94dfc73

DarkArc pushed a commit to DarkArc/rr that referenced this issue Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants