How to build Asterisk 1.8 on Xenial?

Based on the lead from @steeldriver, I learned that Ubuntu 16.04 has a package in its standard repo for gcc-4.8 and g++-4.8. I installed g++ and a few other packages needed for building Asterisk 1.8:

apt-get install g++-4.8 libcurl4-openssl-dev libncurses5-dev libxml2-dev

This installs g++4.8 as a distinct binary from g++ version 5.3.1, which is also installed. I just need to configure the Asterisk build to use g++4.8, and build:

./configure CXX=g++4.8
make -j4
make install

And eureka! It worked! I built this outdated version of Asterisk 1.8 on Ubuntu 16.04.


As Bill Karwin answered, it's a gcc issue. But I've managed to build Asterisk 1.8 only after adding an extra flag to configure:

./configure CXX=g++-4.8 CC=gcc-4.8

Also note hyphens in the values.


On Ubuntu 18.04:

sudo apt install g++-4.8

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 1`  
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 1`  

For tcptls:

sudo apt install libssl1.0-dev`

./configure 
make menuselect
make

I found out this is caused by inline issue.

In include/asterisk/inline_api.h line #49:

define AST_INLINE_API(hdr, body) hdr; extern inline hdr body

change this to:

define AST_INLINE_API(hdr, body) hdr;

Then make will passed.