[Home]

Summary:ASTERISK-18744: Asterisk doesn't build on OSX
Reporter:Stefan van der Eijk (stefan_van_der_eijk)Labels:
Date Opened:2011-10-22 04:25:08Date Closed:2014-02-22 18:35:24.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Channels/chan_iax2
Versions:1.8.8.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Mac OS X 10.7.2 (Lion), Macports, Xcode 4.2.Attachments:( 0) asterisk.log.20111024.1.log
( 1) asterisk.log.20111024.2.log
( 2) macports-parallel-build.patch
Description:Asterisk 1.8 SVN build fails with:

:info:build    [LD] chan_iax2.o iax2-parser.o iax2-provision.o -> chan_iax2.so
:info:build ld: duplicate symbol _ast_tvdiff_sec in iax2-parser.o and chan_iax2.o for architecture x86_64
:info:build clang: error: linker command failed with exit code 1 (use -v to see invocation)
:info:build make[1]: *** [chan_iax2.so] Error 1
:info:build make: *** [channels] Error 2
Comments:By: Walter Doekes (wdoekes) 2011-10-24 12:11:55.392-0500

Strange. ast_tvdiff_sec should not be in either. It should be defined in main/utils.c. And I don't see what the underscore-prefix is doing there either.

See include/asterisk/inline_api.h.

What happens if you exclude iax2 from the makeopts? Does it fail on the next channel driver?
What happens if you edit asterisk/include/time.h and move the definition to utils.c by hand? (Remove the use of the AST_INLINE_API macro.)

By: Walter Doekes (wdoekes) 2011-10-24 13:05:01.499-0500

Does the macports-parallel-build.patch improve the parallel build issue (the other issue mentioned in the macports bugreport)?

On linux parallel building looks like it works fine.

By: Stefan van der Eijk (stefan_van_der_eijk) 2011-10-24 14:01:57.219-0500

The parallel-build patch doesn't work. I'll attach the build log in a moment.

Excluding iax2 from makeopts, and then running make again shows an other issue:

{noformat}
/Developer/usr/bin/clang -o menuselect menuselect.o strcompat.o menuselect_stub.o mxml/libmxml.a
if [ -z "cmenuselect" ]; then menuselect/menuselect --check-deps menuselect.makeopts; fi
if [ -z "cmenuselect" ]; then menuselect/menuselect --check-deps menuselect.makeopts  ; fi
menuselect changes saved!
mini:1.8 stefan$ sudo make
Generating embedded module rules ...
  [CC] astcanary.c -> astcanary.o
error: invalid value '6' in '-O6'
make[1]: *** [astcanary.o] Error 1
make: *** [utils] Error 2
{noformat}

See: https://trac.macports.org/ticket/31485

By: Stefan van der Eijk (stefan_van_der_eijk) 2011-10-24 14:03:40.297-0500

with macports-parallel-build.patch

By: Walter Doekes (wdoekes) 2011-10-24 15:25:11.912-0500

Ok. This is your parallel build issue:
ASTERISK-18751

By: Walter Doekes (wdoekes) 2011-10-24 15:39:03.632-0500

> Excluding iax2 from makeopts, and then running make again shows an other issue:

And if you fix that? By changing the -O6 to -O3.
{noformat}
$ grep -l -- -O6 *
Makefile.rules
{noformat}

By: Stefan van der Eijk (stefan_van_der_eijk) 2011-10-24 15:58:22.176-0500


{noformat}
  [LD] chan_sip.o sip/config_parser.o sip/dialplan_functions.o sip/reqresp_parser.o sip/sdp_crypto.o sip/srtp.o -> chan_sip.so
ld: duplicate symbol _ast_tvdiff_sec in sip/config_parser.o and chan_sip.o for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [chan_sip.so] Error 1
make: *** [channels] Error 2
make: Leaving directory `/opt/local/var/macports/build/_Users_stefan_ports_net_asterisk/asterisk/work/1.8'
{noformat}


By: Stefan van der Eijk (stefan_van_der_eijk) 2011-10-24 16:13:01.862-0500

after also removing chan_sip, it stopped at pbx_dundi.so. Uploading new logfile shortly.

By: Stefan van der Eijk (stefan_van_der_eijk) 2011-10-24 16:14:12.247-0500

after removing chan_sip

By: mbrevda (lazytt) 2012-06-11 00:16:07.981-0500

Asterisk 10 also fails with:
{code}
  [LD] chan_iax2.o iax2-parser.o iax2-provision.o -> chan_iax2.so
ld: duplicate symbol _ast_tvdiff_sec in iax2-parser.o and chan_iax2.o for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [chan_iax2.so] Error 1
{code}

By: Matt Jordan (mjordan) 2014-02-22 18:35:24.592-0600

While I know this issue is rather old, I think we can safely say at this point that Asterisk isn't going to build with clang.

Asterisk makes extensive use of gcc extensions. This occurs now even in Asterisk 1.8, where the RAII_VAR macro has been backported and used in app_meetme's SLA code.

Since this issue was originally reported as a problem building Asterisk with clang, it's essentially been overcome by events.

Note that it is certainly possible to compile Asterisk with gcc on Macs - in fact, a number of people have posted homebrew recipes on github that aide in this.