OS X Lion, Xcode 4.2, can't build

Hi,

Trying to build latest asterisk-1.8.5.0 on os x lion with Xcode 4.2.

configured by:

./configure --host=x86_64-darwin
make

Getting this error:

[CC] chan_agent.c -> chan_agent.o
[LD] chan_agent.o -> chan_agent.so
ld: warning: directory not found for option '-L/usr/local/lib’
ld: symbol dyld_stub_binding_helper not found, normally in crt1.o/dylib1.o/bundle1.o for architecture x86_64
collect2: ld returned 1 exit status
make[1]: *** [chan_agent.so] Error 1
make: *** [channels] Error 2

Environment:

uname -a
Darwin troll.local 11.0.1 Darwin Kernel Version 11.0.1: Wed Jun 29 19:53:22 PDT 2011; root:xnu-1699.23.2~1/RELEASE_X86_64 x86_64

gcc -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2335.15~108/src/configure --disable-checking --enable-werror --prefix=/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2335.15~108/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)

Thanks

Got some progress.

Added “CONFIG_LDFLAGS=/usr/lib/crt1.o” to makeopts file

gets a lot further until

[CC] res_adsi.c -> res_adsi.o
In file included from res_adsi.c:50:
/asterisk-1.8.5.0/include/asterisk/adsi.h:126: error: only weak aliases are supported in this configuration
/asterisk-1.8.5.0/include/asterisk/adsi.h:128: error: only weak aliases are supported in this configuration
/asterisk-1.8.5.0/include/asterisk/adsi.h:138: error: only weak aliases are supported in this configuration
/asterisk-1.8.5.0/include/asterisk/adsi.h:150: error: only weak aliases are supported in this configuration
/asterisk-1.8.5.0/include/asterisk/adsi.h:164: error: only weak aliases are supported in this configuration
/asterisk-1.8.5.0/include/asterisk/adsi.h:165: error: only weak aliases are supported in this configuration
/asterisk-1.8.5.0/include/asterisk/adsi.h:168: error: only weak aliases are supported in this configuration
/asterisk-1.8.5.0/include/asterisk/adsi.h:169: error: only weak aliases are supported in this configuration
/asterisk-1.8.5.0/include/asterisk/adsi.h:173: error: only weak aliases are supported in this configuration
/asterisk-1.8.5.0/include/asterisk/adsi.h:187: error: only weak aliases are supported in this configuration
/asterisk-1.8.5.0/include/asterisk/adsi.h:192: error: only weak aliases are supported in this configuration
/asterisk-1.8.5.0/include/asterisk/adsi.h:193: error: only weak aliases are supported in this configuration
/asterisk-1.8.5.0/include/asterisk/adsi.h:200: error: only weak aliases are supported in this configuration
/asterisk-1.8.5.0/include/asterisk/adsi.h:202: error: only weak aliases are supported in this configuration
/asterisk-1.8.5.0/include/asterisk/adsi.h:216: error: only weak aliases are supported in this configuration
/asterisk-1.8.5.0/include/asterisk/adsi.h:225: error: only weak aliases are supported in this configuration
/asterisk-1.8.5.0/include/asterisk/adsi.h:234: error: only weak aliases are supported in this configuration
/asterisk-1.8.5.0/include/asterisk/adsi.h:243: error: only weak aliases are supported in this configuration
/asterisk-1.8.5.0/include/asterisk/adsi.h:244: error: only weak aliases are supported in this configuration
/asterisk-1.8.5.0/include/asterisk/adsi.h:245: error: only weak aliases are supported in this configuration
/asterisk-1.8.5.0/include/asterisk/adsi.h:255: error: only weak aliases are supported in this configuration
/asterisk-1.8.5.0/include/asterisk/adsi.h:261: error: only weak aliases are supported in this configuration
/asterisk-1.8.5.0/include/asterisk/adsi.h:277: error: only weak aliases are supported in this configuration
/asterisk-1.8.5.0/include/asterisk/adsi.h:289: error: only weak aliases are supported in this configuration
/asterisk-1.8.5.0/include/asterisk/adsi.h:303: error: only weak aliases are supported in this configuration
/asterisk-1.8.5.0/include/asterisk/adsi.h:314: error: only weak aliases are supported in this configuration
/asterisk-1.8.5.0/include/asterisk/adsi.h:328: error: only weak aliases are supported in this configuration
/asterisk-1.8.5.0/include/asterisk/adsi.h:342: error: only weak aliases are supported in this configuration
make[1]: *** [res_adsi.o] Error 1
make: *** [res] Error 2

