jambonz / freeswitch-modules

Freeswitch modules designed for use with jambonz
Other
24 stars 21 forks source link

Error compiling mod_aws_transcribe, Conflicting cJSON struct definition #76

Closed cyrenity closed 3 months ago

cyrenity commented 3 months ago

The mod_aws_transcribe module fails to compile on a vanilla FreeSWITCH 1.10.11 installation due to a conflict between two different definitions of the cJSON struct. The conflict arises between the version included in FreeSWITCH's own JSON library (switch_cJSON.h) and the one embedded within the AWS SDK (aws/core/external/cjson/cJSON.h).

making install mod_aws_transcribe
make[2]: Entering directory '/usr/local/src/freeswitch-1.10.11.-release/src/mod/applications/mod_aws_transcribe'
  CXX      mod_aws_transcribe_la-aws_transcribe_glue.lo
In file included from /usr/local/include/aws/core/utils/json/JsonSerializer.h:14,
                 from /usr/local/include/aws/core/client/AWSError.h:12,
                 from /usr/local/include/aws/core/endpoint/internal/AWSEndpointAttribute.h:9,
                 from /usr/local/include/aws/core/auth/signer/AWSAuthV4Signer.h:17,
                 from /usr/local/include/aws/core/auth/AWSAuthSigner.h:11,
                 from /usr/local/include/aws/core/AmazonWebServiceRequest.h:11,
                 from /usr/local/include/aws/core/client/AWSUrlPresigner.h:9,
                 from /usr/local/include/aws/core/client/AWSClient.h:12,
                 from /usr/local/include/aws/core/monitoring/MonitoringManager.h:11,
                 from /usr/local/include/aws/core/Aws.h:13,
                 from aws_transcribe_glue.cpp:14:
/usr/local/include/aws/core/external/cjson/cJSON.h:114:16: error: redefinition of ‘struct cJSON’
  114 | typedef struct cJSON
      |                ^~~~~
In file included from ../../../../src/include/switch_json.h:43,
                 from ../../../../src/include/switch_types.h:43,
                 from ../../../../src/include/switch.h:113,
                 from aws_transcribe_glue.cpp:3:
../../../../src/include/switch_cJSON.h:95:16: note: previous definition of ‘struct cJSON’
   95 | typedef struct cJSON
      |                ^~~~~
In file included from /usr/local/include/aws/core/utils/json/JsonSerializer.h:14,
                 from /usr/local/include/aws/core/client/AWSError.h:12,
                 from /usr/local/include/aws/core/endpoint/internal/AWSEndpointAttribute.h:9,
                 from /usr/local/include/aws/core/auth/signer/AWSAuthV4Signer.h:17,
                 from /usr/local/include/aws/core/auth/AWSAuthSigner.h:11,
                 from /usr/local/include/aws/core/AmazonWebServiceRequest.h:11,
                 from /usr/local/include/aws/core/client/AWSUrlPresigner.h:9,
                 from /usr/local/include/aws/core/client/AWSClient.h:12,
                 from /usr/local/include/aws/core/monitoring/MonitoringManager.h:11,
                 from /usr/local/include/aws/core/Aws.h:13,
                 from aws_transcribe_glue.cpp:14:
/usr/local/include/aws/core/external/cjson/cJSON.h:134:3: error: conflicting declaration ‘typedef int cJSON’
  134 | } cJSON;
      |   ^~~~~
In file included from ../../../../src/include/switch_json.h:43,
                 from ../../../../src/include/switch_types.h:43,
                 from ../../../../src/include/switch.h:113,
                 from aws_transcribe_glue.cpp:3:
../../../../src/include/switch_cJSON.h:115:3: note: previous declaration as ‘typedef struct cJSON cJSON’
  115 | } cJSON;
      |   ^~~~~
make[2]: *** [Makefile:791: mod_aws_transcribe_la-aws_transcribe_glue.lo] Error 1
make[2]: Leaving directory '/usr/local/src/freeswitch-1.10.11.-release/src/mod/applications/mod_aws_transcribe'
make[1]: *** [Makefile:732: mod_aws_transcribe-install] Error 1
make[1]: Leaving directory '/usr/local/src/freeswitch-1.10.11.-release/src/mod'
make: *** [Makefile:4338: mod_aws_transcribe-install] Error 2

Steps to Reproduce:

Start with a fresh installation of FreeSWITCH 1.10.11. Attempt to build and install the mod_aws_transcribe module using the standard procedure (e.g., make mod_aws_transcribe-install). Observe the compilation failure with the errors mentioned above.

davehorton commented 3 months ago

that's correct, in our build process for jambonz we have to patch and you will need to do the same, see https://github.com/aws/aws-sdk-cpp/issues/1829#issuecomment-1106468040