# Asterisk Compile on Alpine

**URL:** <https://community.asterisk.org/t/asterisk-compile-on-alpine/88429>\
**Category:** Asterisk Support\
**Created:** [April 29, 2021, 9:11pm UTC](https://community.asterisk.org/t/asterisk-compile-on-alpine/88429 "2021-04-29T21:11:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![psdk](https://avatars.discourse-cdn.com/v4/letter/p/d2c977/32.png) [@psdk](https://community.asterisk.org/u/psdk)\
**Post date:** [April 29, 2021, 9:11pm UTC](https://community.asterisk.org/t/asterisk-compile-on-alpine/88429/1 "2021-04-29T21:11:26Z")

</div>

When I attempt to compile Asterisk 18.3.0 on latest Alpine, I get this error:

[pjproject] Compiling lib libpj-x86\_64-unknown-linux-gnu.a  
make[2]: \*\*\* [Makefile:149: /root/asterisk-18.3.0/third-party/pjproject/source/pjlib/lib/libpj-x86\_64-unknown-linux-gnu.a] Error 2  
make[1]: \*\*\* [Makefile:20: pjproject] Error 2  
make: \*\*\* [Makefile:388: third-party] Error 2

I found some same threads in the forum but didn’t have any solution. Any idea?

---

<div class="post-metadata">

**Author:** ![cable](https://avatars.discourse-cdn.com/v4/letter/c/d26b3c/32.png) [@cable](https://community.asterisk.org/u/cable)\
**Post date:** [April 30, 2021, 8:01am UTC](https://community.asterisk.org/t/asterisk-compile-on-alpine/88429/2 "2021-04-30T08:01:17Z")

</div>

Maybe try the latest pjproject on github. The one included with Asterisk 18 is over 1 year old. PJproject have made some improvements and it works great with Asterisk 17, 18, and Git-master. Use ‘./configure --without-pjproject-bundled …’

---

<div class="post-metadata">

**Author:** ![psdk](https://avatars.discourse-cdn.com/v4/letter/p/d2c977/32.png) [@psdk](https://community.asterisk.org/u/psdk)\
**Post date:** [April 30, 2021, 8:12pm UTC](https://community.asterisk.org/t/asterisk-compile-on-alpine/88429/3 "2021-04-30T20:12:11Z")

</div>

@cable thanks. I tried to use last pjsip version and that issue has been solved.

But now I get this error:

In file included from /asterisk-18.3.0/include/asterisk.h:23,  
from chan\_audiosocket.c:33:  
/asterisk-18.3.0/include/asterisk/astmm.h:158:35: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘ **attribute** ’ before ‘-\>’ token  
158 | Do\_not\_use\_calloc\_\_use\_ast\_calloc-\>fail(a, b)

---

<div class="post-metadata">

**Author:** ![cable](https://avatars.discourse-cdn.com/v4/letter/c/d26b3c/32.png) [@cable](https://community.asterisk.org/u/cable)\
**Post date:** [April 30, 2021, 9:55pm UTC](https://community.asterisk.org/t/asterisk-compile-on-alpine/88429/4 "2021-04-30T21:55:33Z")

</div>

If you’re using the non-bundled PJproject try this:  
`
sudo su
cd /usr/src/pjproject (or wherever it is located)
make clean
make distclean
./configure --prefix=/usr --enable-shared --enable-ext-sound --disable-opencore-amr --disable-pjsua2 CFLAGS="-O2 -DNDEBUG"
make -s dep
make -s 2>/dev/null
make install
ldconfig
`  
Then retry ‘make install’ in the /usr/src/asterisk-18.3.0 directory

---

<div class="post-metadata">

**Author:** ![psdk](https://avatars.discourse-cdn.com/v4/letter/p/d2c977/32.png) [@psdk](https://community.asterisk.org/u/psdk)\
**Post date:** [April 30, 2021, 10:53pm UTC](https://community.asterisk.org/t/asterisk-compile-on-alpine/88429/5 "2021-04-30T22:53:43Z")

</div>

Thanks but it seems the issue is related to “asterisk.h” with musl c lib in Alpine.  
I added the “sched.h” in the asterisk.h and the issue changed to this:

ast\_expr2.y:277:21: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘ **attribute** ’ before ‘\_\_P’  
277 | static int chk\_div \_\_P((FP\_\_\_TYPE, FP\_\_\_TYPE));

So, no one has compiled Asterisk on Alpine before??

---

<div class="post-metadata">

**Author:** ![psdk](https://avatars.discourse-cdn.com/v4/letter/p/d2c977/32.png) [@psdk](https://community.asterisk.org/u/psdk)\
**Post date:** [May 3, 2021, 5:54pm UTC](https://community.asterisk.org/t/asterisk-compile-on-alpine/88429/6 "2021-05-03T17:54:38Z")

</div>

Hope this helps others after me:

[https://git.alpinelinux.org/aports/tree/main/asterisk](https://git.alpinelinux.org/aports/tree/main/asterisk)

---

<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:** [June 2, 2021, 5:54pm UTC](https://community.asterisk.org/t/asterisk-compile-on-alpine/88429/7 "2021-06-02T17:54:56Z")

</div>

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