Building asterisk 16 on alpine linux

Hi, I’m trying to build asterisk in alpine linux 3.12.0 and I’m getting this error on the process:

[pjproject] Compiling lib libpj-x86_64-unknown-linux-gnu.a
make[2]: *** [Makefile:139: /usr/src/asterisk-certified-16.8-cert3/third-party/pjproject/source/pjlib/lib/libpj-x86_64-unknown-linux-gnu.a] Error 2
make[1]: *** [Makefile:20: pjproject] Error 2
make: *** [Makefile:383: third-party] Error 2

Did anyone have an Idea about what’s heapenning?

Thanks,
Flavio Magacho

There’s not enough information to see what is going on. I think there is away to get more verbose output from the build process.

I have setted the Noisy_build parameter to Yes . . .
make menuselect &&
menuselect/menuselect --disable-category MENUSELECT_CDR menuselect.makeopts &&
menuselect/menuselect --disable-category MENUSELECT_CEL menuselect.makeopts &&
make NOISY_BUILD=yes &&
make install && ldconfig

make[1]: Leaving directory ‘/usr/src/asterisk-certified-16.8-cert3/utils’
make[1]: Entering directory ‘/usr/src/asterisk-certified-16.8-cert3/agi’
make[1]: Nothing to be done for ‘all’.
make[1]: Leaving directory ‘/usr/src/asterisk-certified-16.8-cert3/agi’
make[1]: Entering directory ‘/usr/src/asterisk-certified-16.8-cert3/contrib’
make[1]: Nothing to be done for ‘all’.
make[1]: Leaving directory ‘/usr/src/asterisk-certified-16.8-cert3/contrib’
make[1]: Entering directory ‘/usr/src/asterisk-certified-16.8-cert3/third-party’
make -C pjproject all
make[2]: Entering directory ‘/usr/src/asterisk-certified-16.8-cert3/third-party/pjproject’
make -C /usr/src/asterisk-certified-16.8-cert3/third-party/pjproject/source/pjlib//build libpj-x86_64-unknown-linux-gnu.a
make[3]: Entering directory ‘/usr/src/asterisk-certified-16.8-cert3/third-party/pjproject/source/pjlib/build’
make -f /usr/src/asterisk-certified-16.8-cert3/third-party/pjproject/source/build/rules.mak APP=PJLIB app=pjlib …/lib/libpj-x86_64-unknown-linux-gnu.a
make[4]: Entering directory ‘/usr/src/asterisk-certified-16.8-cert3/third-party/pjproject/source/pjlib/build’
mkdir -p output/pjlib-x86_64-unknown-linux-gnu/
gcc -c -Wall -DPJ_AUTOCONF=1 -O2 -DPJ_IS_BIG_ENDIAN=0 -DPJ_IS_LITTLE_ENDIAN=1 -fPIC -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-label -Wno-unused-function -Wno-strict-aliasing -pthread -pipe -g3 -O3 -fno-partial-inlining -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -march=native -fPIC -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-label -Wno-unused-function -Wno-strict-aliasing -I…/include
-o output/pjlib-x86_64-unknown-linux-gnu/ioqueue_epoll.o
…/src/pj/ioqueue_epoll.c
gcc -c -Wall -DPJ_AUTOCONF=1 -O2 -DPJ_IS_BIG_ENDIAN=0 -DPJ_IS_LITTLE_ENDIAN=1 -fPIC -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-label -Wno-unused-function -Wno-strict-aliasing -pthread -pipe -g3 -O3 -fno-partial-inlining -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -march=native -fPIC -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-label -Wno-unused-function -Wno-strict-aliasing -I…/include
-o output/pjlib-x86_64-unknown-linux-gnu/file_access_unistd.o
…/src/pj/file_access_unistd.c
gcc -c -Wall -DPJ_AUTOCONF=1 -O2 -DPJ_IS_BIG_ENDIAN=0 -DPJ_IS_LITTLE_ENDIAN=1 -fPIC -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-label -Wno-unused-function -Wno-strict-aliasing -pthread -pipe -g3 -O3 -fno-partial-inlining -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -march=native -fPIC -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-label -Wno-unused-function -Wno-strict-aliasing -I…/include
-o output/pjlib-x86_64-unknown-linux-gnu/file_io_ansi.o
…/src/pj/file_io_ansi.c
gcc -c -Wall -DPJ_AUTOCONF=1 -O2 -DPJ_IS_BIG_ENDIAN=0 -DPJ_IS_LITTLE_ENDIAN=1 -fPIC -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-label -Wno-unused-function -Wno-strict-aliasing -pthread -pipe -g3 -O3 -fno-partial-inlining -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -march=native -fPIC -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-label -Wno-unused-function -Wno-strict-aliasing -I…/include
-o output/pjlib-x86_64-unknown-linux-gnu/os_core_unix.o
…/src/pj/os_core_unix.c
…/include/pj/asterisk_malloc_debug.h:64:33: error: expected declaration specifiers or ‘…’ before string constant
64 | __ast_repl_calloc(nmemb, size, FILE, LINE, PRETTY_FUNCTION)
| ^~~~~~~~
…/include/pj/asterisk_malloc_debug.h:64:43: error: expected declaration specifiers or ‘…’ before numeric constant
64 | __ast_repl_calloc(nmemb, size, FILE, LINE, PRETTY_FUNCTION)
| ^~~~~~~~
In file included from …/include/pj/config_site.h:12,
from …/include/pj/config.h:312,
from …/include/pj/types.h:33,
from …/include/pj/os.h:27,
from …/src/pj/os_core_unix.c:28:
…/include/pj/asterisk_malloc_debug.h:64:53: error: expected declaration specifiers or ‘…’ before ‘PRETTY_FUNCTION
64 | __ast_repl_calloc(nmemb, size, FILE, LINE, PRETTY_FUNCTION)
| ^~~~~~~~~~~~~~~~~~~
…/include/pj/asterisk_malloc_debug.h:67:18: error: expected declaration specifiers or ‘…’ before string constant
67 | __ast_free(ptr, FILE, LINE, PRETTY_FUNCTION)
| ^~~~~~~~
…/include/pj/asterisk_malloc_debug.h:67:28: error: expected declaration specifiers or ‘…’ before numeric constant
67 | __ast_free(ptr, FILE, LINE, PRETTY_FUNCTION)
| ^~~~~~~~
…/include/pj/asterisk_malloc_debug.h:67:38: error: expected declaration specifiers or ‘…’ before ‘PRETTY_FUNCTION
67 | __ast_free(ptr, FILE, LINE, PRETTY_FUNCTION)
| ^~~~~~~~~~~~~~~~~~~
make[4]: *** [/usr/src/asterisk-certified-16.8-cert3/third-party/pjproject/source/build/rules.mak:163: output/pjlib-x86_64-unknown-linux-gnu/os_core_unix.o] Error 1
make[4]: Leaving directory ‘/usr/src/asterisk-certified-16.8-cert3/third-party/pjproject/source/pjlib/build’
make[3]: *** [Makefile:106: libpj-x86_64-unknown-linux-gnu.a] Error 2
make[3]: Leaving directory ‘/usr/src/asterisk-certified-16.8-cert3/third-party/pjproject/source/pjlib/build’
make[2]: *** [Makefile:139: /usr/src/asterisk-certified-16.8-cert3/third-party/pjproject/source/pjlib/lib/libpj-x86_64-unknown-linux-gnu.a] Error 2
make[2]: Leaving directory ‘/usr/src/asterisk-certified-16.8-cert3/third-party/pjproject’
make[1]: *** [Makefile:20: pjproject] Error 2
make[1]: Leaving directory ‘/usr/src/asterisk-certified-16.8-cert3/third-party’
make: *** [Makefile:383: third-party] Error 2

