signalwire / freeswitch

FreeSWITCH is a Software Defined Telecom Stack enabling the digital transformation from proprietary telecom switches to a versatile software implementation that runs on any commodity hardware. From a Raspberry PI to a multi-core server, FreeSWITCH can unlock the telecommunications potential of any device.
https://freeswitch.com/#getting-started
Other
3.59k stars 1.42k forks source link

Compilation error at src/switch_core_media.c:2246 #1563

Open dilyanpalauzov opened 2 years ago

dilyanpalauzov commented 2 years ago

With gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9) compiling fails with:

$ make
make  all-recursive
make[1]: Entering directory '/git/freeswitch/freeswitch'
  CC       src/libfreeswitch_la-switch_core_media.lo
src/switch_core_media.c:2246:111: error: argument 2 of type ‘switch_core_media_flag_t[15]’ with mismatched bound [-Werror=array-parameter=]
 2246 | SWITCH_DECLARE(void) switch_media_handle_set_media_flags(switch_media_handle_t *smh, switch_core_media_flag_t flags[SCMF_MAX])
      |                                                                                      ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
In file included from ./src/include/switch.h:145,
                 from src/switch_core_media.c:33:
./src/include/switch_core_media.h:206:111: note: previously declared as ‘switch_core_media_flag_t[]’
  206 | SWITCH_DECLARE(void) switch_media_handle_set_media_flags(switch_media_handle_t *smh, switch_core_media_flag_t flags[]);
      |                                                                                      ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:2493: src/libfreeswitch_la-switch_core_media.lo] Error 1
make[1]: Leaving directory '/git/freeswitch/freeswitch'
make: *** [Makefile:1448: all] Error 2
dragos-oancea commented 2 years ago

does this work ? https://github.com/signalwire/freeswitch/pull/1565

dilyanpalauzov commented 2 years ago

The patch is likely an improvement. When I apply it, I see the next error:

  CC       src/libfreeswitch_la-switch_rtp.lo
src/switch_rtp.c:4530:117: error: argument 5 of type ‘switch_rtp_flag_t[54]’ with mismatched bound [-Werror=array-parameter=]
 4530 |                                                                                                   switch_rtp_flag_t flags[SWITCH_RTP_FLAG_INVALID], char *timer_name, const char **err, switch_memory_pool_t *pool)
      |                                                                                                   ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/include/switch.h:133,
                 from src/switch_rtp.c:34:
./src/include/switch_rtp.h:239:117: note: previously declared as ‘switch_rtp_flag_t[]’
  239 |                                                                                                   switch_rtp_flag_t flags[], char *timer_name, const char **err, switch_memory_pool_t *pool);
      |                                                                                                   ~~~~~~~~~~~~~~~~~~^~~~~~~
src/switch_rtp.c:4749:109: error: argument 8 of type ‘switch_rtp_flag_t[54]’ with mismatched bound [-Werror=array-parameter=]
 4749 |                                                                                           switch_rtp_flag_t flags[SWITCH_RTP_FLAG_INVALID], char *timer_name, const char **err, switch_memory_pool_t *pool,
      |                                                                                           ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/include/switch.h:133,
                 from src/switch_rtp.c:34:
./src/include/switch_rtp.h:265:109: note: previously declared as ‘switch_rtp_flag_t[]’
  265 |                                                                                           switch_rtp_flag_t flags[], char *timer_name, const char **err, switch_memory_pool_t *pool, switch_port_t bundle_internal_ports, switch_port_t bundle_external_port);
      |                                                                                           ~~~~~~~~~~~~~~~~~~^~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:2577: src/libfreeswitch_la-switch_rtp.lo] Error 1
make[1]: Leaving directory '/git/freeswitch/freeswitch'
make: *** [Makefile:1448: all] Error 2

To be precise, there are many warnings, I reported only the first one. To hide the warnings I had to add -Wno-error=array-parameter= -Wno-error=deprecated-declarations -Wno-error=array-bound.

dragos-oancea commented 2 years ago

I pushed another commit in https://github.com/signalwire/freeswitch/pull/1565

dilyanpalauzov commented 2 years ago

The next error is:

making all mod_av                                                                                                              [38/1836]
make[4]: Entering directory '/git/freeswitch/freeswitch/src/mod/applications/mod_av'       
  CC       libavmod_la-avformat.lo                                                                                                      
avformat.c: In function ‘video_thread_run’:                   
avformat.c:880:17: error: ‘av_init_packet’ is deprecated [-Werror=deprecated-declarations]
  880 |                 av_init_packet(&pkt);                     
      |                 ^~~~~~~~~~~~~~                 