Anyone?

Sadly, I’m having the same problem with Asterisk 1.8.3.2 under Lion and Xcode 4.2.

I have the following in my .bash_profile:

export CC=gcc-4.2
export ARCHFLAGS=’-arch x86_64’

I’ve also tried the llvm-gcc compiler and same problem.

I’ve checked and the /usr/lib/crt1.o file exists.

Any help greatly appreciated. :smiley:

The number of people doing builds on OS X is dwarfed by the number of people doing builds against Linux, so you’re at a bit of a disadvantage there. But, your error seems to be coming up while trying to make the res_adsi component. So, before you do a “make,” do a “make menuconfig” and pull that module from the list of what you’re going to build. It’s exceedingly unlikely that you’re actually using ADSI terminals, so you won’t miss it.

Thanks for the response. I understand the very small size of the audience for asterisk on os x. It could help expand the audience if there was a bamboo job that compiled on the most recent version of OS/compilers so these issues don’t make it to releases.

Have had to disable:
res_adsi,
res_agi,
res_crypto,
res_monitor,
res_smdi,
res_snmp: snmp/agent.c:830: error: ‘RONLY’ undeclared (first use in this function),

At this point I am a little concerned I am not going to get a functional asterisk.

Then it gets to:

[CC] utils.c -> utils.o
[CC] version.c -> version.o
[CC] xml.c -> xml.o
[CC] xmldoc.c -> xmldoc.o
creating cache ./config.cache
checking for gcc… gcc
checking whether the C compiler (gcc -D_THREAD_SAFE -I…/…//include -I/usr/include/libxml2 -pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -g3 -D__Darwin__ -O6 /usr/lib/crt1.o -L/usr/local/lib ) works… no
configure: error: installation or configuration problem: C compiler cannot create executables.
make[1]: *** [editline/libedit.a] Error 1
make: *** [main] Error 2

And I am stuck

Finally got the thing to build. Here is what i did from the start

tar -xvf asterisk-1.8.5.0.tar
cd asterisk-1.8.5.0
./configure
make menuselect
For the above alias issues
res_adsi,
res_agi,
res_crypto,
res_monitor,
res_smdi
For a undefined variable: snmp/agent.c:830: error: ‘RONLY’ undeclared
res_snmp
For actually when you have asterisk installed and running for some reason asterisk uses %100 CPU if you don’t do this
pbx_spool
save and exit
vi makeopts
change “CONFIG_LDFLAGS=” to "CONFIG_LDFLAGS= /usr/lib/bundle1.o"
save and exit
make

ta daaaa

Hope this helps someone

Matt

So what if I need AGI? Are there any plans to address this incompatibility with Lion?

For some reason, I had to disable the optimization option as well. I eventually punted and installed Debian Squeeze on VM partition so I can get going.

+1 for AGI support, I think that’s a big deal for us Adhearsion nerds. (Thanks for all the support and help, BTW) :smiley:

We had a great talk on Asterisk and Adhearsion by Ben Klang, at the Lone Star Ruby Conf today, and there was a lot of interest generated in telephony apps (and it seems that most of the Ruby developers are on macs).

I was able to follow balders’ logic here and got 1.8.6.0 to build in Lion, but Asterisk wouldn’t run. It wanted one or more of its missing modules. My troubleshooting skills on this stuff are very limited, but I note Tilgman’s work in the changelog of 10.0.0b2, referring to 1.8 and wonder if any of you have had success with it?

[code]2011-09-19 21:41 +0000 [r336734-336789] Tilghman Lesher tilghman@meg.abyt.es

* include/asterisk/optional_api.h, Makefile, /, configure,
  include/asterisk/autoconfig.h.in, main/Makefile,
  codecs/gsm/Makefile, configure.ac, Makefile.rules: Merged
  revisions 336733 via svnmerge from
  https://origsvn.digium.com/svn/asterisk/branches/1.8 ........
  r336733 | tilghman | 2011-09-19 15:27:03 -0500 (Mon, 19 Sep 2011)
  | 11 lines Various changes to allow 1.8 to compile on Mac OS X
  Lion (10.7) * Makefile workaround for 10.6 extended to work on
  10.7 and later. * Now uses the 'weak' symbol for Lion systems,
  which no longer support 'weak_import' Closes ASTERISK-17612.
  Closes ASTERISK-18213. Tested by: tilghman, oej. ........[/code]

We have been discussing this on MacPorts, and I have successfully built on OS X Lion with Xcode 4.2

There are two primary issues:

[ul]
[] The configure script does not correctly determine that the platform requires HAVE_ATTRIBUTE_weak_import option. You need to manually add the following line to include/asterisk/autoconfig.h until such time as someone works out why the configure script is broken. #define HAVE_ATTRIBUTE_weak_import 1 [/]
[] The makeopt requires CONFIG_LDFLAGS=/usr/lib/bundle1.o to be set[/]
[/ul]

See http://trac.macports.org/ticket/31485 for more discussion.

This appears to be the issue addressed by issues.asterisk.org/jira/browse/ASTERISK-17612

Has any progress been made on this I really don’t want to hammer at this if I am only going to clutter my system with half built software. I am intermediate level on building under OS X and would appreciate some suggestions or pointers on setting this up under 10.7.2 on a Mac Mini. We use a switchvox at my work and I own my own sip trunk and would like to have this working at home.

A basic guide to get the basics installed would be super appreciated :smiley:

According to the issue report mentioned two postings ago, the target fix release was 1.8.8. Have you tried 1.8.8-rc4 or viewed the Changelog for 1.8.8-rc4 to see if the issue was addressed in the release?

Hello,

I would need some guidance. i have been trying to do what balders has followed…but i keep getting the error the same error for bundle1.o and i am not sure where am i going wrong…can some one tell me exactly how to do
1st- disable the res_mentor…res_crypto …etc files… where should i go and delete it or should i do make menuselect and type some particular commands…as u can see i am new to dis…so would need ur help…

2nd- i am using Maz OS lion and Asterisk 10.0.0

Just tried (but failed) to get a running 1.8.9 on Lion using the following steps:

in res/snmp/agent.c add “#define RONLY 1”

in makeopts, change “CONFIG_LDFLAGS=” to “CONFIG_LDFLAGS= /usr/lib/bundle1.o"

then when I run asterisk I get

dyld: Symbol not found: ___ast_adsi_available
Referenced from: /usr/local/sbin/asterisk
Expected in: flat namespace

Trace/BPT trap: 5

UPDATE: tried disabling res_adsi in the makemenu then re-running make and sudo make install but to no avail.

UPDATE: tried without the CONFIG_LDFLAGS setting and no difference. I disabled as many of the modules as possible and did a clean make, same exact problem.

UPDATE: tried 1.8.8.0 which was supposed to fix the Lion install problem – failed with same error above.

UPDATE: tried @yogel’s suggestions (#define HAVE_ATTRIBUTE_weak 1) – failed with same error above.

@eternalravi: you disable the resources using makemenu – after you run ./configure, run “make menuselect” and then use your arrow keys to move down to Resources, then arrow into Resources, and then use your space bar to disable resources (no asterisk means resource disabled) and then exit by pressing Esc and choosing S to save changes. As for the second part, I suggest you stick with 1.8.8 and above since the fix for Lion was supposedly added in version 1.8.8.

Was able to successfully build Asterisk 1.8.9.2 with no mods and no errors. But on running, I get:

ruby-1.9.2-p290 asterisk-1.8.9.2$ asterisk -vvvc
dyld: Symbol not found: ___ast_adsi_available
  Referenced from: /usr/local/sbin/asterisk
  Expected in: flat namespace

Trace/BPT trap: 5

This is with res_asdi enabled and disabled in the menuselect. Any ideas? Thanks for any help.
– Kevin

I was able to get this to build on OSX 10.7.2 ( asterisk-10.3.0 )

./configure --host=x86_64-darwin
make menuselect ( remove res_snmp under Resource Modules )
sudo make 
sudo make install

Hope that helps someone out

HI All,

I could install asterisk 12.0.0 on my Mac OS X Mavericks, and it’s working ok.
And I also could compile chan_dongle, but when asterisk tries to load it, I get this error message:

[b][i][Mar 2 14:11:20] WARNING[1287]: loader.c:565 load_dynamic_module: Error loading module ‘chan_dongle.so’: dlopen(/Library/Application Support/Asterisk/Modules/chan_dongle.so, 6): Symbol not found: astbridged_channel

Referenced from: /Library/Application Support/Asterisk/Modules/chan_dongle.so

Expected in: flat namespace

[Mar 2 14:11:20] WARNING[1287]: loader.c:1032 load_resource: Module ‘chan_dongle.so’ could not be loaded.[/i][/b]

Does anyone have any clue or suggestion on how to solve this issue? I’m almost giving up on installing it in Mac OS X.

Thanks in advance!