问题描述
使用centos7进行kaldi编译,执行.configure --shared时,报错:
[root@localhost src]# ./configure --shared
Configuring KALDI to use MKL.
Checking compiler c++ ...
***configure failed: c++ (g++-4.8.5) is not supported.
You need GNU g++ >= 5.0, Apple clang >= 6.0 or LLVM clang >= 3.5. ***
原因分析:
g++版本过低,升级g++即可。
解决方案:
依次执行:
$ yum install -y centos-release-scl
$ yum install -y devtoolset-7-gcc devtoolset-7-gcc-c++
$ scl enable devtoolset-7 bash
执行后输入gcc --version,发现版本已更新。
[root@localhost src]# gcc --version
gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
如果不执行依次执行的第三行代码,查看gcc版本时仍然是低版本,因为centos7中多个gcc版本可以共存。第三行代码的含义是手动激活gcc7版本,但默认的还是使用低版本,故需要使用gcc7时需手动运行第三行代码以激活gcc7。