{"id":1604,"date":"2014-11-17T14:42:39","date_gmt":"2014-11-17T22:42:39","guid":{"rendered":"http:\/\/joelinoff.com\/blog\/?p=1604"},"modified":"2014-11-17T14:52:09","modified_gmt":"2014-11-17T22:52:09","slug":"bash-script-to-install-gcc-4-9-2-with-boost-1-57-on-centos-5-x-centos-6-x-and-mac-os-x","status":"publish","type":"post","link":"https:\/\/joelinoff.com\/blog\/?p=1604","title":{"rendered":"Bash script to install gcc-4.9.2 with boost 1.57 on CentOS 5.x, CentOS 6.x and Mac OS X"},"content":{"rendered":"<p>This week I created a script to install the <a href=\"http:\/\/projects.joelinoff.com\/gcc-4.9.2\/bld\/sh.txt\">gcc-4.9.3<\/a> compiler and linker with boost 1.5.7. A very simple Makefile is also available. Both files are based on scripts I have created for earlier versions of the compiler. This version also includes tcmalloc for linux platforms.<br \/>\n<!--more--><\/p>\n<div style=\"margin-left: 20px; margin-right: 20px; padding: 5px; background: #ffffdb;\">\nThis script is also available on github: <br \/>\n<a href=\"https:\/\/github.com\/jlinoff\/gcc-4.9.1-boost-1.56\">https:\/\/github.com\/jlinoff\/gcc-4.9.2-boost-1.57<\/a>\n<\/div>\n<div style=\"margin-top: 10px\">\nTo use it just download bld.sh and Makefile and type &#8220;make&#8221; as shown below:<\/p>\n<div>\n<pre class=\"theme:vs2012-black font-size:14 line-height:17 lang:default decode:true\">\r\n$ # Download the scripts using wget.\r\n$ mkdir \/opt\/gcc-4.9.2\r\n$ cd \/opt\/gcc-4.9.2\r\n$ wget http:\/\/projects.joelinoff.com\/gcc-4.9.2\/bld.sh\r\n$ wget http:\/\/projects.joelinoff.com\/gcc-4.9.2\/Makefile\r\n$ chmod a+x bld.sh\r\n$ make\r\n[output snipped]\r\n$ # The compiler is installed in \/opt\/gcc-4.9.2\/rtf\/bin\r\n<\/pre>\n<p>At this point the compiler is installed and you can use it as follows:<\/p>\n<pre class=\"theme:vs2012-black font-size:14 line-height:17 lang:default decode:true\">\r\n$ # Compile, link and run a small test program.\r\n$ # Note that LD_LIBRARY_PATH must be used unless the\r\n$ # compiler is installed in standard place.\r\n$ export PATH=\"\/opt\/gcc-4.9.2\/bin:${PATH}\"\r\n$ export LD_LIBRARY_PATH=\"\/opt\/gcc\/4.9.2\/lib64:\/opt\/gcc-4.9.2\/lib:${LD_LIBRARY_PATH}\"\r\n$ cat >test.cc <<EOF\r\n#include <iostream>\r\nusing namespace std;\r\nmain() {\r\n  cout << \"Hello, World!\" << endl;\r\n}\r\nEOF\r\n$ g++ -o test.exe -g -Wall test.cc\r\n$ .\/test.exe\r\nHello, World!\r\n<\/pre>\n<p>Enjoy!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This week I created a script to install the gcc-4.9.3 compiler and linker with boost 1.5.7. A very simple Makefile is also available. Both files are based on scripts I have created for earlier versions of the compiler. This version also includes tcmalloc for linux platforms.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[5,16],"tags":[],"_links":{"self":[{"href":"https:\/\/joelinoff.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1604"}],"collection":[{"href":"https:\/\/joelinoff.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/joelinoff.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/joelinoff.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/joelinoff.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1604"}],"version-history":[{"count":7,"href":"https:\/\/joelinoff.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1604\/revisions"}],"predecessor-version":[{"id":1611,"href":"https:\/\/joelinoff.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1604\/revisions\/1611"}],"wp:attachment":[{"href":"https:\/\/joelinoff.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1604"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/joelinoff.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1604"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/joelinoff.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1604"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}