CentOS 7.4.1708安裝GCC4.9.4

今天安裝MariaDB10.2.9 ,cmake的時候出現以下錯誤:

CMake Error at storage/tokudb/ft-index/cmake_modules/TokuSetupCompiler.cmake:182 (message):
/usr/bin/c++ doesn't support -std=c++11 or -std=c++0x, you need one that does.

嚇得我趕緊上網一查,我尼瑪。。貌似gcc的版本太低了,二話不說,升級。

1. 下載GCC4.9.4源碼

wget http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-4.9.4/gcc-4.9.4.tar.gz

2. 下載加壓

tar zxvf gcc-4.9.4.tar.gz

3. 進入gcc目錄下載其依賴包

 cd gcc-4.9.4
./contrib/download_prerequisites

4. 建立臨時編譯目錄並進入

mkdir build-gcc
cd build-gcc/

5. 在GCC的臨時編譯目錄裏編譯、安裝

../gcc-4.9.4/configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
make -j 8
make install

最後安裝完,編譯程序會拋出一段話,如下:

Libraries have been installed in:
    /usr/local/lib/../lib64

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
    - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
        during execution
    - add LIBDIR to the `LD_RUN_PATH' environment variable
        during linking
    - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
    - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.

我這裏是執行了make install 之後就直接reboot系統,再開機就是4.9.4版本了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章