I'm trying to install Asterisk on my Macbook Pro (Intel Core i5) running Mavericks. Ideally I want to install version 1.8, because that's what's running on the server, but 11.7 is fine too.
After googling around I've tried many permutations of configure flags, but that strategy is not getting me anywhere.
I have Xcode 5.0.2. and the command line tools installed, 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=-O6
with OPTIMIZE=-Os
. This seems to have the same effect as CFLAGS=-mtune=generic
, namely preventing this error:
Generating embedded module rules ...
[CC] chan_agent.c -> chan_agent.o
error: invalid value '6' in '-O6'
The other option I'm using is --without-netsnmp
as suggested here because that module was throwing errors during the make process as well.
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 4
, as suggested here.
Two examples of 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'll either need actually understand what's going on or a "magic" solution.
A number of developers both in the Asterisk Developer community as well as at Digium use Macs for development. One of them, David Lee, has put a number of his Homebrew formulas up on GitHub. They might be helpful in working through the various issues you're running into.
https://github.com/leedm777/homebrew-asterisk
I got asterisk 1.8 on OS X (10.9, Mavericks) compiled and running.
Complete the following steps:
First make the source code compatible to clang according to the llvm documentation. If you are interested have a look to the "C99 inline functions" section.
The "thing" is how clang expects inline function definition.
Open the file:
include/asterisk/inline_api.h
find the following block:
#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
than change this line
#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
then open the main Makefile and change the following line
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
do the same in main/Makefile and change
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
If you let asterisk compile with macosx_version_min=10.4 the compiled binary won't start and throw an "illegal instruction 4"
finally run
make
If you have got the SNMP module activated you'll get another error while compiling:
snmp/agent.c:841:43: error: use of undeclared identifier 'RONLY'
This is, because OS X expects the 'modern' SNMP API and so this block in /usr/include/net-snmp/library/snmp_impl.h gets never compiled:
#ifndef NETSNMP_NO_LEGACY_DEFINITIONS
#define RONLY NETSNMP_OLDAPI_RONLY
#define RWRITE NETSNMP_OLDAPI_RWRITE
#define NOACCESS NETSNMP_OLDAPI_NOACCESS
#endif
I just worked around this by editing res/snmp/agent.c
I just put the definition for RONLY right after the SNMP includes:
#include <net-snmp/net-snmp-includes.h>
#define RONLY NETSNMP_OLDAPI_RONLY
then run make again. That should do the job.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With