6

Asterisk 13.1.0 is available in the repos for Xenial.

But I'm supporting an application that needs Asterisk 1.8 LTS, because we use a custom plugin. We need to keep using Asterisk 1.8 and building it from source until we can port our plugin forward to the newer version of Asterisk.

However, it seems like Asterisk 1.8 cannot be built with the version of g++ available on Xenial, which is 5.3.1. I get a ton of warnings, which can be silenced, but also a lot of fatal errors about duplicate-defined symbols, and possibly other fatal errors even if I could resolve these.

Example:

iax2-parser.o: In function `ast_atomic_fetchadd_int':
asterisk-1.8/include/asterisk/lock.h:600: multiple definition of `ast_atomic_fetchadd_int'
chan_iax2.o:asterisk-1.8/include/asterisk/lock.h:600: first defined here
iax2-parser.o: In function `ast_atomic_dec_and_test':
asterisk-1.8/include/asterisk/lock.h:646: multiple definition of `ast_atomic_dec_and_test'
chan_iax2.o:asterisk-1.8/include/asterisk/lock.h:646: first defined here
...etc...

I've been reading other posts from people struggling with this, and I've been trying to use compiler options to work around it with no success.

My question is whether there is any solution to do one of the following:

  • Build Asterisk 1.8 using g++ 5.3.1 and resolve the compile errors.
  • Install an old version of g++ on Xenial (for example I know g++ 4.4.7 works to compile Asterisk 1.8 on our old OS).
  • Some other solution to build a version of Asterisk that will run on Xenial. Perhaps build on Ubuntu 14.04 and tar up the binaries? I'd expect to get library version conflicts.

Some people will be glib and say, "you should really just upgrade to Asterisk 13.1.0." Yes, I know of course that would be a better plan. I know Asterisk 1.8 has passed its EOL. Getting a resource to port our plugin forward to Asterisk 13.1.0 is what is holding us back.

4 Answers4

5

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.

2

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.

2

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.

1

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