{"id":1270,"date":"2024-07-15T13:49:24","date_gmt":"2024-07-15T05:49:24","guid":{"rendered":"http:\/\/118.178.124.79\/wordpress\/?p=1270"},"modified":"2024-07-15T13:49:24","modified_gmt":"2024-07-15T05:49:24","slug":"centos%e5%8d%87%e7%ba%a7gcc%e5%88%b0%e9%ab%98%e7%89%88%e6%9c%ac%ef%bc%88%e5%85%a8%e7%89%88%e6%9c%ac","status":"publish","type":"post","link":"https:\/\/minglelu.cn\/index.php\/2024\/07\/15\/1270\/","title":{"rendered":"CentOS\u5347\u7ea7gcc\u5230\u9ad8\u7248\u672c\uff08\u5168\u7248\u672c"},"content":{"rendered":"<p>\uff0c\u4f46CentOS 6\u7684gcc\u7248\u672c\u4e3a4.4\uff0cCentOS 7\u4e3a4.8\u3002<\/p>\n<p>gcc 4.8\u6700\u4e3b\u8981\u7684\u4e00\u4e2a\u7279\u6027\u5c31\u662f\u5168\u9762\u652f\u6301C++11\uff0c\u5982\u679c\u4e0d\u6e05\u695a\u4ec0\u4e48\u7528\u7684\u4e5f\u6ca1\u5173\u7cfb\uff0c\u7b80\u5355\u8bf4\u4e00\u4e9bC++11\u6807\u51c6\u7684\u7a0b\u5e8f\u90fd\u9700\u8981gcc 4.8\u4ee5\u4e0a\u7248\u672c\u7684gcc\u7f16\u8bd1\u5668\u7f16\u8bd1\uff0c\u5982MySQL 8.0\u7248\u672c(8.0.16\u4ee5\u4e0a\u7248\u672c\u662fC++14\u6807\u51c6\uff0c\u9700gcc 5.3\u4ee5\u4e0a\u7248\u672c)\u3002<\/p>\n<p>CentOS 6\u867d\u7136\u662fgcc 4.4\u7684\u8001\u65e7\u7248\u672c\uff0c\u4f46\u662f\u4e5f\u53ef\u4ee5\u5347\u7ea7gcc\u6765\u5b89\u88c5gcc 4.8\uff0c\u6211\u4eec\u4eca\u5929\u5c31\u4e0d\u91c7\u7528\u7f16\u8bd1\u5b89\u88c5\u7684\u65b9\u6cd5\u4e86\uff0cgcc\u5b89\u88c5\u8d77\u6765\u975e\u5e38\u8d39\u65f6\uff0c\u6211\u4eec\u91c7\u7528CentOS\u7684\u4e00\u4e2a\u7b2c\u4e09\u65b9\u5e93SCL(\u8f6f\u4ef6\u9009\u96c6)\uff0cSCL\u53ef\u4ee5\u5728\u4e0d\u8986\u76d6\u539f\u7cfb\u7edf\u8f6f\u4ef6\u5305\u7684\u60c5\u51b5\u4e0b\u5b89\u88c5\u65b0\u7684\u8f6f\u4ef6\u5305\u4e0e\u8001\u8f6f\u4ef6\u5305\u5171\u5b58\u5e76\u4e14\u53ef\u4ee5\u4f7f\u7528scl\u547d\u4ee4\u5207\u6362\uff0c\u4e0d\u8fc7\u4e5f\u6709\u4e2a\u7f3a\u70b9\u5c31\u662f\u53ea\u652f\u630164\u4f4d\u7684\u3002<\/p>\n<p>\u786e\u5b9a\u5f53\u524dgcc\u7248\u672c\uff0c\u6267\u884c\u547d\u4ee4\uff1agcc &#8211;version<br \/>\n\u4e00\u822c\u5982\u679c\u9700\u8981\u5347\u7ea7gcc\u81f34.8\u6216\u66f4\u9ad8\u7248\u672c\uff0c\u5efa\u8bae\u76f4\u63a5\u91c7\u7528\u5b89\u88c5SCL\u6e90\u4e4b\u540e\u5b89\u88c5devtoolset-6\uff08devtoolset-6\u76ee\u524dgcc\u7248\u672c\u4e3a6.3\uff09\uff0c\u56e0\u4e3adevtoolset-4\u53ca\u4e4b\u524d\u7684\u7248\u672c\u90fd\u5df2\u7ecf\u7ed3\u675f\u652f\u6301\uff0c\u53ea\u80fd\u901a\u8fc7\u5176\u4ed6\u65b9\u6cd5\u5b89\u88c5<\/p>\n<p>\u5347\u7ea7\u5230gcc 6.3\uff1adevtoolset-6\u5df2\u7ecf\u7ed3\u675f\u652f\u6301\uff0c\u8bf7\u5b89\u88c5devtoolset-7<br \/>\nyum -y install centos-release-scl<br \/>\nyum -y install devtoolset-6-gcc devtoolset-6-gcc-c++ devtoolset-6-binutils<br \/>\nscl enable devtoolset-6 bash<\/p>\n<p>\u9700\u8981\u6ce8\u610f\u7684\u662fscl\u547d\u4ee4\u542f\u7528\u53ea\u662f\u4e34\u65f6\u7684\uff0c\u9000\u51fashell\u6216\u91cd\u542f\u5c31\u4f1a\u6062\u590d\u539f\u7cfb\u7edfgcc\u7248\u672c\u3002<br \/>\n\u5982\u679c\u8981\u957f\u671f\u4f7f\u7528gcc 6.3\u7684\u8bdd\uff1a<\/p>\n<p>echo &#8220;source \/opt\/rh\/devtoolset-6\/enable&#8221; &gt;&gt;\/etc\/profile<\/p>\n<p>\u8fd9\u6837\u9000\u51fashell\u91cd\u65b0\u6253\u5f00\u5c31\u662f\u65b0\u7248\u7684gcc\u4e86<br \/>\n\u4ee5\u4e0b\u5176\u4ed6\u7248\u672c\u540c\u7406\uff0c\u4fee\u6539devtoolset\u7248\u672c\u53f7\u5373\u53ef\u3002<br \/>\nVPS\u4fa6\u63a2 https:\/\/www.vpser.net<\/p>\n<p>\u5347\u7ea7\u5230gcc 7.3<br \/>\nyum -y install centos-release-scl<br \/>\nyum -y install devtoolset-7-gcc devtoolset-7-gcc-c++ devtoolset-7-binutils<br \/>\nscl enable devtoolset-7 bash<\/p>\n<p>\u9700\u8981\u6ce8\u610f\u7684\u662fscl\u547d\u4ee4\u542f\u7528\u53ea\u662f\u4e34\u65f6\u7684\uff0c\u9000\u51fashell\u6216\u91cd\u542f\u5c31\u4f1a\u6062\u590d\u539f\u7cfb\u7edfgcc\u7248\u672c\u3002<br \/>\n\u5982\u679c\u8981\u957f\u671f\u4f7f\u7528gcc 7.3\u7684\u8bdd\uff1a<\/p>\n<p>echo &#8220;source \/opt\/rh\/devtoolset-7\/enable&#8221; &gt;&gt;\/etc\/profile<\/p>\n<p>\u5347\u7ea7\u5230gcc 8.3<br \/>\nyum -y install centos-release-scl<br \/>\nyum -y install devtoolset-8-gcc devtoolset-8-gcc-c++ devtoolset-8-binutils<br \/>\nscl enable devtoolset-7 bash<\/p>\n<p>\u9700\u8981\u6ce8\u610f\u7684\u662fscl\u547d\u4ee4\u542f\u7528\u53ea\u662f\u4e34\u65f6\u7684\uff0c\u9000\u51fashell\u6216\u91cd\u542f\u5c31\u4f1a\u6062\u590d\u539f\u7cfb\u7edfgcc\u7248\u672c\u3002<br \/>\n\u5982\u679c\u8981\u957f\u671f\u4f7f\u7528gcc 8.3\u7684\u8bdd\uff1a<\/p>\n<p>echo &#8220;source \/opt\/rh\/devtoolset-8\/enable&#8221; &gt;&gt;\/etc\/profile<\/p>\n<p>\u5347\u7ea7\u5230gcc 9.3<br \/>\nyum -y install centos-release-scl<br \/>\nyum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils<br \/>\nscl enable devtoolset-9 bash<\/p>\n<p>\u9700\u8981\u6ce8\u610f\u7684\u662fscl\u547d\u4ee4\u542f\u7528\u53ea\u662f\u4e34\u65f6\u7684\uff0c\u9000\u51fashell\u6216\u91cd\u542f\u5c31\u4f1a\u6062\u590d\u539f\u7cfb\u7edfgcc\u7248\u672c\u3002<br \/>\n\u5982\u679c\u8981\u957f\u671f\u4f7f\u7528gcc 9.3\u7684\u8bdd\uff1a<\/p>\n<p>echo &#8220;source \/opt\/rh\/devtoolset-9\/enable&#8221; &gt;&gt;\/etc\/profile<\/p>\n<p>\u518d\u8bf4\u4e00\u4e0b\u5df2\u7ecf\u505c\u6b62\u652f\u6301\u7684devtoolset4(gcc 5.2)\u53ca\u4e4b\u524d\u7248\u672c\u7684\u5b89\u88c5\u65b9\u6cd5<\/p>\n<p>\u5347\u7ea7\u5230gcc 4.8<br \/>\nwget https:\/\/people.centos.org\/tru\/devtools-2\/devtools-2.repo -O \/etc\/yum.repos.d\/devtoolset-2.repo<br \/>\nyum -y install devtoolset-2-gcc devtoolset-2-gcc-c++ devtoolset-2-binutils<br \/>\nscl enable devtoolset-2 bash<\/p>\n<p>\u5347\u7ea7\u5230gcc4.9<br \/>\nwget https:\/\/copr.fedoraproject.org\/coprs\/rhscl\/devtoolset-3\/repo\/epel-6\/rhscl-devtoolset-3-epel-6.repo -O \/etc\/yum.repos.d\/devtoolset-3.repo &#8211;no-check-certificate<br \/>\nyum -y install devtoolset-3-gcc devtoolset-3-gcc-c++ devtoolset-3-binutils<br \/>\nscl enable devtoolset-3 bash<\/p>\n<p>\u5347\u7ea7\u5230gcc 5.2<br \/>\nwget https:\/\/copr.fedoraproject.org\/coprs\/hhorak\/devtoolset-4-rebuild-bootstrap\/repo\/epel-6\/hhorak-devtoolset-4-rebuild-bootstrap-epel-6.repo -O \/etc\/yum.repos.d\/devtoolset-4.repo<br \/>\nyum install devtoolset-4-gcc devtoolset-4-gcc-c++ devtoolset-4-binutils -y<br \/>\nscl enable devtoolset-4 bash<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\uff0c\u4f46CentOS 6\u7684gcc\u7248\u672c\u4e3a4.4\uff0cCentOS 7\u4e3a4.8\u3002 gcc 4.8\u6700\u4e3b\u8981\u7684\u4e00\u4e2a\u7279\u6027\u5c31\u662f\u5168\u9762\u652f\u6301C++11\uff0c\u5982\u679c\u4e0d\u6e05\u695a\u4ec0\u4e48\u7528\u7684\u4e5f\u6ca1\u5173\u7cfb\uff0c\u7b80\u5355\u8bf4\u4e00\u4e9bC++11\u6807\u51c6\u7684\u7a0b\u5e8f\u90fd\u9700\u8981gcc 4.8\u4ee5\u4e0a\u7248\u672c\u7684gcc\u7f16\u8bd1\u5668\u7f16\u8bd1\uff0c\u5982MySQL 8.0\u7248\u672c(8.0.16\u4ee5\u4e0a\u7248\u672c\u662fC++14\u6807\u51c6\uff0c\u9700gcc 5.3\u4ee5\u4e0a\u7248\u672c)\u3002 CentOS 6\u867d\u7136\u662fgcc 4.4\u7684\u8001\u65e7\u7248\u672c\uff0c\u4f46\u662f\u4e5f\u53ef\u4ee5\u5347\u7ea7gcc\u6765\u5b89\u88c5g [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1270","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/minglelu.cn\/index.php\/wp-json\/wp\/v2\/posts\/1270","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/minglelu.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/minglelu.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/minglelu.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/minglelu.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1270"}],"version-history":[{"count":1,"href":"https:\/\/minglelu.cn\/index.php\/wp-json\/wp\/v2\/posts\/1270\/revisions"}],"predecessor-version":[{"id":1271,"href":"https:\/\/minglelu.cn\/index.php\/wp-json\/wp\/v2\/posts\/1270\/revisions\/1271"}],"wp:attachment":[{"href":"https:\/\/minglelu.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1270"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/minglelu.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1270"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/minglelu.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1270"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}