# Building asterisk 16 on alpine linux

**URL:** <https://community.asterisk.org/t/building-asterisk-16-on-alpine-linux/85282>\
**Category:** Asterisk Embedded\
**Created:** [August 13, 2020, 10:33pm UTC](https://community.asterisk.org/t/building-asterisk-16-on-alpine-linux/85282 "2020-08-13T22:33:54Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![flavio.magacho](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/flavio.magacho/32/4645_2.png) [@flavio.magacho](https://community.asterisk.org/u/flavio.magacho)\
**Post date:** [August 13, 2020, 10:33pm UTC](https://community.asterisk.org/t/building-asterisk-16-on-alpine-linux/85282/1 "2020-08-13T22:33:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![EkFudrek](https://avatars.discourse-cdn.com/v4/letter/e/ce73a5/32.png) [@EkFudrek](https://community.asterisk.org/u/EkFudrek)\
**Post date:** [August 14, 2020, 7:38am UTC](https://community.asterisk.org/t/building-asterisk-16-on-alpine-linux/85282/2 "2020-08-14T07:38:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![flavio.magacho](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/flavio.magacho/32/4645_2.png) [@flavio.magacho](https://community.asterisk.org/u/flavio.magacho)\
**Post date:** [August 14, 2020, 3:38pm UTC](https://community.asterisk.org/t/building-asterisk-16-on-alpine-linux/85282/3 "2020-08-14T15:38:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![EkFudrek](https://avatars.discourse-cdn.com/v4/letter/e/ce73a5/32.png) [@EkFudrek](https://community.asterisk.org/u/EkFudrek)\
**Post date:** [August 15, 2020, 3:00pm UTC](https://community.asterisk.org/t/building-asterisk-16-on-alpine-linux/85282/4 "2020-08-15T15:00:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Allan1](https://avatars.discourse-cdn.com/v4/letter/a/ebca7d/32.png) [@Allan1](https://community.asterisk.org/u/Allan1)\
**Post date:** [August 15, 2020, 6:23pm UTC](https://community.asterisk.org/t/building-asterisk-16-on-alpine-linux/85282/5 "2020-08-15T18:23:11Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![EkFudrek](https://avatars.discourse-cdn.com/v4/letter/e/ce73a5/32.png) [@EkFudrek](https://community.asterisk.org/u/EkFudrek)\
**Post date:** [August 16, 2020, 7:38am UTC](https://community.asterisk.org/t/building-asterisk-16-on-alpine-linux/85282/6 "2020-08-16T07:38:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![EkFudrek](https://avatars.discourse-cdn.com/v4/letter/e/ce73a5/32.png) [@EkFudrek](https://community.asterisk.org/u/EkFudrek)\
**Post date:** [August 16, 2020, 8:44am UTC](https://community.asterisk.org/t/building-asterisk-16-on-alpine-linux/85282/7 "2020-08-16T08:44:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![flavio.magacho](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/flavio.magacho/32/4645_2.png) [@flavio.magacho](https://community.asterisk.org/u/flavio.magacho)\
**Post date:** [August 18, 2020, 9:57pm UTC](https://community.asterisk.org/t/building-asterisk-16-on-alpine-linux/85282/8 "2020-08-18T21:57:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![EkFudrek](https://avatars.discourse-cdn.com/v4/letter/e/ce73a5/32.png) [@EkFudrek](https://community.asterisk.org/u/EkFudrek)\
**Post date:** [August 19, 2020, 7:26am UTC](https://community.asterisk.org/t/building-asterisk-16-on-alpine-linux/85282/9 "2020-08-19T07:26:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![flavio.magacho](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/flavio.magacho/32/4645_2.png) [@flavio.magacho](https://community.asterisk.org/u/flavio.magacho)\
**Post date:** [August 19, 2020, 2:11pm UTC](https://community.asterisk.org/t/building-asterisk-16-on-alpine-linux/85282/10 "2020-08-19T14:11:40Z")

</div>

Any way thanks a lot for your help!

> [@EkFudrek](#):
>
> 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.

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! 👍

---

<div class="post-metadata">

**Author:** ![EkFudrek](https://avatars.discourse-cdn.com/v4/letter/e/ce73a5/32.png) [@EkFudrek](https://community.asterisk.org/u/EkFudrek)\
**Post date:** [August 19, 2020, 4:35pm UTC](https://community.asterisk.org/t/building-asterisk-16-on-alpine-linux/85282/11 "2020-08-19T16:35:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/asterisk/original/2X/4/475d0c889911cfb84ac4881ad6df8b523e3f9105.png) [@system](https://community.asterisk.org/u/system)\
**Post date:** [September 18, 2020, 4:35pm UTC](https://community.asterisk.org/t/building-asterisk-16-on-alpine-linux/85282/12 "2020-09-18T16:35:41Z")

</div>

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