{"id":84788,"date":"2023-12-08T05:31:10","date_gmt":"2023-12-07T21:31:10","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=84788"},"modified":"2023-12-08T05:31:10","modified_gmt":"2023-12-07T21:31:10","slug":"linux-gcc-upgrade","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-gcc-upgrade.html","title":{"rendered":"Linux gcc\u7248\u672c\u5982\u4f55\u5347\u7ea7"},"content":{"rendered":"

\u64cd\u4f5c\u73af\u5883 Red-hat 6.2 64bit\uff0cyum\u5b89\u88c5\u81ea\u5e26\u7248\u672c4.4.7\uff0c\u4e0d\u80fd\u652f\u6301C++11\u7684\u7279\u6027\uff0c\u9700\u8981\u5347\u7ea7\u52304.8.2\uff0c\u672c\u6587\u4e3b\u8981\u64cd\u4f5c\u5982\u4e0b\u3002<\/p>\n

\u7b80\u6613\u5b89\u88c5 <\/strong><\/div>\n

\u83b7\u53d6\u5b89\u88c5\u5305\u5e76\u89e3\u538b<\/p>\n

wget http:\/\/ftp.gnu.org\/gnu\/gcc\/gcc-4.8.2\/gcc-4.8.2.tar.bz2\r\ntar -jxvf gcc-4.8.2.tar.bz2<\/pre>\n

\u5f53\u7136\uff0chttp:\/\/ftp.gnu.org\/gnu\/gcc \u91cc\u9762\u6709\u6240\u6709\u7684gcc\u7248\u672c\u4f9b\u4e0b\u8f7d\uff0c\u6700\u65b0\u7248\u672c\u5df2\u7ecf\u67094.9.2\u5566\u3002\u4e0b\u8f7d\u4f9b\u7f16\u8bd1\u9700\u6c42\u7684\u4f9d\u8d56\u9879\uff0c\u8fd9\u4e2a\u795e\u5947\u7684\u811a\u672c\u6587\u4ef6\u4f1a\u5e2e\u6211\u4eec\u4e0b\u8f7d\u3001\u914d\u7f6e\u3001\u5b89\u88c5\u4f9d\u8d56\u5e93\uff0c\u53ef\u4ee5\u8282\u7ea6\u6211\u4eec\u5927\u91cf\u7684\u65f6\u95f4\u548c\u7cbe\u529b\u3002<\/p>\n

cd gcc-4.8.2\u3000\r\n.\/contrib\/download_prerequisites\u3000\r\n<\/pre>\n

\u5efa\u7acb\u4e00\u4e2a\u76ee\u5f55\u4f9b\u7f16\u8bd1\u51fa\u7684\u6587\u4ef6\u5b58\u653e<\/p>\n

mkdir gcc-build-4.8.2\r\ncd gcc-build-4.8.2<\/pre>\n

\u751f\u6210Makefile\u6587\u4ef6<\/p>\n

..\/configure -enable-checking=release -enable-languages=c,c++ -disable-multilib<\/pre>\n

\u7f16\u8bd1\uff08\u6ce8\u610f\uff1a\u6b64\u6b65\u9aa4\u975e\u5e38\u8017\u65f6\uff09<\/p>\n

make -j4<\/pre>\n

-j4\u9009\u9879\u662fmake\u5bf9\u591a\u6838\u5904\u7406\u5668\u7684\u4f18\u5316\u3002<\/p>\n

\u5b89\u88c5<\/p>\n

sudo make install<\/pre>\n
\u9a8c\u8bc1\u5b89\u88c5<\/strong><\/div>\n

\u91cd\u542f\uff0c\u7136\u540e\u67e5\u770bgcc\u7248\u672c<\/p>\n

gcc -v<\/pre>\n

\u5199\u4e00\u4e2aC++11\u7279\u6027\u7684\u7a0b\u5e8f\u6bb5 test.cpp\uff0c\u4f7f\u7528\u4e86shared_ptr<\/p>\n

\/\/test.cpp\r\n#include \r\n#include \r\nusing namespace std;\r\nint main()\r\n{\r\n      shared_ptr pInt(new int(10));\r\n      cout < < *pInt << endl;\r\n      return 0;\r\n}<\/int><\/memory><\/iostream><\/pre>\n

\u9a8c\u8bc1<\/p>\n

g++ -std=c++11 -o test test.cpp\r\n.\/test<\/pre>\n

\u5982\u679c\u627e\u4e0d\u5230libstdc++.so.6\u4e2d\u7684GLIBCXX_3.4.15\uff0c\u8bf7\u6267\u884c\u4e0b\u9762\u547d\u4ee4<\/p>\n

cp \/usr\/local\/lib64\/libstdc++.so.6.0.18 \/usr\/lib64\r\nrm -rf \/usr\/lib64\/libstdc++.so.6\r\nln -s \/usr\/lib64\/libstdc++.so.6.0.18 \/usr\/lib64\/libstdc++.so.6<\/pre>\n

\u67e5\u770b\u662f\u5426\u94fe\u63a5\u4e0a<\/p>\n

ll \/usr\/lib64\/libstdc++.so.6\r\nlrwxrwxrwx 1 root root 19  9\u6708 29 12:48 \/usr\/lib64\/libstdc++.so.6 -> libstdc++.so.6.0.18<\/pre>\n
\n

\u539f\u6587\u6765\u81ea\uff1ahttp:\/\/blog.csdn.net\/hutianyou123\/article\/details\/78133309<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1ahttp:\/\/lrxjmw.cn\/linux-gcc-upgrade.html<\/a>\u7f16\u8f91\uff1a\u51af\u632f\u534e\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u64cd\u4f5c\u73af\u5883 Red-hat 6.2 64bit\uff0cyum\u5b89\u88c5\u81ea\u5e26\u7248\u672c4.4.7\uff0c\u4e0d\u80fd\u652f\u6301C++11\u7684\u7279\u6027\uff0c\u9700\u8981\u5347\u7ea7 […]<\/p>\n","protected":false},"author":63,"featured_media":84790,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-84788","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/84788","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=84788"}],"version-history":[{"count":6,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/84788\/revisions"}],"predecessor-version":[{"id":288750,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/84788\/revisions\/288750"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/84790"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=84788"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=84788"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=84788"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}