{"id":13610,"date":"2024-02-08T20:15:07","date_gmt":"2024-02-08T12:15:07","guid":{"rendered":"https:\/\/92it.top\/?p=13610"},"modified":"2024-02-08T21:05:11","modified_gmt":"2024-02-08T13:05:11","slug":"centos7%e5%8d%87%e7%ba%a7gcc9","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=13610","title":{"rendered":"Centos7\u5347\u7ea7gcc9"},"content":{"rendered":"\n<p><strong>1.CentOS7\u81ea\u5e26\u7684GCC\u7248\u672c\u662f4.8.5\uff0c\u5982\u4e0b\u6240\u793a<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># cat \/etc\/redhat-release\nCentOS Linux release &lt;strong>7.6.1810&lt;\/strong> (Core)\n#which gcc\n#gcc -v\nUsing built-in specs.\nCOLLECT_GCC=gcc\nCOLLECT_LTO_WRAPPER=\/usr\/libexec\/gcc\/x86_64-redhat-linux\/4.8.5\/lto-wrapper\nTarget: x86_64-redhat-linux\nConfigured with: ..\/configure --prefix=\/usr --mandir=\/usr\/share\/man --infodir=\/usr\/share\/info --with-bugurl=http:\/\/bugzilla.redhat.com\/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=\/builddir\/build\/BUILD\/gcc-4.8.5-20150702\/obj-x86_64-redhat-linux\/isl-install --with-cloog=\/builddir\/build\/BUILD\/gcc-4.8.5-20150702\/obj-x86_64-redhat-linux\/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux\nThread model: posix\ngcc version &lt;strong>4.8.5&lt;\/strong> 20150623 (Red Hat 4.8.5-36) (GCC)\n<\/pre>\n\n\n\n<p><strong>2.\u5347\u7ea7\u5230gcc-9\u7248\u672c <\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<pre class=\"wp-block-preformatted\">yum install centos-release-scl -y &amp;&amp; yum install devtoolset-9-gcc*  -y &amp;&amp; scl enable devtoolset-9 bash <\/pre>\n\n\n\n<p>\u5b89\u88c5\u6210\u529f\u540e \u53ea\u662f\u4e34\u65f6\u7684\uff0c\u9000\u51fashell\u6216\u91cd\u542f\u5c31\u4f1a\u6062\u590d\u539f\u7cfb\u7edfgcc\u7248\u672c\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u8981\u957f\u671f\u4f7f\u7528gcc 9.3\u7684\u8bdd\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">echo \"source \/opt\/rh\/devtoolset-9\/enable\" &gt;&gt;\/etc\/profile<\/pre>\n\n\n\n<p>\u67e5\u770bgcc\u7248\u672c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">gcc -v<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">which gcc\n\t\/opt\/rh\/devtoolset-9\/root\/usr\/bin\/gcc\ngcc -v\n\tUsing built-in specs.\n\tCOLLECT_GCC=gcc\n\tCOLLECT_LTO_WRAPPER=\/opt\/rh\/devtoolset-9\/root\/usr\/libexec\/gcc\/x86_64-redhat-linux\/9\/lto-wrapper\n\tTarget: x86_64-redhat-linux\n\tConfigured with: ..\/configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=\/opt\/rh\/devtoolset-9\/root\/usr --mandir=\/opt\/rh\/devtoolset-9\/root\/usr\/share\/man --infodir=\/opt\/rh\/devtoolset-9\/root\/usr\/share\/info --with-bugurl=http:\/\/bugzilla.redhat.com\/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --with-default-libstdcxx-abi=gcc4-compatible --enable-plugin --enable-initfini-array --with-isl=\/builddir\/build\/BUILD\/gcc-9.3.1-20200408\/obj-x86_64-redhat-linux\/isl-install --disable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux\n\tThread model: posix\n\tgcc version 9.3.1 20200408 (Red Hat 9.3.1-2) (GCC)<\/pre>\n\n\n\n<p>\u5982\u679c\u63d0\u793a\/opt\/rh\/devtoolset-9\/\/enable scriptlet does not exist<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">yum install devtoolset-9-runtime\n\u6216\u8005\nyum reinstall devtoolset-9-runtime<\/pre>\n\n\n\n<p><strong>3.\u5b89\u88c5\u5176\u4ed6\u9ad8\u7248\u672cgcc<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u53ea\u9700\u8981\u628a\u6b65\u9aa42\u7684<strong>devtoolset-9<\/strong>\u6539\u6210<strong>devtoolset-7<\/strong>\u5c31\u662f\u5b89\u88c5gcc7\u548cg++7\uff0c\u4e5f\u5c31\u662f\u8bf4\u6570\u5b57\u51e0\u5c31\u662f\u4ee3\u8868\u7248\u672c\uff0c\u5e76\u4e14\u76f8\u4e92\u4e4b\u95f4\u4e0d\u4f1a\u6709\u5f71\u54cd\u3002<\/p>\n\n\n\n<p><strong>4.\u6709\u7684\u65f6\u5019\u6211\u4eec\u9700\u8981\u6062\u590d4.8.5\u7248\u672c<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u5f53\u6211\u4eec\u5347\u7ea7\u5230\u6700\u65b0\u7248\u672c\u4ee5\u540e\uff0c\u5982\u4f55\u6062\u590d\u5230<strong>4.8.5\u7248\u672c<\/strong>\u5462\uff1f<\/p>\n\n\n\n<p>\u53ef\u4ee5\u6253\u5f00 \/etc\/profile\u6587\u4ef6\uff0c<strong><span class=\"has-inline-color has-vivid-red-color\">\u5220\u9664<\/span><\/strong>\u7b2c78\u884c\u5373\u53ef\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">source \/opt\/rh\/devtoolset-9\/enable<\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2024\/02\/image-67-1024x525.png\" alt=\"\" class=\"wp-image-13620\" width=\"526\" height=\"269\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2024\/02\/image-67-1024x525.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2024\/02\/image-67-300x154.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2024\/02\/image-67-768x394.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2024\/02\/image-67-1536x788.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2024\/02\/image-67-830x426.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2024\/02\/image-67-230x118.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2024\/02\/image-67-350x180.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2024\/02\/image-67-480x246.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2024\/02\/image-67.png 1700w\" sizes=\"(max-width: 526px) 100vw, 526px\" \/><\/figure><\/div>\n\n\n\n<p>\u91cd\u542fshell\u63a7\u5236\u53f0\u3002<\/p>\n\n\n\n<p>gcc -v\u4f1a\u53d1\u73b0\u5df2\u7ecf\u6062\u590d\u8001\u7248\u672c\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1.CentOS7\u81ea\u5e26\u7684GCC\u7248\u672c\u662f4.8.5\uff0c\u5982\u4e0b\u6240\u793a 2.\u5347\u7ea7\u5230gcc-9\u7248\u672c yum install c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/13610"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=13610"}],"version-history":[{"count":7,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/13610\/revisions"}],"predecessor-version":[{"id":13621,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/13610\/revisions\/13621"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=13610"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=13610"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=13610"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}