設定 RHEL/CentOS 7

警告

這篇文章參考 CentOS,這是接近生命週期結束 (EOL) 狀態的 Linux 發行版本。 請據以考慮您的使用方式和規劃。 如需詳細資訊,請參閱 CentOS 生命週期結束指引

若要在 Red Hat Enterprise Linux 上使用語音 SDK (RHEL) 7 x64 和 CentOS 7 x64,請更新 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 上運作。

下一步