cognitive-services-speech-sdk: Failed to initialize platform (azure-c-shared). Error: 2176
I’ve updated .NET to 8.0 and moved to Docker and now I cannot use Speech service anymore due to this error when creating SpeechSynthesizer class instance.
Stacktrace:
System.ApplicationException: Runtime error: Failed to initialize platform (azure-c-shared). Error: 2176
2024-01-06T17:53:47.649086302Z at Microsoft.CognitiveServices.Speech.Internal.SpxExceptionThrower.ThrowIfFail(IntPtr hr)
2024-01-06T17:53:47.649089762Z at Microsoft.CognitiveServices.Speech.SpeechSynthesizer.FromConfig(SpeechConfig speechConfig)
2024-01-06T17:53:47.649092962Z at Microsoft.CognitiveServices.Speech.SpeechSynthesizer..ctor(SpeechConfig speechConfig)
Speech log file:
[631194]: 4ms SPX_DBG_TRACE_VERBOSE: resource_manager.cpp:133 Created 'CSpxThreadService' as '303073113'
[631194]: 4ms SPX_DBG_TRACE_VERBOSE: resource_manager.cpp:133 Created 'CSpxThreadService' as '303073113'
[631194]: 4ms SPX_TRACE_WARNING: resource_manager.cpp:141 Failed to create 'CSpxCodecAdapter' as '199052375'. Are all required extension libraries loaded?
[631194]: 4ms SPX_DBG_TRACE_VERBOSE: usp_tts_engine_adapter.cpp:60 CSpxUspTtsEngineAdapter
[631194]: 4ms SPX_DBG_TRACE_VERBOSE: resource_manager.cpp:133 Created 'CSpxUspTtsEngineAdapter' as '919101823'
[631194]: 4ms SPX_TRACE_ERROR: AZ_LOG_ERROR: shim_openssl.c:55 libssl could not be loaded
[631194]: 4ms SPX_TRACE_ERROR: AZ_LOG_ERROR: tlsio_openssl.c:2175 Could not load libssl
[631194]: 4ms SPX_TRACE_ERROR: exception.cpp:130 About to throw Runtime error: Failed to initialize platform (azure-c-shared). Error: 2176
[CALL STACK BEGIN]
/app/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so(+0x1decbb) [0x7ece7c5decbb]
/app/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so(+0x207afd) [0x7ece7c607afd]
/lib/x86_64-linux-gnu/libc.so.6(+0x8dea7) [0x7f0fd1a35ea7]
/app/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so(+0x208c2e) [0x7ece7c608c2e]
/app/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so(+0x1b9c7b) [0x7ece7c5b9c7b]
/app/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so(+0x1b9531) [0x7ece7c5b9531]
/app/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so(+0x1e5c5d) [0x7ece7c5e5c5d]
/app/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so(+0x1cabf6) [0x7ece7c5cabf6]
/app/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so(+0x1dba0e) [0x7ece7c5dba0e]
/app/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so(+0xf28a5) [0x7ece7c4f28a5]
/app/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so(+0x1e5c5d) [0x7ece7c5e5c5d]
/app/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so(+0x1d2a1f) [0x7ece7c5d2a1f]
/app/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so(+0x21619a) [0x7ece7c61619a]
/app/runtimes/linux-x64/native/libMicrosoft.CognitiveServices.Speech.core.so(synthesizer_create_speech_synthesizer_from_config+0xf3) [0x7ece7c4bd331]
[0x7f0f58dd9aad]
[CALL STACK END]
[631194]: 4ms SPX_DBG_TRACE_VERBOSE: usp_tts_engine_adapter.cpp:65 ~CSpxUspTtsEngineAdapter: this=0x0x7ece6c0cbf60
[631194]: 4ms SPX_DBG_TRACE_SCOPE_ENTER: synthesizer.cpp:42 ~CSpxSynthesizer
[631194]: 4ms SPX_DBG_TRACE_VERBOSE: create_object_helpers.h:78 SpxTerm: ptr=0x0x7ece6c1ca168
[631194]: 4ms SPX_DBG_TRACE_SCOPE_ENTER: thread_service.cpp:45 Term
[631194]: 4ms SPX_DBG_TRACE_SCOPE_EXIT: thread_service.cpp:45 Term
[631194]: 4ms SPX_DBG_TRACE_VERBOSE: create_object_helpers.h:78 SpxTerm: ptr=0x0x7ece6c1c9a78
[631194]: 4ms SPX_DBG_TRACE_SCOPE_EXIT: synthesizer.cpp:42 ~CSpxSynthesizer
[631194]: 4ms SPX_DBG_TRACE_SCOPE_ENTER: thread_service.cpp:45 Term
[631194]: 4ms SPX_DBG_TRACE_SCOPE_EXIT: thread_service.cpp:45 Term
[631194]: 4ms SPX_DBG_TRACE_SCOPE_ENTER: thread_service.cpp:45 Term
[631194]: 4ms SPX_DBG_TRACE_SCOPE_EXIT: thread_service.cpp:45 Term
[631194]: 4ms SPX_DBG_TRACE_VERBOSE: handle_table.h:111 CSpxHandleTable::TrackHandle p=0x0x7ece6c1ca200
[631194]: 4ms SPX_DBG_TRACE_VERBOSE: handle_table.h:121 CSpxHandleTable::TrackHandle class=ExceptionWithCallStack, h=0x0x7ece6c1ca200, p=0x0x7ece6c1ca200, tot=1
[631194]: 4ms SPX_RETURN_ON_FAIL: speechapi_c_factory.cpp:566 hr = 0x7ece6c1ca200
[631194]: 4ms SPX_DBG_TRACE_SCOPE_EXIT: speechapi_c_factory.cpp:556 synthesizer_create_speech_synthesizer_from_config
[631194]: 5ms SPX_DBG_TRACE_VERBOSE: handle_table.h:180 CSpxHandleTable::StopTracking(h) h=0x0x7ece6c1ca200
[631194]: 5ms SPX_DBG_TRACE_VERBOSE: handle_table.h:195 CSpxHandleTable::StopTracking(h) class=ExceptionWithCallStack, h=0x0x7ece6c1ca200, p=0x0x7ece6c1ca200, tot=0
To Reproduce
Steps to reproduce the behavior:
- Create Docker container based on latest ASP.NET 8.0 image:
8.0.0-bookworm-slim-amd64, 8.0-bookworm-slim-amd64, 8.0.0-bookworm-slim, 8.0-bookworm-slim, 8.0.0, 8.0, latest Dockerfile Debian 12 12/19/2023 - Run container
- Create SpeechSynthesizer object
Expected behavior
Object should be created and I can access Speech Service.
Version of the Cognitive Services Speech SDK
Nuget: Microsoft.CognitiveServices.Speech 1.34.0
Azure Resource: Standard Speech Service based on Norh Europe https://northeurope.api.cognitive.microsoft.com/
Platform, Operating System, and Programming Language
- OS: Docker, image based on latest ASP.NET 8.0
- Programming language: C#
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 7
- Comments: 22 (3 by maintainers)
I am using the Speech SDK in a docker container running on .NET 8. Here is my workaround, which installs libssl 1.1.1
Both failures are the azure-c-shared library used as the networking stack by the SDK failing to load because the version of OpenSSL it binds to (1.1.1) isn’t installed.
There is a workstream to support OpenSSL 3.0 in progress, but it isn’t complete yet.
following https://gist.github.com/joulgs/c8a85bb462f48ffc2044dd878ecaa786?permalink_comment_id=4720594 to install libssl1.1_1.1.0g-2ubuntu4_amd64.deb and it is working now
Hi! I tried to replicate this with a python environment and openssl seems to not be installing. For anyone else who is interested, , my DockerFile is the following
Great, it worked This is a temporary solution, because Microsoft is too inefficient (this problem is probably more than a year old), and if you want to solve it, you can only do it this way Or change to restapi
This one got it going in my python:3.12.2 image. Credit to @boskjoett
@muralidhar972 We don’t have packages available for preview yet.