How to install Asterisk on Mavericks?

I am trying to install Asterisk on my Macbook Pro (Intel Core i5) using Mavericks. Ideally, I want to install version 1.8, because what works on the server, but 11.7 is also good.

After googling around, I tried many permutations of configure checkboxes, but this strategy didn't get me anywhere.

I have Xcode 5.0.2. and command line tools, as well as gcc-4.8 via Homebrew:

brew tap homebrew/versions
brew install homebrew/versions/gcc48

Based on what I saw in this homebrew formula , I tried replacing OPTIMIZE=-O6with OPTIMIZE=-Os. This seems to have the same effect CFLAGS=-mtune=genericas, namely, preventing this error:

Generating embedded module rules ...
  [CC] chan_agent.c -> chan_agent.o
   error: invalid value '6' in '-O6'

Another option I'm using is --without-netsnmpas suggested here because this module also threw errors during the make process.

I also tried using the option --host=x86_64-darwin. I tried both with the default compiler and with CC=gcc-4.8.

I tried both make, and make -j 4as suggested here .

Two sample output (using version 11.7):

./configure --host=x86_64-darwin CC=gcc-4.8 CFLAGS=-mtune=generic
make -j 4
...
[CC] enum.c -> enum.o
enum.c: In function 'blr_txt':
enum.c:225:41: error: 'C_IN' undeclared (first use in this function)
ret = ast_search_dns(&context, domain, C_IN, T_TXT, txt_callback);

Using Os instead of O6

./configure  --without-netsnmp
make
...
duplicate symbol _ast_tech_to_upper in:
chan_iax2.o
iax2-provision.o
duplicate symbol _ast_rq_is_int in:
chan_iax2.o
iax2-provision.o
ld: 90 duplicate symbols for architecture x86_64

I need to either understand what is happening, or a “magical” solution.

+4
source share
5 answers

Asterisk, Digium Mac . , , "" GitHub. , .

https://github.com/leedm777/homebrew-asterisk

+4

asterisk 1.8 OS X (10.9, Mavericks), .

:

clang llvm documentation. , " C99".

"" - , clang .

:

//inline_api.h

:

#if !defined(AST_API_MODULE)
#define AST_INLINE_API(hdr, body) hdr; extern inline hdr body
#else
#define AST_INLINE_API(hdr, body) hdr; hdr body
#endif

#define AST_INLINE_API(hdr, body) hdr; extern inline HDR body

to

#define AST_INLINE_API(hdr, body) static inline hdr; static inline HDR body

Makefile

  SOLINK=-bundle -Xlinker -macosx_version_min -Xlinker 10.4 -Xlinker -undefined -Xlinker dynamic_lookup -force_flat_namespace

to

  SOLINK=-bundle -Xlinker -macosx_version_min -Xlinker 10.9 -Xlinker -undefined -Xlinker dynamic_lookup -force_flat_namespace

main/Makefile

  ASTLINK=-Xlinker -macosx_version_min -Xlinker 10.4 -Xlinker -undefined -Xlinker dynamic_lookup -force_flat_namespace

to

  ASTLINK=-Xlinker -macosx_version_min -Xlinker 10.9 -Xlinker -undefined -Xlinker dynamic_lookup -force_flat_namespace

asterisk macosx_version_min = 10.4, " 4"

make

SNMP, :

snmp/agent.c: 841: 43: : "RONLY"

, OS X "" SNMP API, /usr/include/net -snmp/library/snmp_impl.h :

#ifndef NETSNMP_NO_LEGACY_DEFINITIONS
#define RONLY           NETSNMP_OLDAPI_RONLY
#define RWRITE          NETSNMP_OLDAPI_RWRITE
#define NOACCESS        NETSNMP_OLDAPI_NOACCESS
#endif

, res/snmp/agent.c

RONLY SNMP:

#include <net-snmp/net-snmp-includes.h>
#define RONLY           NETSNMP_OLDAPI_RONLY

make . .

+2

Asterisk 13 LTS

  • Asterisk 13.2.0 Mac OS X Mavericks v10.9.5

  • Asterisk 13.4.0 Mac OS X Yosemite v10.10.3

Asterisk 13

  • Mac mini ( 2009 ) 2 Intel Core 2 Duo 8 DDR3

GCC4.8 macports . . macport

sudo port install gcc48
sudo port select gcc mp-gcc48

13,

tar zxf asterisk-13-current.tar.gz 
cd asterisk-13.4.0/
LDFLAGS=-L/opt/local/lib CFLAGS=-I/opt/local/include CPPFLAGS=-I/opt/local/include ./configure --without-netsnmp --without-gtk2 --prefix=/opt/local
make
sudo make install
sudo make samples

