{"id":64,"date":"2011-02-03T22:51:23","date_gmt":"2011-02-03T21:51:23","guid":{"rendered":"http:\/\/www.netquote.it\/nqmain\/?p=64"},"modified":"2011-02-19T17:56:58","modified_gmt":"2011-02-19T16:56:58","slug":"building-boost-and-rcf-on-mac-osx-sl","status":"publish","type":"post","link":"https:\/\/www.netquote.it\/nqmain\/2011\/02\/building-boost-and-rcf-on-mac-osx-sl\/","title":{"rendered":"Boost &#038; RCF on Mac OSX with Xcode"},"content":{"rendered":"<p>Litle HowTo prepare Boost and RCF on Mac!<br \/>\nMy work environment is Mac OS X Snow Leopard 10.6.6 and Xcode 3.2.5<br \/>\nBoost version is 1.45.0 and RCF version is 1.3<\/p>\n<p>What is Boost and RCF?<br \/>\nBoost is a powerful and portable C++ library.<br \/>\nRCF is a Remote Call Framework something like RPC.<\/p>\n<p>The two libraries written in C++ seems to be Cross Platform and Cross Compiler also 64 bit.<br \/>\nFrom RCF documentation only one thing must be done.<br \/>\nUse of the typedef&#8217;s in &#8220;boost\/cstdint.hpp&#8221; for portability.<\/p>\n<p>The first step is to download and compile boost.<br \/>\nThe official site is <a href=\"http:\/\/www.boost.org\/\">http:\/\/www.boost.org\/<\/a><\/p>\n<p>Extract downloaded file to your working directory, start terminal and navigate to the root of the extracted boost directory then execute &#8220;bootstrap.sh&#8221;<br \/>\nIt&#8217;s build a bjam command-line tool that drives the Boost Build system.<br \/>\n<code><br \/>\ncd ~\/Documents\/boost_1_45_0\/<br \/>\n.\/bootstrap.sh --with-libraries=all<br \/>\n<\/code><br \/>\nRun bjam and wait, wait a lot!<br \/>\n<code><br \/>\n.\/bjam --layout=tagged variant=debug -j 2 architecture=combined-x86-power stage<br \/>\n<\/code><\/p>\n<table>\n<tr>\n<th NOWRAP>&#8212;&#8212;&#8212;&#8212;(OPTIONS)&#8212;&#8212;&#8212;&#8212;<\/th>\n<\/tr>\n<tr>\n<td><code>--toolset=darwin<\/code><br \/>\nApple&#8217;s version of the GCC toolchain with support for Darwin and MacOS X features such as frameworks.<\/td>\n<\/tr>\n<tr>\n<td><code>--build-type=complete<\/code><br \/>\nBuild all supported variants of the libraries.<\/td>\n<\/tr>\n<tr>\n<td><code>--layout=tagged<\/code><br \/>\nNames of boost binaries include the encoded build properties such as variant and threading.<\/td>\n<\/tr>\n<tr>\n<td><code>--with-&lt;libraryname&gt;<\/code><br \/>\nBuild specified library.<\/td>\n<\/tr>\n<tr>\n<td><code>--show-libraries<\/code><br \/>\nDisplays the list of Boost libraries.<\/td>\n<\/tr>\n<tr>\n<td><code> --clean<\/code><br \/>\nRemove targets instead of building.<\/td>\n<\/tr>\n<tr>\n<td><code>-j N<\/code><br \/>\nRun up to N commands in parallel. Only for multiprocessor compilation.<\/td>\n<\/tr>\n<\/table>\n<table>\n<th NOWRAP>&#8212;&#8212;&#8212;&#8212;(PROPERTIES)&#8212;&#8212;&#8212;&#8212;<\/th>\n<tr>\n<td><code>address-model=32,64,32_64<\/code><br \/>\nExplicitly request either 32-bit or 64-bit code generation.<\/td>\n<\/tr>\n<tr>\n<td><code>runtime-link=shared,static<\/code><br \/>\nLinking to the C++ standard library and compiler runtime support libraries.<\/td>\n<\/tr>\n<tr>\n<td><code>link=shared,static<\/code><br \/>\nDetermines if bjam creates shared or static libraries.<\/td>\n<\/tr>\n<tr>\n<td><code>threading=single,multi<\/code><br \/>\nCause the produced binaries to be thread-safe.<\/td>\n<\/tr>\n<tr>\n<td><code>variant=debug,release,profile,debug-python<\/code><br \/>\nChoosing a specific build variant by adding release or debug.<\/td>\n<\/tr>\n<tr>\n<td><code>architecture=x86,ia64,power,combined,combined-x86-power<\/code><\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p>Now boost library is compiled and ready. Next step is RCF framework.<br \/>\nThe Official site is <a href=\"http:\/\/deltavsoft.com\/\">http:\/\/deltavsoft.com\/<\/a><br \/>\nDownload and extract RCF-1.3 to your working directory. <\/p>\n<p>Create a new command-line project with Xcode.<br \/>\nDon&#8217;t forget to select &#8220;C++ stdc++&#8221; in Type box!<br \/>\n<a href=\"http:\/\/www.netquote.it\/nqmain\/2011\/02\/building-boost-and-rcf-on-mac-osx-sl\/xcode-boost_new\/\" rel=\"attachment wp-att-179\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.netquote.it\/nqmain\/wp-content\/uploads\/Xcode-boost_new.png\" alt=\"\" title=\"Xcode-boost_new\" width=\"733\" height=\"573\" class=\"alignnone size-full wp-image-179\" srcset=\"https:\/\/www.netquote.it\/nqmain\/wp-content\/uploads\/Xcode-boost_new.png 733w, https:\/\/www.netquote.it\/nqmain\/wp-content\/uploads\/Xcode-boost_new-150x117.png 150w, https:\/\/www.netquote.it\/nqmain\/wp-content\/uploads\/Xcode-boost_new-300x234.png 300w\" sizes=\"auto, (max-width: 733px) 100vw, 733px\" \/><\/a><\/p>\n<p>Go to &#8220;Project&#8221; menu and select &#8220;Edit project Settings&#8221; then select &#8220;Build&#8221; tag. Search for &#8220;Header Search Paths&#8221; settings and append RCF and Boost include path in the list. Search for Preprocessor Macro and add &#8220;RCF_USE_BOOST_ASIO&#8221;. Set also &#8220;Library Search Path&#8221; to &#8220;boost_1_45_0\/stage\/lib&#8221;.<br \/>\n<a href=\"http:\/\/www.netquote.it\/nqmain\/2011\/02\/building-boost-and-rcf-on-mac-osx-sl\/xcode-boost-config\/\" rel=\"attachment wp-att-225\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.netquote.it\/nqmain\/wp-content\/uploads\/Xcode-boost-config.png\" alt=\"\" title=\"Xcode-boost-config\" width=\"641\" height=\"283\" class=\"alignnone size-full wp-image-225\" srcset=\"https:\/\/www.netquote.it\/nqmain\/wp-content\/uploads\/Xcode-boost-config.png 641w, https:\/\/www.netquote.it\/nqmain\/wp-content\/uploads\/Xcode-boost-config-150x66.png 150w, https:\/\/www.netquote.it\/nqmain\/wp-content\/uploads\/Xcode-boost-config-300x132.png 300w\" sizes=\"auto, (max-width: 641px) 100vw, 641px\" \/><\/a><\/p>\n<p>Finally in the main window go to &#8220;Source&#8221; select and right-click, select &#8220;Add&#8221;, then &#8220;Existing Files&#8221;, navigate to &#8220;RCF-1.3\/src\/RCF&#8221;, find and add &#8220;RCF.cpp&#8221; file. Also go to &#8220;Targets&#8221; -> &#8220;Link Binary With Libraries&#8221; and add &#8220;libboost_system.a&#8221; and others &#8220;.a&#8221; files from the &#8220;boost_1_45_0\/stage\/lib&#8221; directory.<br \/>\n<a href=\"http:\/\/www.netquote.it\/nqmain\/2011\/02\/building-boost-and-rcf-on-mac-osx-sl\/xcode-boost-final\/\" rel=\"attachment wp-att-232\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.netquote.it\/nqmain\/wp-content\/uploads\/Xcode-boost-final.png\" alt=\"\" title=\"Xcode-boost-final\" width=\"695\" height=\"424\" class=\"alignnone size-full wp-image-232\" srcset=\"https:\/\/www.netquote.it\/nqmain\/wp-content\/uploads\/Xcode-boost-final.png 695w, https:\/\/www.netquote.it\/nqmain\/wp-content\/uploads\/Xcode-boost-final-150x91.png 150w, https:\/\/www.netquote.it\/nqmain\/wp-content\/uploads\/Xcode-boost-final-300x183.png 300w\" sizes=\"auto, (max-width: 695px) 100vw, 695px\" \/><\/a><\/p>\n<p>Open main.cpp and insert test code.<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n#include &lt;iostream&gt;\r\n#include &lt;rcf \/Idl.hpp&gt;\r\n#include &lt;\/rcf&gt;&lt;rcf \/RcfServer.hpp&gt;\r\n#include &lt;\/rcf&gt;&lt;rcf \/TcpEndpoint.hpp&gt;\r\n\r\nRCF_BEGIN(I_Echo, &quot;I_Echo&quot;)\r\nRCF_METHOD_R1(std::string, echo, std::string)\r\nRCF_END(I_Echo)\r\n\r\nclass Echo\r\n{\r\npublic:\r\n    std::string echo(const std::string &amp;s)\r\n    {\r\n        return s;\r\n    }\r\n};\r\n\r\nint main (int argc, char * const argv&#x5B;])\r\n{\r\n\tEcho echo;\r\n\tRCF::RcfServer server( RCF::TcpEndpoint(&quot;127.0.0.1&quot;, 50001));\r\n\tserver.bind&lt;I_Echo&gt;(echo);\r\n\tserver.start();\r\n\tstd::cout &lt; &lt; &quot;Server running...&quot; &lt;&lt; std::endl;\r\n\r\n\tRcfClient&lt;I_Echo&gt; client( RCF::TcpEndpoint(&quot;127.0.0.1&quot;, 50001));\r\n\r\n\tstd::string dts;\r\n\tstd::cin &gt;&gt; dts;\r\n\r\n\tstd::string ecs = client.echo(dts);\r\n\r\n\tstd::cout &lt;&lt; &quot;Echo: &quot; &lt;&lt; ecs &lt;&lt; std::endl;\r\n\r\n    return 0;\r\n}\r\n<\/pre>\n<p>External links:<br \/>\nBoost.Build is a high-level build system <a href=\"http:\/\/www.highscore.de\/cpp\/boostbuild\/\">http:\/\/www.highscore.de\/cpp\/boostbuild\/<\/a><br \/>\nRCF User Guide <a href=\"http:\/\/deltavsoft.com\/w\/RcfUserGuide\/1.3\/index.html\">http:\/\/deltavsoft.com\/w\/RcfUserGuide\/1.3\/index.html<\/a><br \/>\nLinking Custom Static Libraries from your iPhone Xcode Projects <a href=\"http:\/\/wiki.remobjects.com\/wiki\/Linking_Custom_Static_Libraries_from_your_iPhone_Xcode_Projects\">http:\/\/wiki.remobjects.com\/wiki\/Linking_Custom_Static_Libraries_from_your_iPhone_Xcode_Projects<\/a><br \/>\nThe Boost C++ Libraries BoostBook Documentation Subset <a href=\"http:\/\/www.boost.org\/doc\/libs\/1_45_0\/doc\/html\/index.html\">http:\/\/www.boost.org\/doc\/libs\/1_45_0\/doc\/html\/index.html<\/a><br \/>\nCompiling Boost for the iPhone <a href=\"http:\/\/iphone.galloway.me.uk\/2009\/11\/compiling-boost-for-the-iphone\/\">http:\/\/iphone.galloway.me.uk\/2009\/11\/compiling-boost-for-the-iphone\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Litle HowTo prepare Boost and RCF on Mac! My work environment is Mac OS X Snow Leopard 10.6.6 and Xcode<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,7],"tags":[],"class_list":["post-64","post","type-post","status-publish","format-standard","hentry","category-c","category-mac-osx"],"_links":{"self":[{"href":"https:\/\/www.netquote.it\/nqmain\/wp-json\/wp\/v2\/posts\/64","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.netquote.it\/nqmain\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.netquote.it\/nqmain\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.netquote.it\/nqmain\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.netquote.it\/nqmain\/wp-json\/wp\/v2\/comments?post=64"}],"version-history":[{"count":177,"href":"https:\/\/www.netquote.it\/nqmain\/wp-json\/wp\/v2\/posts\/64\/revisions"}],"predecessor-version":[{"id":392,"href":"https:\/\/www.netquote.it\/nqmain\/wp-json\/wp\/v2\/posts\/64\/revisions\/392"}],"wp:attachment":[{"href":"https:\/\/www.netquote.it\/nqmain\/wp-json\/wp\/v2\/media?parent=64"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.netquote.it\/nqmain\/wp-json\/wp\/v2\/categories?post=64"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.netquote.it\/nqmain\/wp-json\/wp\/v2\/tags?post=64"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}