Review
this page is keeping track of the procedure of installation of C++ compiler with c++17 compatibility.
The applications should be complied using compiler switch std=c++17 .
Installation of the boost headers and libraries will be tracked here
Additionally the procedure of installing ODBC development files will be described here.
The actions are tracked as JIRA HTOD-39
Configuring,Building and Installing the C/C++ Compiler
Download the sources from the GNU ftp server:
wget https://ftp.gnu.org/gnu/gcc/gcc-5.4.0/gcc-5.4.0.tar.bz2
or
curl https://ftp.gnu.org/gnu/gcc/gcc-5.4.0/gcc-5.4.0.tar.bz2 -O
Extract the tarbal:
tar xvfj gcc-5.4.0.tar.bz2
install development tools if not installed:
yum -y install gmp-devel mpfr-devel libmpc-devel
install c and c++ compilers
yum -y install gcc-c++
create a directory for building the sources:
mkdir gcc-5.4.0-build
cd gcc-5.4.0-build
configure and generate the makefile:
../gcc-5.4.0/configure --enable-languages=c,c++ --disable-multilib
install the compiler:
nohup make -j$(nproc) && make install &
Default install directory is /usr/local/
bin -for binaries
include for include files
lib and lib64 for libraries
verify the installed version:
c++ --version
c++ (GCC) 5.4.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Configuring, Building and Installing Boost headers and libraries
Get boost:
cd /usr/local
wget https://dl.bintray.com/boostorg/release/1.72.0/source/boost_1_72_0.tar.gz
or if it is unavailable(hosting of boost by the end of the month may exceed the quota and 403 Forbidden will pop up instead of download)
wget https://sourceforge.net/projects/boost/files/boost/1.73.0/boost_1_73_0.tar.bz2
Extract the tarbal:
tar xvfz boost_1_72_0.tar.gz
or
tar xjvf boost_1_73_0.tar.bz2
The headers only version is ready to use, verify this:
vi example.cpp
#include <boost/lambda/lambda.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>
int main()
{
using namespace boost::lambda;
typedef std::istream_iterator<int> in;
std::for_each(
in(std::cin),
in(),
std::cout << (_1 * 3) << " "
);
std::cout<<std::endl;
return 0;
}
Build the application, pass the include directory:
c++ -I/usr/local/boost_1_72_0 example.cpp -o example
Run the application which reads from stdin by piping the input:
echo 1 2 3 | ./example
3 6 9
Now build the libraries:
cd /usr/local/boost_1_72_0
nohup ./bootstrap.sh &
./b2 install
Now /usr/local/include has the boost includes and /usr/local/lib has the boost libraries
so the previous file can be compiled as follows:
c++ example.cpp -o example1
and tested:
echo 23 12 10 | ./example1
69 36 30
In case a local installation in the home directory is needed, then b2 should be called with a prefix:
./b2 install --prefix=${HOME}
then in ${HOME} include and lib directories will contain boost headers and libraries
Install ODBC driver manager and drivers
yum search unixODBC
this will install development files and driver manager:
yum install unixODBC-devel.x86_64
verify install
odbcinst -j
unixODBC 2.3.1
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /root/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8