Asterisk Installation error

I am installing asterisk 18V.

[root@localhost asterisk-18.21.0]# make
[CC] chan_iax2.c → chan_iax2.o
chan_iax2.c:418:64: error: expected ‘;’, ‘,’ or ‘)’ before ‘buf’
static char *auth_method_names(int authmethods, char *restrict buf)
^
chan_iax2.c: In function ‘socket_process_helper’:
chan_iax2.c:11533:8: warning: implicit declaration of function ‘auth_method_names’ [-Wimplicit-function-declaration]
ast_verb(3, “Accepting AUTHENTICATED call from %s:\n”
^
chan_iax2.c:11533:8: warning: format ‘%s’ expects argument of type ‘char *’, but argument 8 has type ‘int’ [-Wformat=]
make[1]: *** [chan_iax2.o] Error 1
make: *** [channels] Error 2

On what distro? And what is the compiler version? (gcc -v)

Its Centos 7.

Compler version: gcc gcc-c++

Sorry GCC version is : 4.8.5-44

It looks like gcc versions <= 4.9.4 default to supporting -std=gnu90 but the restrict keyword was added in gnu99 which gcc didn’t default to until version 5.5. To get around this, you can add the -std=gnu99 flag to your ./configure command line and it should compile fine with gcc 4.8.

$ ./configure --with-jansson-bundled CFLAGS=-std=gnu99
2 Likes

Mr Gjosef,

Thank you very much. It solved the problem.

You helped me a lot.

Hello,
Same with asterisk-20.6.0
OS version in same Centos7.
This helps:
I can confirm, that this helps:

$ ./configure --with-jansson-bundled CFLAGS=-std=gnu99

There is an issue[1] where discussion is happening.

[1] [bug]: The "restrict" keyword used in chan_iax2.c isn't supported in older gcc versions · Issue #586 · asterisk/asterisk · GitHub