官方安装教程链接为https://github.com/facebookresearch/maskrcnn-benchmark/blob/master/INSTALL.md
注意redhat7默认的gcc版本为4.8,不满足gcc>=4.9的要求。
安装过程中,如果保持原有4.8的gcc版本,会报warning,不会报错,但是之后代码无法运行。
报错为“maskrcnn_benchmark died with <Signals.SIGSEGV: 11>.“根据https://github.com/facebookresearch/maskrcnn-benchmark/blob/master/TROUBLESHOOTING.md#segmentation-fault-core-dumped-when-running-the-library,应该更新gcc版本。注意更新之后,apx和maskrcnn-benchmark应该rm -rf build,并重新build。
安装gcc可以参考教程https://jdhao.github.io/2017/09/04/install-gcc-newer-version-on-centos/,Author jdhao。
搬运如下:
The default GCC that comes with the CentOS 7.2 is GCC 4.8.5, which does not support the complete C++11 standard, for example, it does not fully support regular expressions. In order to use regular expression functions, we need to install at least GCC 4.9.0. The following installation procedure is applicable to CentOS 7 and are not tested on other Linux systems. Also you have to make sure that you have root privelege.
Update:
GCC 8.3 has been released on Feb 22, 2019. The installation process is the same as prvevious versions. Download the corrent tar file from the GNU ftp server, compile and install it.
Downloading GCC source code
You can download the GCC source code from the official GNU ftp. I choose to install version 5.4.0.
curl https://ftp.gnu.org/gnu/gcc/gcc-5.4.0/gcc-5.4.0.tar.bz2 -O
tar jxvf gcc-5.4.0.tar.bz2
Install dependencies
We need to install 3 dependencies packages. It is recommended to install these packages through yum.
yum install gmp-devel mpfr-devel libmpc-devel
Configuration and install
Unlike other packages, it is recommended to create another build directory outside of the GCC source directory to build GCC.
mkdir gcc-5.4.0-build
cd gcc-5.4.0-build
../gcc-5.4.0/configure --enable-languages=c,c++ --disable-multilib
make -j$(nproc) && make install
The comiplation process may take a long time and you need to be patient. It will install GCC under /usr/local
. You can change the install dir using --prefix
option if you prefer.
Post-installation
You should add the install dir of GCC to your PATH
and LD_LIBRARY_PATH
in order to use the newer GCC. Add the following settings to /etc/profile
:
export PATH=/usr/local/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH
Maybe a restart of your current session is also needed.
You can download the whole install script here.
References
Author jdhao
LastMod 2019-04-20
License CC BY-NC-ND 4.0
以上为搬运内容。
要注意的是,在安装中,可能会因为权限问题,使make install不通过。可以用sudo。
之后使用gcc -v可以查看实际的版本。