Opened 9 months ago

Last modified 9 months ago

#10520 new defect

Fails to build with pocketsphinx 5

Reported by: Samuel Thibault Owned by:
Priority: normal Component: avfilter
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by Samuel Thibault)

Summary of the bug:
How to reproduce:
After having installed pocketsphinx version 5.0.2 (from https://github.com/cmusphinx/pocketsphinx/), ffmpeg fails to build:

src/libavfilter/af_asr.c:42:5: error: unknown type name 'cmd_ln_t'
   42 |     cmd_ln_t *config;
      |     ^~~~~~~~
src/libavfilter/af_asr.c: In function 'asr_init':
src/libavfilter/af_asr.c:110:17: error: implicit declaration of function 'cmd_ln_parse_r' [-Werror=implicit-function-declaration]
  110 |     s->config = cmd_ln_parse_r(NULL, ps_args(), 14, (char **)argv, 0);
      |                 ^~~~~~~~~~~~~~
src/libavfilter/af_asr.c:110:15: warning: assignment to 'int *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  110 |     s->config = cmd_ln_parse_r(NULL, ps_args(), 14, (char **)argv, 0);
      |               ^
src/libavfilter/af_asr.c:115:29: warning: passing argument 1 of 'ps_default_search_args' from incompatible pointer type [-Wincompatible-pointer-types]
  115 |     ps_default_search_args(s->config);
      |                            ~^~~~~~~~
      |                             |
      |                             int *
In file included from src/libavfilter/af_asr.c:21:
/usr/include/pocketsphinx.h:465:42: note: expected 'ps_config_t *' {aka 'struct cmd_ln_s *'} but argument is of type 'int *'
  465 | void ps_default_search_args(ps_config_t *config);
      |                             ~~~~~~~~~~~~~^~~~~~
src/libavfilter/af_asr.c:116:22: warning: passing argument 1 of 'ps_init' from incompatible pointer type [-Wincompatible-pointer-types]
  116 |     s->ps = ps_init(s->config);
      |                     ~^~~~~~~~
      |                      |
      |                      int *
/usr/include/pocketsphinx.h:498:36: note: expected 'ps_config_t *' {aka 'struct cmd_ln_s *'} but argument is of type 'int *'
  498 | ps_decoder_t *ps_init(ps_config_t *config);
      |                       ~~~~~~~~~~~~~^~~~~~
src/libavfilter/af_asr.c: In function 'asr_uninit':
src/libavfilter/af_asr.c:148:5: error: implicit declaration of function 'cmd_ln_free_r' [-Werror=implicit-function-declaration]
  148 |     cmd_ln_free_r(s->config);
      |     ^~~~~~~~~~~~~

This is apparently an intentional API break of pocketsphinx: from pocketsphinx.h:

 * @section faq_sec Frequently Asked Questions
 *
 * @subsection faq_api My code no longer compiles! Why?
 *
 * Some APIs were intentionally broken by the 5.0.0 release.  The most
 * likely culprit here is the configuration API, where the old
 * "options" which started with a `-` are now "parameters" which do
 * not, and instead of a `cmd_ln_t` it is now a `ps_config_t`.  There
 * is no backward compatibility, you have to change your code
 * manually.  This is straightforward for the most part.  For example,
 * instead of writing:
 *
 *     cmdln = cmd_ln_init(NULL, "-samprate", "16000", NULL);
 *     cmd_ln_set_int32_r(NULL, "-maxwpf", 40);
 *
 * You should write:
 *
 *     config = ps_config_init(NULL);
 *     ps_config_set_int(config, "samprate", 16000);
 *     ps_config_set_int(config, "maxwpf", 40);

So this needs to be done in ffmpeg.

Change History (1)

comment:1 by Samuel Thibault, 9 months ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.