In file included from /usr/include/ffmpeg/libavcodec/bsf.h:30,    
                 from /usr/include/ffmpeg/libavcodec/avcodec.h:44,
                 from avformat.c:36:
/usr/include/ffmpeg/libavcodec/packet.h:488:6: note: declared here
  488 | void av_init_packet(AVPacket *pkt);
      |      ^~~~~~~~~~~~~~
avformat.c:974:17: error: ‘av_init_packet’ is deprecated [-Werror=deprecated-declarations]
  974 |                 av_init_packet(&pkt);
      |                 ^~~~~~~~~~~~~~
In file included from /usr/include/ffmpeg/libavcodec/bsf.h:30,
                 from /usr/include/ffmpeg/libavcodec/avcodec.h:44,
                 from avformat.c:36:
/usr/include/ffmpeg/libavcodec/packet.h:488:6: note: declared here
  488 | void av_init_packet(AVPacket *pkt);
      |      ^~~~~~~~~~~~~~
avformat.c: In function ‘file_read_thread_run’:
avformat.c:1430:17: error: ‘av_init_packet’ is deprecated [-Werror=deprecated-declarations]
 1430 |                 av_init_packet(&pkt);
      |                 ^~~~~~~~~~~~~~
In file included from /usr/include/ffmpeg/libavcodec/bsf.h:30,
                 from /usr/include/ffmpeg/libavcodec/avcodec.h:44,
                 from avformat.c:36:
/usr/include/ffmpeg/libavcodec/packet.h:488:6: note: declared here                                                              [9/1836]
  488 | void av_init_packet(AVPacket *pkt);
      |      ^~~~~~~~~~~~~~
avformat.c:1467:41: error: ‘av_init_packet’ is deprecated [-Werror=deprecated-declarations]
 1467 |                                         av_init_packet(new_pkt);
      |                                         ^~~~~~~~~~~~~~
In file included from /usr/include/ffmpeg/libavcodec/bsf.h:30,
                 from /usr/include/ffmpeg/libavcodec/avcodec.h:44,
                 from avformat.c:36:
/usr/include/ffmpeg/libavcodec/packet.h:488:6: note: declared here
  488 | void av_init_packet(AVPacket *pkt);
      |      ^~~~~~~~~~~~~~
avformat.c: In function ‘av_file_write’:
avformat.c:2106:17: error: ‘av_init_packet’ is deprecated [-Werror=deprecated-declarations]
 2106 |                 av_init_packet(&pkt[0]);
      |                 ^~~~~~~~~~~~~~
In file included from /usr/include/ffmpeg/libavcodec/bsf.h:30,
                 from /usr/include/ffmpeg/libavcodec/avcodec.h:44,
                 from avformat.c:36:
/usr/include/ffmpeg/libavcodec/packet.h:488:6: note: declared here
  488 | void av_init_packet(AVPacket *pkt);
      |      ^~~~~~~~~~~~~~
avformat.c:2107:17: error: ‘av_init_packet’ is deprecated [-Werror=deprecated-declarations]
 2107 |                 av_init_packet(&pkt[1]);
      |                 ^~~~~~~~~~~~~~
In file included from /usr/include/ffmpeg/libavcodec/bsf.h:30,
                 from /usr/include/ffmpeg/libavcodec/avcodec.h:44,
                 from avformat.c:36:
/usr/include/ffmpeg/libavcodec/packet.h:488:6: note: declared here
  488 | void av_init_packet(AVPacket *pkt);
      |      ^~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[4]: *** [Makefile:1016: libavmod_la-avformat.lo] Error 1
make[4]: Leaving directory '/git/freeswitch/freeswitch/src/mod/applications/mod_av'
make[3]: *** [Makefile:722: mod_av-all] Error 1
make[3]: Leaving directory '/git/freeswitch/freeswitch/src/mod'
make[2]: *** [Makefile:623: all-recursive] Error 1
make[2]: Leaving directory '/git/freeswitch/freeswitch/src'
make[1]: *** [Makefile:3716: all-recursive] Error 1
make[1]: Leaving directory '/git/freeswitch/freeswitch'
make: *** [Makefile:1448: all] Error 2
dragos-oancea commented 2 years ago

we merged some gcc-11 related fixes, but only for the core (b4a7cf40597a7746e10d11e5bc6b3b6ee3fb0af6)

dilyanpalauzov commented 2 years ago

How about the other gcc-11 Werrors?