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

Build srt-1-fit fails with standard attributes in middle of decl-specifiers on GCC 12 #3155

Closed
hashworks opened this issue Aug 29, 2022 · 4 comments · Fixed by #3808
Closed
Assignees
Labels
EnglishNative This issue is conveyed exclusively in English. Won't fix We won't fix it.

Comments

@hashworks
Copy link
Contributor

hashworks commented Aug 29, 2022

I'm currently trying to build the latest develop commit 29ae29c, but it fails with standard attributes in middle of decl-specifiers.

cd trunk
./configure
make
[ 37%] Building CXX object CMakeFiles/srt_virtual.dir/srtcore/api.cpp.o
In file included from trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/api.h:60,
                 from trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/api.cpp:60:
trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/netinet_any.h: In constructor ‘sockaddr_any::sockaddr_any(int)’:
trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/netinet_any.h:40:15: warning: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘struct sockaddr_any’; use assignment or value-initialization instead [-Wclass-memaccess]
   40 |         memset(this, 0, sizeof *this);
      |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/netinet_any.h:28:8: note: ‘struct sockaddr_any’ declared here
   28 | struct sockaddr_any
      |        ^~~~~~~~~~~~
In file included from trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/udt.h:70,
                 from trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/api.h:61:
trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/srt.h: At global scope:
trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/srt.h:84:28: error: standard attributes in middle of decl-specifiers
   84 | #define SRT_ATR_DEPRECATED [[deprecated]]
      |                            ^
trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/srt.h:198:9: note: in expansion of macro ‘SRT_ATR_DEPRECATED’
  198 | typedef SRT_ATR_DEPRECATED SRT_SOCKOPT SRT_SOCKOPT_DEPRECATED;
      |         ^~~~~~~~~~~~~~~~~~
trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/srt.h:84:28: note: standard attributes must precede the decl-specifiers to apply to the declaration, or follow them to apply to the type
   84 | #define SRT_ATR_DEPRECATED [[deprecated]]
      |                            ^
trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/srt.h:198:9: note: in expansion of macro ‘SRT_ATR_DEPRECATED’
  198 | typedef SRT_ATR_DEPRECATED SRT_SOCKOPT SRT_SOCKOPT_DEPRECATED;
      |         ^~~~~~~~~~~~~~~~~~
trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/srt.h:84:28: warning: attribute ignored [-Wattributes]
   84 | #define SRT_ATR_DEPRECATED [[deprecated]]
      |                            ^
trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/srt.h:198:9: note: in expansion of macro ‘SRT_ATR_DEPRECATED’
  198 | typedef SRT_ATR_DEPRECATED SRT_SOCKOPT SRT_SOCKOPT_DEPRECATED;
      |         ^~~~~~~~~~~~~~~~~~
trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/srt.h:84:28: note: an attribute that appertains to a type-specifier is ignored
   84 | #define SRT_ATR_DEPRECATED [[deprecated]]
      |                            ^
trunk/objs/Platform-Linux-5.19.4-GCC12.2.0-SRS5-x86_64/srt-1-fit/srtcore/srt.h:198:9: note: in expansion of macro ‘SRT_ATR_DEPRECATED’
  198 | typedef SRT_ATR_DEPRECATED SRT_SOCKOPT SRT_SOCKOPT_DEPRECATED;
      |         ^~~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/srt_virtual.dir/build.make:76: CMakeFiles/srt_virtual.dir/srtcore/api.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:113: CMakeFiles/srt_virtual.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
Build srt-1-fit failed, ret=2

I searched around a bit, it seems this is related to GCC 12. But I'm not a C++ developer, so take this with a grain of salt.

Any idea?

@hashworks
Copy link
Contributor Author

https://www.gnu.org/software/gcc/gcc-12/changes.html

Stricter checking of attributes on friend declarations: if a friend declaration has an attribute, that declaration must be a definition. Moreover, a C++11 attribute cannot appear in the middle of the decl-specifier-seq. (PR99032)

@winlinvip
Copy link
Member

Please file issue to SRT, not issue of SRS.

@hashworks
Copy link
Contributor Author

@winlinvip it seems that the bug disappears with srt-1-fit v1.4.3 onwards (currently v1.4.1 is in the repo), I failed to test newer versions in my previous tests. Does anything speak against an update to v1.4.3 or even the latest stable v1.5.0?

@winlinvip
Copy link
Member

winlinvip commented Dec 25, 2022

We won't upgrade SRT for GCC 12 because it might cause other issues, but we might upgrade in future. So please test which version is ok and upgrade in your own SRS branch.

@winlinvip winlinvip added the EnglishNative This issue is conveyed exclusively in English. label Jul 28, 2023
@duiniuluantanqin duiniuluantanqin linked a pull request Sep 21, 2023 that will close this issue
winlinvip pushed a commit that referenced this issue Sep 21, 2023
fix #3155
Build srt-1-fit fails with `standard attributes in middle of
decl-specifiers` on GCC 12,Arch Linux.

See https://github.com/Haivision/srt/releases/tag/v1.5.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
EnglishNative This issue is conveyed exclusively in English. Won't fix We won't fix it.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants