{"id":102,"date":"2005-05-30T17:02:00","date_gmt":"2005-05-30T17:02:00","guid":{"rendered":"http:\/\/bitpost.com\/news\/?p=14"},"modified":"2007-01-02T22:27:49","modified_gmt":"2007-01-03T03:27:49","slug":"shoulders-of-giants","status":"publish","type":"post","link":"https:\/\/bitpost.com\/news\/2005\/shoulders-of-giants\/","title":{"rendered":"boost and boost::serialization micro-HOWTO"},"content":{"rendered":"<p>(Editor&#8217;s note: see <a href=\"https:\/\/thedigitalmachine.com\/wiki\/index.php?title=Update_Boost&#038;redirect=no\">the wiki<\/a> for a more structured and updated version&#8230;)<\/p>\n<p>I wrote an object-oriented database a few years back using &#8220;C++ Database Development&#8221; from Al Stevens as inspiration, and I&#8217;ve always wanted to dig it out and get it updated. I&#8217;m also working on ShareTheDJ, which needs cross-platform object serialization. Robert Ramey implemented boost::serialization and it looks like an excellent way to serialize my objects in a more STL-friendly way. Here&#8217;s how to set up under FC3\/FC4, gentoo and Windoze&#8230;<\/p>\n<p><strong>UPDATE<\/strong>: Sourceforge root changed from [cvs-pserver.sf.net:443] to [boost.cvs.sourceforge.net].  Instructions were updated.<\/p>\n<p><!--more--><\/p>\n<p>The following instructs you on how to obtain and build the latest boost code from the CVS repository, and set up boost and the boost::serialize library for development under Windows, Fedora FC3\/FC4, and gentoo.<\/p>\n<hr \/>\n<p><u><strong>Gentoo\/Fedora FC4\/FC5 + gcc<\/strong><\/u><\/p>\n<li>cd #your_development_dir#<\/li>\n<li>mkdir boost_cvs<\/li>\n<li>cd boost_cvs<\/li>\n<li>mkdir bjam<\/li>\n<li>Get and unpack the bjam linux executable into the bjam dir.<\/li>\n<li>cd back to the boost_cvs dir.<\/li>\n<li>Get boost from CVS:<br \/>\ncvs -d:pserver:anonymous@boost.cvs.sourceforge.net\/cvsroot\/boost login<br \/>\ncvs -z3 -d:pserver:anonymous@boost.cvs.sourceforge.net\/cvsroot\/boost co -P boost<\/li>\n<li>The above step should have created a boost dir, cd into it (boost_cvs\/boost).<\/li>\n<li>..\/bjam\/boost-jam-#version#-linuxx86\/bjam &#8220;-sTOOLS=gcc&#8221;<\/li>\n<li>Go get lunch.<\/li>\n<li>su &#8211;<\/li>\n<li>cd boost_cvs\/boost<\/li>\n<li>..\/bjam\/boost-jam-#version#-linuxx86\/bjam &#8220;-sTOOLS=gcc&#8221; install<\/li>\n<li>I made the following changes to my automake project:<br \/>\nconfigure.in: CPPFLAGS=&#8221;${CPPFLAGS} -I\/usr\/local\/include\/boost-#version#&#8221;<br \/>\nMakefile.am: yourproject_LDADD = (&#8230;) \/usr\/local\/lib\/libboost_serialization-gcc.aNow you should be good to go!  Grab some sample code and have at it.<\/p>\n<hr \/>\n<p><u><strong>VC 7.1<\/strong><\/u><\/li>\n<li>To get to CVS under Windows with TortoiseCVS:<br \/>\nRight-click in the directory where you want boost, and select &#8220;Checkout&#8230;&#8221;<br \/>\nProtocol = :pserver:<br \/>\nServer = boost.cvs.sourceforge.net<br \/>\nPort = default<br \/>\nRepository folder = \/cvsroot\/boost<br \/>\nUser name = anonymous<br \/>\nModule = boost<\/li>\n<li>IF THAT FAILS, you may have a firewall in the way, try <a href=\"http:\/\/bitpost.com\/news\/2006\/09\/05\/getting-to-sourceforge-from-windows-through-a-proxy-redux\/\">this<\/a>  instead&#8230;<\/li>\n<li>Download the boost make util, bjam, for Windows<\/li>\n<li>Put bjam.exe in your path.<\/li>\n<li>cd #your_checkout_dir#\\\\boost<\/li>\n<li>vcvars32.bat (WARNING: use the right one, if VC6 is installed you usually get the wrong one&#8230;)<\/li>\n<li>bjam &#8220;-sTOOLS=vc-7_1&#8221; stage<br \/>\n&#8230;updated 1123 targets&#8230;<\/li>\n<li>add #yourcheckoutdir#\\\\boost to your VC++ include directories<\/li>\n<li>add #yourcheckoutdir#\\\\boost\\\\stage\\\\lib to your VC++ lib directories<\/li>\n<li>The boost developers have done a LOT of work in getting everything working well on my favorite compilers, gcc and VC++, so no complaints from me. At the same time, boost docs claim that boost libraries can be linked automatically for you under Windows, and they often will, but if you read the <strong>serialize<\/strong> fine print&#8230;\n<p><em> Automatic linking support will be introduced in a future release.<\/em><\/p>\n<p>So we need to manually include the serialize library in our VC++ project. With a little experimentation, here&#8217;s my guesses at what to use:<\/li>\n<p><strong>DYNAMICALLY LINKED C RUNTIME LIBRARY<\/strong><\/p>\n<ul>\n<li>Multi-threaded (MT): libboost_serialization-vc71-mt.lib<\/li>\n<li>MT debug: libboost_serialization-vc71-mt-gd.lib<\/li>\n<\/ul>\n<p><strong>STATICALLY LINKED C RUNTIME LIBRARY<\/strong><\/p>\n<ul>\n<li>MT: libboost_serialization-vc71-mt-s.lib<\/li>\n<li>MT debug: libboost_serialization-vc71-mt-sgd.lib<\/li>\n<li>ST: libboost_serialization-vc71-s.lib<\/li>\n<li>ST debug: libboost_serialization-vc71-sgd.lib\n<\/ul>\n<li>Just add the right library name to the project&#8217;s Properties->Linker->Input->Additional Dependencies for each configuration.<br \/>\nGrab the sample code from the serialize docs.  And off we go!<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>The following instructs you on how to obtain and build the latest boost code from the CVS repository, and set up boost and the boost::serialize library for development under Windows, Fedora FC3\/FC4, and gentoo.<\/p>\n<hr>\n<p>\n<U><B>Gentoo\/Fedora FC3\/FC4 + gcc<\/B><\/U><\/p>\n<li>su &#8211;\n<li>cd #your_development_dir#\n<li>mkdir boost_cvs\n<li>cd boost_cvs\n<li>To get boost from CVS(even with a firewall):<br \/>\n(UPDATE: If not, try <A HREF=\"__SLASHLINK__\" sect=\"articles\" sid=\"05\/09\/01\/1936232\" sn=\"article\" tid=\"11\">these instructions<\/A> instead&#8230;)<br \/>\ncvs -d:pserver:anonymous@cvs-pserver.sf.net:443\/cvsroot\/boost login<br \/>\ncvs -z3 -d:pserver:anonymous@cvs-pserver.sf.net:443\/cvsroot\/boost co -P boost<\/p>\n<li>Get and unpack the bjam linux executable.\n<li>cd boost\n<li>..\/bjam\/boost-jam-3.1.10-1-linuxx86\/bjam &#8220;-sTOOLS=gcc&#8221; install\n<li>Go get lunch.\n<li>I made the following changes to my automake project:<br \/>\nconfigure.in: CPPFLAGS=&#8221;${CPPFLAGS} -I\/usr\/local\/include\/boost-1_33&#8243;<br \/>\nMakefile.am: yourproject_LDADD = (&#8230;) \/usr\/local\/lib\/libboost_serialization-gcc.a<\/p>\n<p>Now you should be good to go!  Grab some sample code and have at it.<\/p>\n<hr>\n<p>\n<U><B>VC 7.1<\/B><\/U><\/p>\n<li>To get to CVS under Windows with TortoiseCVS:<br \/>\nRight-click in the directory where you want boost, and select &#8220;Checkout&#8230;&#8221;<br \/>\n(NOTE: These settings can typically get you through a firewall&#8230;)<br \/>\n(UPDATE: If not, try <A HREF=\"__SLASHLINK__\" sect=\"articles\" sid=\"05\/09\/01\/1936232\" sn=\"article\" tid=\"11\">these instructions<\/A> instead&#8230;)<br \/>\nProtocol = :pserver:<br \/>\nServer = cvs-pserver.sf.net<br \/>\nPort = 443<br \/>\nRepository folder = \/cvsroot\/boost<br \/>\nUser name = anonymous<br \/>\nModule = boost<\/p>\n<li>Download the boost make util, <SLASH HREF=\"http:\/\/sourceforge.net\/project\/showfiles.php?group_id=7586&amp;package_id=72941\" ID=\"1b769299059cd1088376e67f4bd75bbf\" TITLE=\"\" TYPE=\"link\">bjam<\/SLASH>, for Windows\n<li>Put bjam.exe in your path.\n<li>cd #your_checkout_dir#\boost\n<li>vcvars32.bat (WARNING: use the right one, if VC6 is installed you usually get the wrong one&#8230;)\n<li>bjam &#8220;-sTOOLS=vc-7_1&#8221; stage<br \/>\n&#8230;updated 1123 targets&#8230;<\/p>\n<li>add #yourcheckoutdir#\boost to your VC++ include directories\n<li>add #yourcheckoutdir#\booststagelib to your VC++ lib directories\n<p>The boost developers have done a LOT of work in getting everything working well on my favorite compilers, gcc and VC++, so no complaints from me.  At the same time, boost docs claim that boost libraries can be linked automatically for you under Windows, and they often will, but if you read the <b>serialize<\/b> fine print&#8230;<\/p>\n<p><i> Automatic linking support will be introduced in a future release.<\/i><\/p>\n<p>So we need to manually include the serialize library in our VC++ project.  With a little experimentation, here&#8217;s my guesses at what to use:<\/p>\n<p><b>DYNAMICALLY LINKED C RUNTIME LIBRARY<\/b><\/p>\n<li>Multi-threaded (MT): libboost_serialization-vc71-mt.lib\n<li>MT debug: libboost_serialization-vc71-mt-gd.lib\n<p><b>STATICALLY LINKED C RUNTIME LIBRARY<\/b><\/p>\n<li>MT: libboost_serialization-vc71-mt-s.lib\n<li>MT debug: libboost_serialization-vc71-mt-sgd.lib\n<li>ST: libboost_serialization-vc71-s.lib\n<li>ST debug: libboost_serialization-vc71-sgd.lib\n<p>Just add the right library name to the project&#8217;s Properties->Linker->Input->Additional Dependencies for each configuration.<br \/>\nGrab the sample code from the serialize docs.  And off we go!<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"enabled":false},"version":2}},"categories":[5,4,10,6],"tags":[],"class_list":["post-102","post","type-post","status-publish","format-standard","hentry","category-linux-projects","category-projects","category-tricks-tips-tools","category-windows-projects"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9M11L-1E","jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts\/102","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/comments?post=102"}],"version-history":[{"count":0,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts\/102\/revisions"}],"wp:attachment":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/media?parent=102"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/categories?post=102"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/tags?post=102"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}