{"id":1514,"date":"2014-06-27T11:55:05","date_gmt":"2014-06-27T18:55:05","guid":{"rendered":"http:\/\/joelinoff.com\/blog\/?p=1514"},"modified":"2014-07-02T16:38:44","modified_gmt":"2014-07-02T23:38:44","slug":"bash-script-to-install-gcc-4-8-3-and-boost-1-55-0-on-centos-6-x-centos-5-x-and-mac-os-x-10-9","status":"publish","type":"post","link":"https:\/\/joelinoff.com\/blog\/?p=1514","title":{"rendered":"Bash script to install gcc 4.8.3 and boost 1.55.0 on CentOS 6.x, CentOS 5.x and Mac OS X 10.9"},"content":{"rendered":"<p>The bld.sh script provided installs gcc 4.8.3 and boost 1.55.0 on CentOS 6.x, CentOS 5.x and Mac OS X for testing. It is another entry in my continuing series of releases for different versions of g++. Hopefully this will make it easier for folks that want to experiment with this version of the GNU C++ compiler. <\/p>\n<div style=\"margin-left: 20px; margin-right: 20px; padding: 5px; background: #ffffdb;\">\nThis script is also available on github: <a href=\"https:\/\/github.com\/jlinoff\/gcc-4.8.3-boost-1.55\">https:\/\/github.com\/jlinoff\/gcc-4.8.3-boost-1.55<\/a>.\n<\/div>\n<p><!--more--><\/p>\n<p>There is also a <i>very<\/i> simple Makefile: <a title=\"http:\/\/projects.joelinoff.com\/gcc-4.8.3\/Makefile\" href=\"http:\/\/projects.joelinoff.com\/gcc-4.8.3\/Makefile\">http:\/\/projects.joelinoff.com\/gcc-4.8.3\/Makefile<\/a> that is not required but that I found useful.<\/p>\n<p>This text version is also available so that you can cut-n-paste from a web page: <a title=\"http:\/\/projects.joelinoff.com\/gcc-4.8.3\/bld.sh.txt\" href=\"http:\/\/projects.joelinoff.com\/gcc-4.8.3\/bld.sh.txt\">http:\/\/projects.joelinoff.com\/gcc-4.8.3\/bld.sh.txt<\/a>. <\/p>\n<p>Please note that this is not a product. It is simply my best attempt to get it working in my development environments. For example, it does not check for packages because I try to build it on different systems that have different package managers (yum, apt, port, etc.). What this means is that if it doesn&#8217;t work for you, you will have to do some debugging. If you find a problem, please post a fix in the comment section here so that others can benefit from it.<\/p>\n<h2>1 Download and Install It<\/h2>\n<p>Here are the steps to download and install it. Root access is not required unless you need to install support packages.<\/p>\n<p>[crayon lang=&#8221;bash&#8221; toolbar=&#8221;always&#8221; title=&#8221;Download and Install&#8221;]<br \/>\n$ # Download and install it.<br \/>\n$ mkdir \/shared\/tools\/gcc\/4.8.3<br \/>\n$ cd \/shared\/tools\/gcc\/4.8.3<br \/>\n$ wget http:\/\/projects.joelinoff.com\/gcc-4.8.3\/bld.sh<br \/>\n$ chmod a+x bld.sh<\/p>\n<p>$ # Optionally there is also a very simple Makefile.<br \/>\n$ wget http:\/\/projects.joelinoff.com\/gcc-4.8.3\/Makefile<\/p>\n<p>$ # bld.sh doesn&#8217;t check for packages<br \/>\n$ # This is one that I needed.<br \/>\n$ # if not installed you will see a missing gnu\/stabs-32.h error late in the process.<br \/>\n$ sudo yum install -y glibc-devel.i686<br \/>\n<output snipped><\/p>\n<p>$ # I also had to install texinfo, you may have to install others.<br \/>\n$ sudo yum install -y texinfo<br \/>\n<output snipped><\/p>\n<p>$ # You can run bld.sh directly or you can simply type &#8220;make&#8221; if you downloaded<br \/>\n$ # the Makefile.<br \/>\n$ .\/bld.sh 2>&#038;1| tee bld.log<br \/>\n[\/crayon]<\/p>\n<p>The build process can take a long time depending on the speed of your CPU(s) and disks. On my test system it took more than 5 hours. <\/p>\n<p>If the process fails it is most likely because packages are missing on the system. <\/p>\n<p>If a problem does occur, install the package, then delete the src and bld directories and try again. If you have installed the option Makefile you can type &#8220;make clean&#8221; and then &#8220;make&#8221;.<\/p>\n<p>The rtf (release to field) directory contains the releases for each package.<\/p>\n<h2>2 How to Use the Compiler<\/h2>\n<p>This section shows how to compile, link and execute a simple program using the newly installed compiler by setting up your environment properly.<\/p>\n<p>[crayon lang=&#8221;c++&#8221; toolbar=&#8221;always&#8221; title=&#8221;test.cc&#8221;]<br \/>\n\/\/ Simple test program<br \/>\n#include <iostream><br \/>\n#include <boost\/algorithm\/string.hpp><br \/>\nusing namespace std;<br \/>\nusing namespace boost;<br \/>\nint main()<br \/>\n{<br \/>\n  string s1(&#8221; hello world! &#8220;);<br \/>\n  cout << \"value      : '\" << s1 << \"'\" <<endl;\n\n  to_upper(s1);\n  cout << \"to_upper() : '\" << s1 << \"'\" <<endl;\n\n  trim(s1);\n  cout << \"trim()     : '\" << s1 << \"'\" <<endl;\n\n  return 0;\n}\n[\/crayon]\n\nYou compile, link and run it as follows:\n\n[crayon lang=\"bash\" toolbar=\"always\" title=\"Compile, Link and Run\"]\n#!\/bin\/bash\n# This script sets the environment to use the newly installed compiler.\n# It compiles, links and runs a small test program.\n\n# Setup the environment.\nMY_GXX_HOME=\"\/shared\/tools\/gcc\/4.8.3\/rtf\"\nexport PATH=\"${MY_GXX_HOME}\/bin:${PATH}\"\nexport LD_LIBRARY_PATH=\"${MY_GXX_HOME}\/lib:${MY_GXX_HOME}\/lib64:${LD_LIBRARY_PATH}\"\nexport LD_RUN_PATH=\"${MY_GXX_HOME}\/lib:${MY_GXX_HOME}\/lib64:${LD_LIBRARY_PATH}\"\n\n# Compile and link.\ng++ -O3 -std=c++11 -Wall -o test.exe test.cc\n\n# Run.\n.\/test.exe\n# Expected output\n# value      : ' hello world! '\n# to_upper() : ' HELLO WORLD! '\n# trim()     : 'HELLO WORLD!'\n[\/crayon]\n\n\n\n<h2>3 Disk Space Requirements<\/h2>\n<p>You will need about 5.5GB to download and build all of the packages. Once the build is finished you can reclaim most of the space because the released files only require about 600 MB. Here is the breakdown:<\/p>\n<p>[crayon lang=&#8221;bash&#8221; toolbar=&#8221;always&#8221; title=&#8221;Disk Space Used&#8221;]<br \/>\n$ # This was on my Mac<br \/>\n$ cd \/shared\/tools<br \/>\n$ du -s -h gcc\/4.8.3<br \/>\n5.5G    gcc\/4.8.3<\/p>\n<p>$ du -s -h gcc\/4.8.3\/*<br \/>\n187M    gcc\/4.8.3\/archives<br \/>\n2.1G    gcc\/4.8.3\/bld<br \/>\n28K     gcc\/4.8.3\/bld.sh<br \/>\n18M     gcc\/4.8.3\/logs<br \/>\n4.0K    gcc\/4.8.3\/Makefile<br \/>\n595M    gcc\/4.8.3\/rtf<br \/>\n2.6G    gcc\/4.8.3\/src<br \/>\n[\/crayon]<\/p>\n<p>Note that the logs directory exists because I used the &#8220;make&#8221; command instead of running blds.sh directly.<\/p>\n<p>Once it is built you can remove everything except the contents of the rtf directory tree to save disk space.<\/p>\n<h2>4 Packages<\/h2>\n<p>This is the list of packages that are installed in the release area.<\/p>\n<div style=\"width:600px;\">\n<table>\n<thead>\n<tr>\n<th>Package<\/th>\n<th>Version<\/th>\n<th>Web&nbsp;Site<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>binutils<\/td>\n<td>\n<div style=\"text-align:right;\">2.24<\/div>\n<\/td>\n<td><a href=\"http:\/\/ftp.gnu.org\/gnu\/binutils\">http:\/\/ftp.gnu.org\/gnu\/binutils<\/a><\/td>\n<\/tr>\n<tr>\n<td>boost<\/td>\n<td>\n<div style=\"text-align:right;\">1.55.0<\/div>\n<\/td>\n<td><a href=\"http:\/\/sourceforge.net\/projects\/boost\/files\/boost\">http:\/\/sourceforge.net\/projects\/boost\/files\/boost<\/a><\/td>\n<\/tr>\n<tr>\n<td>cloog<\/td>\n<td>\n<div style=\"text-align:right;\">0.18.0<\/div>\n<\/td>\n<td><a href=\"http:\/\/www.bastoul.net\/cloog\">http:\/\/www.bastoul.net\/cloog&#8221;>http:\/\/www.bastoul.net\/cloog<\/a><\/td>\n<\/tr>\n<tr>\n<td>gcc<\/td>\n<td>\n<div style=\"text-align:right;\">4.8.3<\/div>\n<\/td>\n<td><a href=\"http:\/\/ftp.gnu.org\/gnu\/gcc\">http:\/\/ftp.gnu.org\/gnu\/gcc<\/a><\/td>\n<\/tr>\n<tr>\n<td>gmp<\/td>\n<td>\n<div style=\"text-align:right;\">5.1.3<\/div>\n<\/td>\n<td><a href=\"http:\/\/gmplib.org\/\">http:\/\/gmplib.org\/<\/a><\/td>\n<\/tr>\n<tr>\n<td>libiconv<\/td>\n<td>\n<div style=\"text-align:right;\">1.14<\/div>\n<\/td>\n<td><a href=\"http:\/\/ftp.gnu.org\/pub\/gnu\/libiconv\">http:\/\/ftp.gnu.org\/pub\/gnu\/libiconv<\/a><\/td>\n<\/tr>\n<tr>\n<td>mpc<\/td>\n<td>\n<div style=\"text-align:right;\">1.0.2<\/div>\n<\/td>\n<td><a href=\"http:\/\/www.multiprecision.org\/mpc\">http:\/\/www.multiprecision.org\/mpc<\/a><\/td>\n<\/tr>\n<tr>\n<td>mpfr<\/td>\n<td>\n<div style=\"text-align:right;\">3.1.2<\/div>\n<\/td>\n<td><a href=\"http:\/\/www.mpfr.org\">http:\/\/www.mpfr.org<\/a><\/td>\n<\/tr>\n<tr>\n<td>ppl<\/td>\n<td>\n<div style=\"text-align:right;\">1.1<\/div>\n<\/td>\n<td><a href=\"http:\/\/bugseng.com\/products\/ppl\">http:\/\/bugseng.com\/products\/ppl<\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h2>5 Tested Platforms<\/h2>\n<p>These are the platforms that I actually tested the installation on.<\/p>\n<div style=\"width:700px;\">\n<table>\n<thead>\n<tr>\n<th>Distro<\/th>\n<th>Version<\/th>\n<th>Arch<\/th>\n<th>Status<\/th>\n<th>Date<\/th>\n<th>Notes<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>CentOS<\/td>\n<td>\n<div style=\"text-align:right;\">5.5<\/div>\n<\/td>\n<td>x86_64<\/td>\n<td>Passed<\/td>\n<td>2014-06-26<\/td>\n<td>&nbsp;<\/td>\n<\/tr>\n<tr>\n<td>CentOS<\/td>\n<td>\n<div style=\"text-align:right;\">6.3<\/div>\n<\/td>\n<td>x86_64<\/td>\n<td>Passed<\/td>\n<td>2014-06-27<\/td>\n<td>Had to manually install the glibc_devel.i686 and texinfo packages.<\/td>\n<\/tr>\n<tr>\n<td>CentOS<\/td>\n<td>\n<div style=\"text-align:right;\">6.5<\/div>\n<\/td>\n<td>x86_64<\/td>\n<td>Passed<\/td>\n<td>2014-06-26<\/td>\n<td>Had to manually install the glibc_devel.i686 and texinfo packages.<\/td>\n<\/tr>\n<tr>\n<td>MAC OS X<\/td>\n<td>\n<div style=\"text-align:right;\">10.9.3<\/div>\n<\/td>\n<td>x86_64<\/td>\n<td>Passed<\/td>\n<td>2014-06-26<\/td>\n<td>Used <a href=\"https:\/\/www.macports.org\/\">macports<\/a> for setting up the environment.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>Unfortunately, I do not have the bandwidth to try to get this to work on other distros (even though I have several Ubuntu boxes at hand) but it should be fairly straightforward to port because it does not rely on distro specific package management. <\/p>\n<p>If you port it to another distro, please send me the changes to that I can incorporate them.<\/p>\n<p>Enjoy!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The bld.sh script provided installs gcc 4.8.3 and boost 1.55.0 on CentOS 6.x, CentOS 5.x and Mac OS X for testing. It is another entry in my continuing series of releases for different versions of g++. Hopefully this will make it easier for folks that want to experiment with this version of the GNU C++ &hellip; <a href=\"https:\/\/joelinoff.com\/blog\/?p=1514\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Bash script to install gcc 4.8.3 and boost 1.55.0 on CentOS 6.x, CentOS 5.x and Mac OS X 10.9<\/span><\/a><\/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\/1514"}],"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=1514"}],"version-history":[{"count":8,"href":"https:\/\/joelinoff.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1514\/revisions"}],"predecessor-version":[{"id":1527,"href":"https:\/\/joelinoff.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1514\/revisions\/1527"}],"wp:attachment":[{"href":"https:\/\/joelinoff.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1514"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/joelinoff.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1514"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/joelinoff.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1514"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}