freeswitch / spandsp

SpanDSP is a low-level signal processing library that modulates and demodulates signals commonly used in telephony, such as the "noise" generated by a fax modem or DTMF touchpad.
Other
141 stars 117 forks source link

Compilation error: The return type of function dtmf_rx_fillin() is sometimes void, sometimes int. #44

Closed dilyanpalauzov closed 1 year ago

dilyanpalauzov commented 1 year ago

Compiling rtpengine aaff8863 fails with:

make[3]: Leaving directory '/git/voip/rtpengine/daemon'                                                                                 
Failed build with ../lib/dtmf_rx_fillin-01.h
Trying build with ../lib/dtmf_rx_fillin-02.h                                                                                            
make[3]: Entering directory '/git/voip/rtpengine/daemon'
cc -g -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wstrict-prototypes -pthread -fno-strict-aliasing -std=c99 -I/usr/local/include/glib-2.0 -I/usr/local/lib64/glib-2.0/include -I/usr/local/include -pthread -I/usr/local/include -I/usr/local/include/glib-2.0 -I/usr/local/lib64/glib-2.0/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -pthread -I/usr/local/include/json-glib-1.0 -I/usr/local/include -I/usr/local/include/glib-2.0 -I/usr/local/lib64/glib-2.0/include -I/usr/local/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/local/include -I/usr/local/include -DWITH_IPTABLES_OPTION -I. -I../kernel-module/ -I../lib/ -I../include/ -D_GNU_SOURCE -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include/opus -DWITH_TRANSCODING -I/usr/local/include -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DHAVE_BCG729 -I/usr/local/include -DRTPENGINE_VERSION="\"git-master-aaff8863\""  -DHAVE_LIBSYSTEMD  -rdynamic  dtmf_rx_fillin-test.c  -lm -ldl -L/usr/local/lib64 -lglib-2.0 -L/usr/local/lib64 -pthread -lgthread-2.0 -lglib-2.0 -L/usr/local/lib -lz -L/usr/local/lib -lpcre -L/usr/local/lib64 -lcrypto -L/usr/local/lib64 -lssl -lcrypto -L/usr/local/lib -levent_pthreads -levent -lpcap -L/usr/local/lib -lxmlrpc_client -lxmlrpc -lxmlrpc_xmlparse -lxmlrpc_xmltok -lxmlrpc_util -L/usr/local/lib -lxmlrpc -lxmlrpc_xmlparse -lxmlrpc_xmltok -lxmlrpc_util -L/usr/local/lib -lxmlrpc_util -lhiredis -L/usr/local/lib64 -ljson-glib-1.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -L/ -L/usr/local/lib -lwebsockets -lcap -L/usr/local/lib -lip4tc -lip6tc -L/usr/local/lib -lavcodec -L/usr/local/lib -lavformat -L/usr/local/lib -lavutil -L/usr/local/lib -lswresample -L/usr/local/lib -lavfilter -L/usr/local/lib -lspandsp -L/usr/local/lib -lopus -L/usr/local/lib -lmysqlclient -lpthread -lm -lssl -lcrypto -ldl -L/usr/local/lib64 -lbcg729 -L/lib64 -lsystemd -o dtmf_rx_fillin-test
In file included from dtmf_rx_fillin-test.c:1:
dtmf_rx_fillin.h:12:13: error: conflicting types for ‘dtmf_rx_fillin’; have ‘void(dtmf_rx_state_t *, int)’ {aka ‘void(struct dtmf_rx_state_s *, int)’}
   12 | INLINE void dtmf_rx_fillin(dtmf_rx_state_t *dsp, int n) {
      |             ^~~~~~~~~~~~~~
In file included from dtmf_rx_fillin.h:9:
/usr/local/include/spandsp/dtmf.h:185:19: note: previous declaration of ‘dtmf_rx_fillin’ with type ‘int(dtmf_rx_state_t *, int)’ {aka ‘int(struct dtmf_rx_state_s *, int)’}
  185 | SPAN_DECLARE(int) dtmf_rx_fillin(dtmf_rx_state_t *s, int samples);
      |                   ^~~~~~~~~~~~~~
make[3]: *** [<builtin>: dtmf_rx_fillin-test] Error 1
make[3]: Leaving directory '/git/voip/rtpengine/daemon'
Failed build with ../lib/dtmf_rx_fillin-02.h
make[2]: *** [../lib/common.Makefile:50: dtmf_rx_fillin.h] Error 1
make[2]: Leaving directory '/git/voip/rtpengine/daemon'
make[1]: *** [../lib/common.Makefile:4: all] Error 2
make[1]: Leaving directory '/git/voip/rtpengine/daemon'
make: *** [Makefile:22: all] Error 2

spandsp/dtmf.h:185 is https://github.com/freeswitch/spandsp/blob/master/src/spandsp/dtmf.h#L185.

The return type of function dtmf_rx_fillin() is sometimes void (spandsp sources), sometimes int (in lib/dtmf_rx_fillin-02.h).

coppice-git commented 1 year ago

/git/voip/rtpengine/daemon seems to be using spandsp, but instead of just using the spandsp header files it has its own incorrect definition of dtmf_rx_fillin. I think you need to talk to them. Could it be they are using a definition compatible with a very early version of spandsp? I think I might have used INLINE at one point, before changing to SPAN_DECLARE() for greater compatibility.

dilyanpalauzov commented 1 year ago

It is https://github.com/sipwise/rtpengine/issues/1593 .