G.729 Asterisk bcg729

tar zxf bcg729-1.0.0.tar.gz 
cd bcg729-1.0.0
LDFLAGS=-L/opt/local/lib CFLAGS=-I/opt/local/include CPPFLAGS=-I/opt/local/include ./configure --prefix=/opt/local
make
sudo make install

tar jxf asterisk-g72x-1.3.tar.bz2 
cd asterisk-g72x-1.3
./autogen.sh
LDFLAGS=-L/opt/local/lib CFLAGS=-I/opt/local/include CPPFLAGS=-I/opt/local/include ./configure --prefix=/opt/local --enable-core2 --with-bcg729 --with-asterisk130
make
sudo make install

,

sudo asterisk

LaunchDaemon, "/Library/LaunchDaemons/org.asterisk.asterisk.plist"

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd" >
<plist version='1.0'>
<dict>
<key>Label</key><string>org.asterisk.asterisk.plist</string>
<key>ProgramArguments</key>
<array>
    <string>/opt/local/sbin/asterisk</string>
</array>
<key>Debug</key><false/>
<key>Disabled</key><true/>
<key>KeepAlive</key><true/>
</dict>
</plist>

LaunchDaemon, "/Library/LaunchDaemons/limit.maxfiles.plist" maxfiles

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
    <string>limit.maxfiles</string>
  <key>ProgramArguments</key>
    <array>
      <string>launchctl</string>
      <string>limit</string>
      <string>maxfiles</string>
      <string>65536</string>
      <string>65536</string>
    </array>
  <key>RunAtLoad</key>
    <true/>
  <key>ServiceIPC</key>
    <false/>
</dict>
</plist>

LaunchDaemon, "/Library/LaunchDaemons/limit.maxproc.plist" maxprco

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple/DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
    <string>limit.maxproc</string>
  <key>ProgramArguments</key>
    <array>
      <string>launchctl</string>
      <string>limit</string>
      <string>maxproc</string>
      <string>2500</string>
      <string>2500</string>
    </array>
  <key>RunAtLoad</key>
    <true />
  <key>ServiceIPC</key>
    <false />
</dict>
</plist>

,

cd /Library/LaunchDaemons
sudo launchctl load -w org.asterisk.asterisk.plist
sudo launchctl load -w limit.maxfiles.plist
sudo launchctl load -w limit.maxproc.plist

sudo asterisk -r

sudo asterisk -rvvvv
+2

Asterisk 12.0 OSX 10.9.5 (13F34), :

homebrew , :

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew doctor
$ brew tap leedm777/asterisk
$ brew tap homebrew/versions
$ brew install pjsip iksemel unixodbc srtp gcc48 sqlite openssl speex

.

$ ./configure CC=gcc-4.8 CXX=g++-4.8 --with-ssl=/usr/local/opt/openssl --with-sqlite3=/usr/local/opt/sqlite --without-netsnmp --with-unixodbc=/usr/local/opt/unixodbc --without-gtk2 --prefix=/opt/Asterisk
$ make
$ make install
$ make samples
0

Asterisk 12.x OS X 10.9 Mavericks 10.10 Yosemite. https://github.com/leedm777/homebrew-asterisk, , MacPorts gcc4.8 configure. brew , , . , ( , ), Asterisk 12, Asterisk 11.

Asterisk 11 OS X 10.9 Mavericks , Asterisk 11.15.0:

[CC] enum.c -> enum.o
enum.c: In function 'blr_txt':
enum.c:225:41: error: 'C_IN' undeclared (first use in this function)
ret = ast_search_dns(&context, domain, C_IN, T_TXT, txt_callback);

, , 'C_IN' undeclared , main/enum.c main/srv.c arpa/nameser_compat.h OS X, Apple cc, GCC. , , , :

 #ifdef __APPLE__
-#if __APPLE_CC__ >= 1495
+//#if __APPLE_CC__ >= 1495
 #include <arpa/nameser_compat.h>
-#endif
+//#endif
 #endif

, " : 4", OS X, . Makefile main/Makefile :

sed -i .original 's|-Xlinker 10\.4|-Xlinker 10.9|' Makefile
sed -i .original 's|-Xlinker 10\.4|-Xlinker 10.9|' main/Makefile

These changes allowed me to compile and install Asterisk 11.15.0 and 11.16.0 on OS X 10.9 Mavericks.

0
source

Source: https://habr.com/ru/post/1525902/


All Articles