{"id":1458,"date":"2022-12-15T15:44:16","date_gmt":"2022-12-15T07:44:16","guid":{"rendered":"http:\/\/175.24.184.226\/?p=1458"},"modified":"2022-12-15T15:44:16","modified_gmt":"2022-12-15T07:44:16","slug":"%e5%88%86%e4%ba%ab%e6%a0%88centos7%e5%ae%89%e8%a3%85gcc10-2-0","status":"publish","type":"post","link":"\/?p=1458","title":{"rendered":"[\u5206\u4eab\u6808]centos7\u5b89\u88c5gcc10.2.0"},"content":{"rendered":"<h1>1\u3001\u5207\u6362\u5230root\u8d26\u6237<\/h1>\n<h1>2\u3001\u5b89\u88c5gcc4.8.5<\/h1>\n<pre><code>yum install -y gcc gcc-c++<\/code><\/pre>\n<p><img src=\"https:\/\/img.wulinn.com\/img\/gcc1020installgcc485.png\" alt=\"gcc1020installgcc485.png\" title=\"gcc1020installgcc485.png\" \/><\/p>\n<p><img src=\"https:\/\/img.wulinn.com\/img\/gcc1020installgcc485finish.png\" alt=\"gcc1020installgcc485finish.png\" title=\"gcc1020installgcc485finish.png\" \/><\/p>\n<h1>3\u3001\u5b89\u88c5bzip2<\/h1>\n<pre><code>yum install -y bzip2<\/code><\/pre>\n<p><img src=\"https:\/\/img.wulinn.com\/img\/gcc1020installbzip2.png\" alt=\"gcc1020installbzip2.png\" title=\"gcc1020installbzip2.png\" \/><\/p>\n<p><img src=\"https:\/\/img.wulinn.com\/img\/gcc1020installbzip2finish.png\" alt=\"gcc1020installbzip2finish.png\" title=\"gcc1020installbzip2finish.png\" \/><\/p>\n<h1>4\u3001\u4e0b\u8f7dgcc10.2.0\u5305<\/h1>\n<pre><code>wget -P \/home https:\/\/mirrors.aliyun.com\/gnu\/gcc\/gcc-10.2.0\/gcc-10.2.0.tar.gz<\/code><\/pre>\n<p><img src=\"https:\/\/img.wulinn.com\/img\/gcc1020downloadpackage.png\" alt=\"gcc1020downloadpackage.png\" title=\"gcc1020downloadpackage.png\" \/><\/p>\n<p>\u51fa\u73b0\u9519\u8bef\uff1awget: \u65e0\u6cd5\u89e3\u6790\u4e3b\u673a\u5730\u5740 \u201cmirrors.aliyun.com\u201d\uff0c\u624b\u52a8\u4fee\u6539dns\u5373\u53ef\uff1b<\/p>\n<h1>5\u3001\u89e3\u538b\u955c\u50cf\u6587\u4ef6<\/h1>\n<pre><code>cd \/home &amp;&amp; tar -xzvf \/home\/gcc-10.2.0.tar.gz<\/code><\/pre>\n<p><img src=\"https:\/\/img.wulinn.com\/img\/gcc1020untarfinish.png\" alt=\"gcc1020untarfinish.png\" title=\"gcc1020untarfinish.png\" \/><\/p>\n<h1>6\u3001\u914d\u7f6e\u4f9d\u8d56\u9879<\/h1>\n<pre><code>cd \/home\/gcc-10.2.0 &amp;&amp; .\/contrib\/download_prerequisites<\/code><\/pre>\n<p><img src=\"https:\/\/img.wulinn.com\/img\/gcc1020downloadrequire.png\" alt=\"gcc1020downloadrequire.png\" title=\"gcc1020downloadrequire.png\" \/><\/p>\n<p>\u8fd9\u4e00\u6b65\u53ef\u80fd\u56fd\u5185\u4f1a\u7b49\u5f85\u6bd4\u8f83\u4e45\uff0c\u8010\u5fc3\u7b49\u5f85\uff0c\u5982\u679c\u51fa\u73b0<code>error: Cannot download gmp-6.1.0.tar.bz2 from ftp:\/\/gcc.gnu.org\/pub\/gcc\/infrastructure\/<\/code>\u9519\u8bef\uff0c\u6267\u884c<\/p>\n<pre><code> wget https:\/\/gcc.gnu.org\/pub\/gcc\/infrastructure\/gmp-6.1.0.tar.bz2<\/code><\/pre>\n<p>\u5982\u679c\u62a5\u9519\u5176\u4ed6\u6587\u4ef6\u4e0d\u80fd\u4e0b\u8f7d\uff0c\u53bb<a href=\"https:\/\/gcc.gnu.org\/pub\/gcc\/infrastructure\/\">https:\/\/gcc.gnu.org\/pub\/gcc\/infrastructure\/<\/a>\u4e0b\u8f7d\u5bf9\u5e94\u6587\u4ef6\uff0c\u590d\u5236\u5230<code>\/home\/gcc-10.2.0<\/code>\u5373\u53ef\u3002<\/p>\n<h1>7\u3001\u521b\u5efa\u5b89\u88c5\u6587\u4ef6\u5939<\/h1>\n<pre><code>mkdir \/usr\/lib\/gcc\/x86_64-redhat-linux\/10.2.0<\/code><\/pre>\n<h1>8\u3001\u521b\u5efa\u7f16\u8bd1\u6587\u4ef6\u5939<\/h1>\n<pre><code>mkdir \/home\/gcc-build-10.2.0\ncd \/home\/gcc-build-10.2.0<\/code><\/pre>\n<h1>9\u3001\u914d\u7f6e\u5b89\u88c5\u6587\u4ef6<\/h1>\n<pre><code>..\/gcc-10.2.0\/configure --prefix=\/usr\/lib\/gcc\/x86_64-redhat-linux\/10.2.0\/ --enable-checking=release --enable-languages=c,c++ --disable-multilib<\/code><\/pre>\n<p><img src=\"https:\/\/img.wulinn.com\/img\/gcc1020readyfile.png\" alt=\"gcc1020readyfile.png\" title=\"gcc1020readyfile.png\" \/><\/p>\n<p><img src=\"https:\/\/img.wulinn.com\/img\/gcc1020readyfilefinish.png\" alt=\"gcc1020readyfilefinish.png\" title=\"gcc1020readyfilefinish.png\" \/><\/p>\n<h1>10\u3001\u6267\u884c\u7f16\u8bd1\u5e76\u5b89\u88c5(\u7f16\u8bd1\u9700\u89812-3\u5c0f\u65f6\uff0c\u8bf7\u8010\u5fc3\u7b49\u5f85)<\/h1>\n<pre><code>make &amp;&amp; make install<\/code><\/pre>\n<h1>11\u3001\u5907\u4efd\u539fgcc\u5e76\u94fe\u63a5\u65b0gcc<\/h1>\n<pre><code>mv \/usr\/bin\/gcc \/usr\/bin\/gcc-4.8.5\nmv \/usr\/bin\/g++ \/usr\/bin\/g++-4.8.5\nalternatives --install \/usr\/bin\/gcc gcc \/usr\/bin\/gcc-4.8.5 88 --slave \/usr\/bin\/g++ g++ \/usr\/bin\/g++-4.8.5\nalternatives --install \/usr\/bin\/gcc gcc \/usr\/lib\/gcc\/x86_64-redhat-linux\/10.2.0\/bin\/x86_64-pc-linux-gnu-gcc 99 --slave \/usr\/bin\/g++ g++ \/usr\/lib\/gcc\/x86_64-redhat-linux\/10.2.0\/bin\/x86_64-pc-linux-gnu-g++\nalternatives --config gcc<\/code><\/pre>\n<p><img src=\"https:\/\/img.wulinn.com\/img\/gcc1020backipgcc.png\" alt=\"gcc1020backipgcc.png\" title=\"gcc1020backipgcc.png\" \/><\/p>\n<p><img src=\"https:\/\/img.wulinn.com\/img\/gcc1020linknewgcc.png\" alt=\"gcc1020linknewgcc.png\" title=\"gcc1020linknewgcc.png\" \/><\/p>\n<h1>12\u3001\u67e5\u8be2\u7248\u672c<\/h1>\n<pre><code>gcc -v\ng++ -v<\/code><\/pre>\n<p><img src=\"https:\/\/img.wulinn.com\/img\/gcc1020gccv.png\" alt=\"gcc1020gccv.png\" title=\"gcc1020gccv.png\" \/><\/p>\n<p><img src=\"https:\/\/img.wulinn.com\/img\/gcc1020g++v.png\" alt=\"gcc1020g++v.png\" title=\"gcc1020g++v.png\" \/><\/p>\n<h1>13\u3001\u66ff\u6362\u5e93\u94fe\u63a5<\/h1>\n<p>\u5982\u679c\u51fa\u73b0\u9519\u8bef\uff1a<\/p>\n<pre><code>\/lib64\/libstdc++.so.6: version `GLIBCXX_3.4.21&#039; not found\n\/lib64\/libstdc++.so.6: version `GLIBCXX_3.4.22&#039; not found<\/code><\/pre>\n<p>\u6267\u884c\u4ee5\u4e0b\u8bed\u53e5\uff0c\u94fe\u63a5\u65b0\u7684libstdc++.so.6\u5e93\u6587\u4ef6<\/p>\n<pre><code>rm -f \/usr\/lib64\/libstdc++.so.6\nln -s \/usr\/lib\/gcc\/x86_64-redhat-linux\/10.2.0\/lib64\/libstdc++.so.6 \/usr\/lib64\/libstdc++.so.6<\/code><\/pre>\n<p><img src=\"https:\/\/img.wulinn.com\/img\/gcc1020linklib.png\" alt=\"gcc1020linklib.png\" title=\"gcc1020linklib.png\" \/><\/p>\n<p>\u53ef\u4ee5\u7528\u4ee5\u4e0b\u6307\u4ee4\u67e5\u770b\u76ee\u524d\u5305\u542b\u54ea\u4e9b\u5e93<\/p>\n<pre><code>strings \/usr\/lib64\/libstdc++.so.6 | grep GLIBC<\/code><\/pre>\n<p><img src=\"https:\/\/img.wulinn.com\/img\/gcc1020linklibfinish.png\" alt=\"gcc1020linklibfinish.png\" title=\"gcc1020linklibfinish.png\" \/><\/p>\n<p>\u672c\u6587\u8f6c\u81ea <a href=\"https:\/\/www.wulinn.com\/share\/centos7installgcc1020.html\">https:\/\/www.wulinn.com\/share\/centos7installgcc1020.html<\/a>\uff0c\u5982\u6709\u4fb5\u6743\uff0c\u8bf7\u8054\u7cfb\u5220\u9664\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u5207\u6362\u5230root\u8d26\u6237 2\u3001\u5b89\u88c5gcc4.8.5 yum install -y gcc gcc-c++ 3\u3001\u5b89\u88c5bzip2 yum in   \u2026 &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0},"categories":[25],"tags":[127,16],"_links":{"self":[{"href":"\/index.php?rest_route=\/wp\/v2\/posts\/1458"}],"collection":[{"href":"\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1458"}],"version-history":[{"count":1,"href":"\/index.php?rest_route=\/wp\/v2\/posts\/1458\/revisions"}],"predecessor-version":[{"id":1459,"href":"\/index.php?rest_route=\/wp\/v2\/posts\/1458\/revisions\/1459"}],"wp:attachment":[{"href":"\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1458"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1458"},{"taxonomy":"post_tag","embeddable":true,"href":"\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1458"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}