I am running into the same problem and need to look at the details.

Good day

Just looked at Alpine Linux and it looks very secure with it’s own package manager apk.

Could the Position Independent Executables (PIE) way of compiling be causing the problem?

I guess the build environment is working correctly. My current guess is that due to the unknown distro some macros do not expand as intended. It is unlikely a serious problem as there are asterisk apk packages.

1 Like

I looked at one of the failing source files and preprocessed it with the same options. When I compile this preprocessed file, I run into the same kind of error, but I have some additional information. It looks as if for some reason

__PRETTY_FUNCTION__

does not get expanded in the undergrowth of the included files. In my case everything choked after processing /usr/include/sched.h.

I cannot say why that is so.

1 Like

do you have any Idea of how can I workoroud this compilation issue?

First of all, my analysis should be verified. It may well be that what I have found is just the result of another problem.

Otherwise I would switch to CentOS or Debian. I always have the source code compiled on all possible platforms just to see what the result is. Even if everything compiles properly, the result can still be a comparatively unstable system (based on weeks) because the interaction with the operating system also plays a role.

In this case, I believe the compilation problem is solvable, but it is also relatively uninteresting for someone to look at.

Any way thanks a lot for your help!

Ok, I’m trying to build an image on a AmazonLinux Image, that is based on CentOS I think, let me see what I got.
Thanks a lot again! :+1:

CentOS? Depending on which modules you want, you’ll need to enable a couple of repositories like PowerTools, EPEL, rpmfusion…

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.