{"id":140226,"date":"2019-04-02T09:09:51","date_gmt":"2019-04-02T01:09:51","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=140226"},"modified":"2019-03-26T10:11:30","modified_gmt":"2019-03-26T02:11:30","slug":"linux-build-boost","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-build-boost.html","title":{"rendered":"Linux\uff1a\u7f16\u8bd1\u5b89\u88c5boost 1.69\u5e93"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nBoost\u5e93\u662f\u4e3aC++\u8bed\u8a00\u6807\u51c6\u5e93\u63d0\u4f9b\u6269\u5c55\u7684\u4e00\u4e9bC++\u7a0b\u5e8f\u5e93\u7684\u603b\u79f0\uff0c\u7531Boost\u793e\u533a\u7ec4\u7ec7\u5f00\u53d1\u3001\u7ef4\u62a4\u3002\u5728C++\u7684\u5730\u4f4d\u611f\u89c9\u53ef\u4ee5\u548cSpring\u5728Java\u4e2d\u76f8\u6bd4\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

boost\u5411\u6765\u6709\u51c6\u6807\u51c6\u5e93\u4e4b\u79f0\uff0c\u5f88\u591a\u65b0\u7279\u6027\u4f8b\u5982\u667a\u80fd\u6307\u9488\u7b49\u90fd\u662f\u5148\u5728boost\u4e2d\u5b9e\u73b0\uff0c\u540e\u6765\u88ab\u5438\u6536\u5230\u6807\u51c6\u5e93\u4e4b\u4e2d\u3002\u800c\u4e14boost\u5b9e\u73b0\u4e86\u65e5\u5fd7\u3001\u7b97\u6cd5\u3001\u65e5\u671f\u3001\u5730\u7406\u3001\u6570\u5b66\u3001\u7ebf\u7a0b\u534f\u7a0b\u7b49\u5404\u79cd\u5b9e\u7528\u5de5\u5177\uff0c\u6240\u4ee5\u5982\u679c\u8981\u5b66\u4e60C++\uff0cboost\u662f\u5fc5\u987b\u8981\u5b66\u4e60\u7684\u4e00\u4e2a\u4e1c\u897f\u3002
\n\u4e0b\u9762\u8bb0\u5f55\u5728Linux\u4e0b\u7f16\u8bd1\u5b89\u88c5boost1.69\u5e93\u7684\u8fc7\u7a0b\u6b65\u9aa4\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u6709\u7528\u3002<\/p>\n

\u6d4b\u8bd5\u5e73\u53f0<\/strong><\/div>\n

Linux\u7248\u672c\uff1aUbuntu 18.04 LTS<\/p>\n

Boost\u7248\u672c\uff1a1.69.0<\/p>\n

1\u3001\u5b89\u88c5\u4f9d\u8d56\u5e93\u6587\u4ef6<\/strong><\/div>\n
linuxidc@linuxidc:~\/www.linuxidc.com\/Linux\u516c\u793e -$ sudo apt-get install libbz2-dev\r\n\r\n[sudo] linuxidc \u7684\u5bc6\u7801\uff1a\r\n\r\n\u6b63\u5728\u8bfb\u53d6\u8f6f\u4ef6\u5305\u5217\u8868... \u5b8c\u6210\r\n\r\n\u6b63\u5728\u5206\u6790\u8f6f\u4ef6\u5305\u7684\u4f9d\u8d56\u5173\u7cfb\u6811\r\n\r\n\u6b63\u5728\u8bfb\u53d6\u72b6\u6001\u4fe1\u606f... \u5b8c\u6210\r\n\r\n\u5c06\u4f1a\u540c\u65f6\u5b89\u88c5\u4e0b\u5217\u8f6f\u4ef6\uff1a\r\n\r\nbzip2-doc\r\n\r\n\u4e0b\u5217\u3010\u65b0\u3011\u8f6f\u4ef6\u5305\u5c06\u88ab\u5b89\u88c5\uff1a\r\n\r\nbzip2-doc libbz2-dev\r\n\r\n\u5347\u7ea7\u4e86 0 \u4e2a\u8f6f\u4ef6\u5305\uff0c\u65b0\u5b89\u88c5\u4e86 2 \u4e2a\u8f6f\u4ef6\u5305\uff0c\u8981\u5378\u8f7d 0 \u4e2a\u8f6f\u4ef6\u5305\uff0c\u6709 218 \u4e2a\u8f6f\u4ef6\u5305\u672a\u88ab\u5347\u7ea7\u3002\r\n\r\n\u9700\u8981\u4e0b\u8f7d 324 kB \u7684\u5f52\u6863\u3002\r\n\r\n\u89e3\u538b\u7f29\u540e\u4f1a\u6d88\u8017 513 kB \u7684\u989d\u5916\u7a7a\u95f4\u3002\r\n\r\n\u60a8\u5e0c\u671b\u7ee7\u7eed\u6267\u884c\u5417\uff1f [Y\/n] Y<\/pre>\n

\"\"<\/p>\n

#\u5b89\u88c5mpi\u5e93<\/strong><\/span><\/div>\n
linuxidc@linuxidc:~\/www.linuxidc.com\/Linux\u516c\u793e -$ sudo apt-get install libicu-dev\r\n\r\n\u6b63\u5728\u8bfb\u53d6\u8f6f\u4ef6\u5305\u5217\u8868... \u5b8c\u6210\r\n\u6b63\u5728\u5206\u6790\u8f6f\u4ef6\u5305\u7684\u4f9d\u8d56\u5173\u7cfb\u6811      \r\n\u6b63\u5728\u8bfb\u53d6\u72b6\u6001\u4fe1\u606f... \u5b8c\u6210      \r\n\u5c06\u4f1a\u540c\u65f6\u5b89\u88c5\u4e0b\u5217\u8f6f\u4ef6\uff1a\r\n  gir1.2-harfbuzz-0.0 icu-devtools libglib2.0-dev libglib2.0-dev-bin\r\n  libgraphite2-dev libharfbuzz-dev libharfbuzz-gobject0 libicu-le-hb-dev\r\n  libicu-le-hb0 libiculx60 libpcre16-3 libpcre3-dev libpcre32-3 libpcrecpp0v5\r\n\u5efa\u8bae\u5b89\u88c5\uff1a\r\n  libglib2.0-doc libgraphite2-utils icu-doc\r\n\u4e0b\u5217\u3010\u65b0\u3011\u8f6f\u4ef6\u5305\u5c06\u88ab\u5b89\u88c5\uff1a\r\n  gir1.2-harfbuzz-0.0 icu-devtools libglib2.0-dev libglib2.0-dev-bin\r\n  libgraphite2-dev libharfbuzz-dev libharfbuzz-gobject0 libicu-dev\r\n  libicu-le-hb-dev libicu-le-hb0 libiculx60 libpcre16-3 libpcre3-dev\r\n  libpcre32-3 libpcrecpp0v5\r\n\u5347\u7ea7\u4e86 0 \u4e2a\u8f6f\u4ef6\u5305\uff0c\u65b0\u5b89\u88c5\u4e86 15 \u4e2a\u8f6f\u4ef6\u5305\uff0c\u8981\u5378\u8f7d 0 \u4e2a\u8f6f\u4ef6\u5305\uff0c\u6709 218 \u4e2a\u8f6f\u4ef6\u5305\u672a\u88ab\u5347\u7ea7\u3002\r\n\u9700\u8981\u4e0b\u8f7d 11.8 MB \u7684\u5f52\u6863\u3002\r\n\u89e3\u538b\u7f29\u540e\u4f1a\u6d88\u8017 57.4 MB \u7684\u989d\u5916\u7a7a\u95f4\u3002\r\n\u60a8\u5e0c\u671b\u7ee7\u7eed\u6267\u884c\u5417\uff1f [Y\/n] Y<\/pre>\n

\"\"<\/p>\n

#\u652f\u6301\u6b63\u5219\u8868\u8fbe\u5f0f\u7684UNICODE\u5b57\u7b26\u96c6\u3000<\/strong><\/span><\/div>\n
linuxidc@linuxidc:~\/www.linuxidc.com\/Linux\u516c\u793e -$ sudo apt-get install Python-dev<\/pre>\n
#\u9700\u8981python\u7684\u8bdd<\/strong><\/span><\/div>\n
linuxidc@linuxidc:~\/www.linuxidc.com\/Linux\u516c\u793e -$ sudo apt-get install libbz2-dev<\/pre>\n
2\u3001\u4e0b\u8f7d\u5b89\u88c5\u5305<\/strong><\/div>\n
https:\/\/sourceforge.net\/projects\/boost\/files\/boost\/1.69.0\/<\/pre>\n

\u6b64\u5904\u6211\u4e0b\u8f7d\u7684\u662f boost1.69\uff0c0
\n\u89e3\u538b\u7f29\u5230\u4e00\u4e2a\u76ee\u5f55<\/p>\n

3\u3001cd \u5230\u8be5\u76ee\u5f55 <\/strong><\/div>\n

\u91cc\u9762\u6709\u4e2abootstrap.sh\u7684\u811a\u672c\u6587\u4ef6\uff0c\u8fd0\u884c\u8fd9\u4e2a\u811a\u672c
\n\u8fd0\u884c\u811a\u672c\uff1a<\/p>\n

linuxidc@linuxidc:~\/www.linuxidc.com\/Linux\u516c\u793e -\/boost_1_69_0$ .\/bootstrap.sh\r\nBuilding Boost.Build engine with toolset gcc... tools\/build\/src\/engine\/bin.linuxx86_64\/b2\r\nDetecting Python version... 2.7\r\nDetecting Python root... \/usr\r\nUnicode\/ICU support for Boost.Regex?... \/usr\r\nGenerating Boost.Build configuration in project-config.jam...\r\n\r\nBootstrapping is done. To build, run:\r\n\r\n    .\/b2\r\n    \r\nTo adjust configuration, edit 'project-config.jam'.\r\nFurther information:\r\n\r\n  - Command line help:\r\n    .\/b2 --help\r\n    \r\n  - Getting started guide:<\/pre>\n

\"\"
\n\u6839\u636e\u4e0a\u56fe\u63d0\u793a\uff0c\u8fdb\u884c\u7f16\u8bd1\u64cd\u4f5c\u3002<\/p>\n

4\u3001\u5f00\u59cb\u7f16\u8bd1 boost<\/strong><\/div>\n
\u7f16\u8bd1\u8981\u4e00\u70b9\u65f6\u95f4\uff0c\u51fa\u53bb\u8df3\u8df3\u7ef3\u5427\uff0c\u6253\u6253\u62f3\u51fb\u5427\uff0c\u8f93\u5165\u547d\u4ee4:<\/strong><\/span><\/div>\n
linuxidc@linuxidc:~\/www.linuxidc.com\/Linux\u516c\u793e -\/boost_1_69_0$ .\/b2\r\nPerforming configuration checks\r\n\r\n    - default address-model    : 64-bit\r\n    - default architecture    : x86\r\n\r\nBuilding the Boost C++ Libraries.\r\n\r\n\r\n    - C++11 mutex              : yes\r\n    - lockfree boost::atomic_flag : yes\r\n    - Boost.Config Feature Check: cxx11_auto_declarations : yes\r\n    - Boost.Config Feature Check: cxx11_constexpr : yes\r\n    - Boost.Config Feature Check: cxx11_defaulted_functions : yes\r\n    - Boost.Config Feature Check: cxx11_final : yes\r\n    - Boost.Config Feature Check: cxx11_hdr_mutex : yes\r\n    - Boost.Config Feature Check: cxx11_hdr_tuple : yes\r\n    - Boost.Config Feature Check: cxx11_lambdas : yes<\/pre>\n

\"\"
\n\u7f16\u8bd1\u6210\u529f\u540e\u7684\u622a\u56fe\u5982\u4e0b\uff1a
\n\"\"<\/p>\n

5\u3001\u5f00\u59cb\u5b89\u88c5<\/strong><\/div>\n
\u5c06boost\u5e93\u76f8\u5173\u6587\u4ef6\u5b89\u88c5\u81f3\/usr\/local\u3002\u8f93\u5165\u547d\u4ee4\uff1a<\/strong><\/span><\/div>\n
sudo .\/b2 --prefix=\/usr\/local\/boost install<\/pre>\n

\"\"
\n\u5b89\u88c5\u597d\u4e4b\u540e\u622a\u56fe\uff1a
\n\"\"<\/p>\n

\u5c06boost\u5e93\u6dfb\u52a0\u81f3\u73af\u5883\u53d8\u91cf\u3002\u8f93\u5165\u547d\u4ee4\uff1a<\/strong><\/span><\/div>\n
gedit \/etc\/environment<\/pre>\n
\u5411\u6587\u4ef6\u4e2d\u589e\u52a0\u5982\u4e0b\u8def\u5f84\uff1a<\/strong><\/span><\/div>\n
CPLUS_INCLUDE_PATH=\/usr\/local\/boost\/include\r\nLIBRARY_PATH=\/usr\/local\/boost\/lib<\/pre>\n

\u6dfb\u52a0\u5b8c\u6210\u540e\uff0c\u8fdb\u884c\u4fdd\u5b58\u64cd\u4f5c\u3002<\/p>\n

6\u3001\u6d4b\u8bd5\u6848\u4f8b<\/strong><\/div>\n

\uff081\uff09\u4ee3\u7801\u7f16\u5199\u3002\u8f93\u5165\u547d\u4ee4\uff1a<\/p>\n

linuxidc@linuxidc:~\/www.linuxidc.com\/Linux\u516c\u793e -\/boost_1_69_0$ gedit linuxidc.com.Boost.cpp<\/pre>\n

\u6253\u5f00\u7f16\u8f91\u5668\uff0c\u8f93\u5165\u4ee5\u4e0b\u4ee3\u7801\u5e76\u4fdd\u5b58\uff1a<\/p>\n

\r\n#include <boost\/date_time\/gregorian\/gregorian.hpp>\r\n#include <iostream> \r\nusing namespace std;\r\nint main() \r\n{ \r\n    boost::gregorian::date d(boost::gregorian::day_clock::local_day());\r\n    cout << d.year()<<\".\" << d.month()<<\".\" <<d.day() <<endl; \r\n    getchar();\r\n    return 0;\r\n}\r\n<\/pre>\n

\uff082\uff09\u4ee3\u7801 \u7f16\u8bd1\u3002\u8f93\u5165\u547d\u4ee4\uff1a<\/p>\n

linuxidc@linuxidc:~\/www.linuxidc.com\/Linux\u516c\u793e -\/boost_1_69_0$ g++ -I \/usr\/local\/boost\/include -L \/usr\/local\/boost\/lib linuxidc.com.Boost.cpp -o linuxidc.com<\/pre>\n

\uff083\uff09\u6267\u884c\u7a0b\u5e8f\u3002\u8f93\u5165\u547d\u4ee4:<\/p>\n

linuxidc@linuxidc:~\/www.linuxidc.com\/Linux\u516c\u793e -\/boost_1_69_0$ .\/linuxidc.com\r\n2019.Mar.20<\/pre>\n

\u622a\u56fe\u5982\u4e0b
\n\"\"
\nOK\uff0c\u641e\u5b9a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

boost\u5411\u6765\u6709\u51c6\u6807\u51c6\u5e93\u4e4b\u79f0\uff0c\u5f88\u591a\u65b0\u7279\u6027\u4f8b\u5982\u667a\u80fd\u6307\u9488\u7b49\u90fd\u662f\u5148\u5728boost\u4e2d\u5b9e\u73b0\uff0c\u540e\u6765\u88ab\u5438\u6536\u5230\u6807\u51c6\u5e93\u4e4b\u4e2d\u3002\u800c\u4e14b […]<\/p>\n","protected":false},"author":1893,"featured_media":140228,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-140226","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\/140226","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\/1893"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=140226"}],"version-history":[{"count":10,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/140226\/revisions"}],"predecessor-version":[{"id":140804,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/140226\/revisions\/140804"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/140228"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=140226"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=140226"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=140226"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}