Closed InterLinked1 closed 2 years ago
So apparently FreeSWITCH released an update to spandsp where they completely broke several key api functions.
I cannot find any information on why they released this, nor why anybody would adopt it. Which seems very sketchy to me.
However, Asterisk seems to have a reasonable patch for this change so I will look into adding something similar here.
https://gerrit.asterisk.org/c/asterisk/+/17332/4/res/res_fax_spandsp.c
@InterLinked1
I created branch spandsp3-support
and applied the neccessary changes. I don't have a spandsp 3.0.0 system to build on, but it still builds cleanly against the older spandsp library.
Can you try to build this branch on your spandsp 3.0.0 system?
If it builds properly for you I'll merge these changes into main.
Here is trying to compile with your spandsp branch:
Seems to be a lot less broken than before, but still some things that aren't quite right.
Generating input for menuselect ...
menuselect/menuselect --check-deps menuselect.makeopts
menuselect/menuselect --check-deps menuselect.makeopts
[CPP] app_tdd.c -> app_tdd.i
[CCi] app_tdd.i -> app_tdd.o
app_tdd.c: In function ‘set_logging’:
app_tdd.c:325:38: error: passing argument 2 of ‘span_log_set_message_handler’ from incompatible pointer type [-Werror=incompatible-pointer-types]
325 | span_log_set_message_handler(state, spandsp_log, NULL);
| ^~~~~~~~~~~
| |
| void (*)(int, const char *)
In file included from /usr/local/include/spandsp.h:53,
from app_tdd.c:33:
/usr/local/include/spandsp/logging.h:123:117: note: expected ‘message_handler_func_t’ {aka ‘void (*)(void *, int, const char *)’} but argument is of type ‘void (*)(int, const char *)’
123 | SPAN_DECLARE(void) span_log_set_message_handler(logging_state_t *s, message_handler_func_t func, void *user_data);
| ~~~~~~~~~~~~~~~~~~~~~ ^
app_tdd.c: In function ‘my_v18_tdd_put_async_byte’:
app_tdd.c:381:15: error: implicit declaration of function ‘decode_baudot’ [-Werror=implicit-function-declaration]
381 | if ((octet = decode_baudot(s, byte))) {
| ^~~~~~~~~~~~~
app_tdd.c: In function ‘do_tdd_rx’:
app_tdd.c:735:49: error: passing argument 4 of ‘v18_init’ makes integer from pointer without a cast [-Werror=int-conversion]
735 | v18_init(&ti->v18_state, 0, V18_MODE_5BIT_50, tdd_put_msg, ti, NULL);
| ^~~~~~~~~~~
| |
| void (*)(void *, const uint8_t *, int) {aka void (*)(void *, const unsigned char *, int)}
In file included from /usr/local/include/spandsp.h:110,
from app_tdd.c:33:
/usr/local/include/spandsp/v18.h:125:42: note: expected ‘int’ but argument is of type ‘void (*)(void *, const uint8_t *, int)’ {aka ‘void (*)(void *, const unsigned char *, int)’}
125 | int nation,
| ~~~~^~~~~~
app_tdd.c:735:62: error: passing argument 5 of ‘v18_init’ from incompatible pointer type [-Werror=incompatible-pointer-types]
735 | v18_init(&ti->v18_state, 0, V18_MODE_5BIT_50, tdd_put_msg, ti, NULL);
| ^~
| |
| struct tdd_info *
In file included from /usr/local/include/spandsp.h:110,
from app_tdd.c:33:
/usr/local/include/spandsp/v18.h:126:53: note: expected ‘put_msg_func_t’ {aka ‘void (*)(void *, const unsigned char *, int)’} but argument is of type ‘struct tdd_info *’
126 | put_msg_func_t put_msg,
| ~~~~~~~~~~~~~~~^~~~~~~
app_tdd.c:737:31: error: ‘V18_MODE_5BIT_45’ undeclared (first use in this function); did you mean ‘V18_MODE_5BIT_476’?
737 | v18_init(&ti->v18_state, 0, V18_MODE_5BIT_45, tdd_put_msg, ti, NULL);
| ^~~~~~~~~~~~~~~~
| V18_MODE_5BIT_476
app_tdd.c:737:31: note: each undeclared identifier is reported only once for each function it appears in
app_tdd.c:737:49: error: passing argument 4 of ‘v18_init’ makes integer from pointer without a cast [-Werror=int-conversion]
737 | v18_init(&ti->v18_state, 0, V18_MODE_5BIT_45, tdd_put_msg, ti, NULL);
| ^~~~~~~~~~~
| |
| void (*)(void *, const uint8_t *, int) {aka void (*)(void *, const unsigned char *, int)}
In file included from /usr/local/include/spandsp.h:110,
from app_tdd.c:33:
/usr/local/include/spandsp/v18.h:125:42: note: expected ‘int’ but argument is of type ‘void (*)(void *, const uint8_t *, int)’ {aka ‘void (*)(void *, const unsigned char *, int)’}
125 | int nation,
| ~~~~^~~~~~
app_tdd.c:737:62: error: passing argument 5 of ‘v18_init’ from incompatible pointer type [-Werror=incompatible-pointer-types]
737 | v18_init(&ti->v18_state, 0, V18_MODE_5BIT_45, tdd_put_msg, ti, NULL);
| ^~
| |
| struct tdd_info *
In file included from /usr/local/include/spandsp.h:110,
from app_tdd.c:33:
/usr/local/include/spandsp/v18.h:126:53: note: expected ‘put_msg_func_t’ {aka ‘void (*)(void *, const unsigned char *, int)’} but argument is of type ‘struct tdd_info *’
126 | put_msg_func_t put_msg,
| ~~~~~~~~~~~~~~~^~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [/usr/src/asterisk-18.14.0/Makefile.rules:150: app_tdd.o] Error 1
make: *** [Makefile:396: apps] Error 2
@InterLinked1
Thank you, that was very, very helpful. I believe I've addressed each of these as far as I can tell. Let me know how your next build attempt goes.
Progress! Now it's just this:
app_tdd.c: In function ‘set_logging’:
app_tdd.c:325:36: error: passing argument 2 of ‘span_log_set_message_handler’ from incompatible pointer type [-Werror=incompatible-pointer-types]
325 | span_log_set_message_handler(NULL, state, spandsp_log);
| ^~~~~
| |
| logging_state_t * {aka struct logging_state_s *}
In file included from /usr/local/include/spandsp.h:53,
from app_tdd.c:33:
/usr/local/include/spandsp/logging.h:123:117: note: expected ‘message_handler_func_t’ {aka ‘void (*)(void *, int, const char *)’} but argument is of type ‘logging_state_t *’ {aka ‘struct logging_state_s *’}
123 | SPAN_DECLARE(void) span_log_set_message_handler(logging_state_t *s, message_handler_func_t func, void *user_data);
| ~~~~~~~~~~~~~~~~~~~~~ ^
app_tdd.c: In function ‘v18_decode_baudot’:
app_tdd.c:348:10: error: ‘BAUDOT_FIGURE_SHIFT’ undeclared (first use in this function)
348 | case BAUDOT_FIGURE_SHIFT:
| ^~~~~~~~~~~~~~~~~~~
app_tdd.c:348:10: note: each undeclared identifier is reported only once for each function it appears in
app_tdd.c:351:10: error: ‘BAUDOT_LETTER_SHIFT’ undeclared (first use in this function)
351 | case BAUDOT_LETTER_SHIFT:
| ^~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [/usr/src/asterisk-18.14.0/Makefile.rules:150: app_tdd.o] Error 1
make: *** [Makefile:396: apps] Error 2
root@debian11:/usr/src/asterisk-18.14.0#
@InterLinked1
OK, I think I got those two issues resolved. Let me know if you can get this one to build.
Really close:
[CPP] app_tdd.c -> app_tdd.i
[CCi] app_tdd.i -> app_tdd.o
app_tdd.c:294:24: error: expected declaration specifiers or ‘...’ before ‘(’ token
294 | static void spandsp_log(NULL, int level, const char *msg)
| ^
app_tdd.c: In function ‘set_logging’:
app_tdd.c:329:38: error: ‘spandsp_log’ undeclared (first use in this function); did you mean ‘span_log’?
329 | span_log_set_message_handler(state, spandsp_log, NULL);
| ^~~~~~~~~~~
| span_log
app_tdd.c:329:38: note: each undeclared identifier is reported only once for each function it appears in
make[1]: *** [/usr/src/asterisk-18.14.0/Makefile.rules:150: app_tdd.o] Error 1
make: *** [Makefile:396: apps] Error 2
@InterLinked1
Sorry, I noticed that after I posted - I didn't try to build it locally first. I fixed it and it's compiling on my spandsp 0.0.6 machine now.
Sorry about that. Should be all set.
Yes, it compiles now - thank you!
@InterLinked1
Thanks for that. Were you able to do any basic testing with it? Just curious about the new spandsp really.
@InterLinked1
Merged back to main - if you have any problems using spandsp 3.0.0 open another issue and I'll look into it.
I happened to have a system where I upgraded to SpanDSP >= 3.0, and when compiling app_tdd I get several API errors:
Maybe we can detect the installed version of SpanDSP and then proceed accordingly?