|
| 1 | +--- |
| 2 | +title: How to configure RHEL/CentOS 7 |
| 3 | +titleSuffix: Azure Cognitive Services |
| 4 | +description: Learn how to configure RHEL/CentOS 7 so that SpeechSDK can be used. |
| 5 | +services: cognitive-services |
| 6 | +author: pankopon |
| 7 | +manager: jhakulin |
| 8 | +ms.service: cognitive-services |
| 9 | +ms.subservice: speech-service |
| 10 | +ms.topic: conceptual |
| 11 | +ms.date: 03/20/2020 |
| 12 | +ms.author: pankopon |
| 13 | +--- |
| 14 | + |
| 15 | +# Configure RHEL/CentOS 7 for Speech SDK |
| 16 | + |
| 17 | +Red Hat Enterprise Linux (RHEL) 8 x64 and CentOS 8 x64 are officially supported from Speech SDK version 1.10.0 onwards. |
| 18 | + |
| 19 | +It is also possible to use Speech SDK on RHEL/CentOS 7 x64, but this requires updating the C++ compiler (for C++ development) and the shared C++ runtime library on the system. |
| 20 | + |
| 21 | +To check the C++ compiler version, run a command: |
| 22 | + |
| 23 | +```bash |
| 24 | +g++ --version |
| 25 | +``` |
| 26 | + |
| 27 | +If the compiler is installed, the output on vanilla RHEL/CentOS 7 should be like: |
| 28 | + |
| 29 | +``` |
| 30 | +g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39) |
| 31 | +``` |
| 32 | + |
| 33 | +i.e. GCC major version 4. This does not have full support for the C\+\+11 standard that Speech SDK uses, and an attempt to compile a C++ program with Speech SDK headers will result in compilation errors. |
| 34 | + |
| 35 | +Another thing to check is the version of the shared C++ runtime library (libstdc++). Most of Speech SDK is implemented as native C++ libraries, thus it depends on libstdc++ regardless of the actual application development language. |
| 36 | + |
| 37 | +To find the location of libstdc++ on the system, run a command: |
| 38 | + |
| 39 | +```bash |
| 40 | +ldconfig -p | grep libstdc++ |
| 41 | +``` |
| 42 | + |
| 43 | +The output on vanilla RHEL/CentOS 7 (x64) is: |
| 44 | + |
| 45 | +``` |
| 46 | +libstdc++.so.6 (libc6,x86-64) => /lib64/libstdc++.so.6 |
| 47 | +``` |
| 48 | + |
| 49 | +Based on the above, check the version definitions with a command: |
| 50 | + |
| 51 | +```bash |
| 52 | +strings /lib64/libstdc++.so.6 | egrep "GLIBCXX_|CXXABI_" |
| 53 | +``` |
| 54 | + |
| 55 | +The output on vanilla RHEL/CentOS 7 (with only the highest version definitions shown): |
| 56 | + |
| 57 | +``` |
| 58 | +... |
| 59 | +GLIBCXX_3.4.19 |
| 60 | +... |
| 61 | +CXXABI_1.3.7 |
| 62 | +... |
| 63 | +``` |
| 64 | + |
| 65 | +Speech SDK requires **CXXABI_1.3.9** and **GLIBCXX_3.4.21**. (This can be seen e.g. by running `ldd libMicrosoft.CognitiveServices.Speech.core.so` on Speech SDK libraries from the Linux package.) |
| 66 | + |
| 67 | +It is recommended that the version of GCC installed on the system is at least **5.4.0**, with matching runtime libraries. |
| 68 | + |
| 69 | +## Example |
| 70 | + |
| 71 | +The following is a full set of commands to configure RHEL/CentOS 7 x64 for development (C++, C#, Java, Python) with SpeechSDK 1.10.0 or later. |
| 72 | + |
| 73 | +```bash |
| 74 | +# Only run ONE of the following two commands |
| 75 | +# - for CentOS 7: |
| 76 | +sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm |
| 77 | +# - for RHEL 7: |
| 78 | +sudo rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm |
| 79 | + |
| 80 | +# Install development tools and libraries |
| 81 | +sudo yum update -y |
| 82 | +sudo yum groupinstall -y "Development tools" |
| 83 | +sudo yum install -y alsa-lib dotnet-sdk-2.1 java-1.8.0-openjdk-devel openssl python3 |
| 84 | +sudo yum install -y gstreamer1 gstreamer1-plugins-base gstreamer1-plugins-good gstreamer1-plugins-bad-free gstreamer1-plugins-ugly-free |
| 85 | + |
| 86 | +# Build GCC 5.4.0 and runtimes and install them under /usr/local |
| 87 | +sudo yum install -y gmp-devel mpfr-devel libmpc-devel |
| 88 | +curl https://ftp.gnu.org/gnu/gcc/gcc-5.4.0/gcc-5.4.0.tar.bz2 -O |
| 89 | +tar jxf gcc-5.4.0.tar.bz2 |
| 90 | +mkdir gcc-5.4.0-build && cd gcc-5.4.0-build |
| 91 | +../gcc-5.4.0/configure --enable-languages=c,c++ --disable-bootstrap --disable-multilib --prefix=/usr/local |
| 92 | +make -j$(nproc) |
| 93 | +sudo make install-strip |
| 94 | + |
| 95 | +# Set SSL cert file location |
| 96 | +# (this is required for any development/testing with Speech SDK) |
| 97 | +export SSL_CERT_FILE=/etc/pki/tls/certs/ca-bundle.crt |
| 98 | + |
| 99 | +# Add updated C/C++ runtimes to the library path |
| 100 | +# (this is required for any development/testing with Speech SDK) |
| 101 | +export LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH |
| 102 | + |
| 103 | +# For C++ development only: |
| 104 | +# - add the updated compiler to PATH |
| 105 | +# (note, /usr/local/bin should be already first in PATH on vanilla systems) |
| 106 | +# - add Speech SDK libraries from the Linux tar package to LD_LIBRARY_PATH |
| 107 | +# (note, use the actual path to extracted files!) |
| 108 | +export PATH=/usr/local/bin:$PATH |
| 109 | +hash -r # reset cached paths in the current shell session just in case |
| 110 | +export LD_LIBRARY_PATH=/path/to/extracted/SpeechSDK-Linux-1.10.0/lib/x64:$LD_LIBRARY_PATH |
| 111 | + |
| 112 | +# For Python: install the Speech SDK module |
| 113 | +python3 -m pip install azure-cognitiveservices-speech --user |
| 114 | +``` |
| 115 | + |
| 116 | +## Next steps |
| 117 | + |
| 118 | +> [!div class="nextstepaction"] |
| 119 | +> [About the Speech SDK](speech-sdk.md) |
0 commit comments