共用方式為


設定 RHEL/CentOS 7

警告

本文參考 CentOS,這是一個處於終止服務 (EOL) 狀態的 Linux 發行版。 請據此考慮您的使用方式和規劃。 如需詳細資訊,請參閱 CentOS 生命週期結束指導

若要在 Red Hat Enterprise Linux (RHEL) 7 x64 和 CentOS 7 x64 上使用語音 SDK,請更新您系統上的 C++ 編譯器 (針對 C++ 開發) 和共用的 C++ 執行階段程式庫。

安裝相依性

首先,安裝所有一般相依性:

sudo rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm

# Install development tools and libraries
sudo yum update -y
sudo yum groupinstall -y "Development tools"
sudo yum install -y alsa-lib dotnet-sdk-2.1 java-1.8.0-openjdk-devel openssl
sudo yum install -y gstreamer1 gstreamer1-plugins-base gstreamer1-plugins-good gstreamer1-plugins-bad-free gstreamer1-plugins-ugly-free

C/C++ 編譯器和執行階段程式庫

使用此命令安裝必要套件:

sudo yum install -y gmp-devel mpfr-devel libmpc-devel

接下來,更新編譯器和執行階段程式庫:

# Build GCC 7.5.0 and runtimes and install them under /usr/local
curl https://ftp.gnu.org/gnu/gcc/gcc-7.5.0/gcc-7.5.0.tar.gz -O
tar -xf gcc-7.5.0.tar.gz
mkdir gcc-7.5.0-build && cd gcc-7.5.0-build
../gcc-7.5.0/configure --enable-languages=c,c++ --disable-bootstrap --disable-multilib --prefix=/usr/local
make -j$(nproc)
sudo make install-strip

如果需要在多部電腦上部署更新的編譯器和程式庫,您可以將其從 /usr/local 中複製到其他電腦。 如果只需要執行階段程式庫,那麼只要 /usr/local/lib64 中的檔案即可。

環境設定

執行以下命令以完成設定:

# Add updated C/C++ runtimes to the library path
# (this is required for any development/testing with Speech SDK)
export LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH

# For C++ development only:
# - add the updated compiler to PATH
#   (note, /usr/local/bin should be already first in PATH on vanilla systems)
# - add Speech SDK libraries from the Linux tar package to LD_LIBRARY_PATH
#   (note, use the actual path to extracted files!)
export PATH=/usr/local/bin:$PATH
hash -r # reset cached paths in the current shell session just in case
export LD_LIBRARY_PATH=/path/to/extracted/SpeechSDK-Linux-<version>/lib/centos7-x64:$LD_LIBRARY_PATH

注意

Linux .tar 套件包含適用於 RHEL/CentOS 7 的特定程式庫。 這些是在 lib/centos7-x64 中,如上述的 LD_LIBRARY_PATH 環境設定範例所示。 lib/x64 中的語音 SDK 程式庫適用於所有其他支援的 Linux x64 發行版本 (包括 RHEL/CentOS 8),且無法在 RHEL/CentOS 7 上運作。

下一步