Neither asterisk18 (net/asterisk) nor asterisk10 (net/asterisk10) can currently be compiled with gcc46. If you try, you will encounter this link error:
The symbols "__progname" and "environ" are defined in the /usr/lib/crt1.o object file as local (weak) symbols, but the asterisk build system needs them defined as global symbols. This patch (using asterisk-18.104.22.168 as an example) does that:
After encountering the above link error, apply the patch to (or edit) the "work/asterisk-[VERSION]/main/asterisk.exports" file and execute "make" again.
/usr/local/bin/ld: asterisk: local symbol `__progname' in /usr/lib/crt1.o is referenced by DSO /usr/local/bin/ld: final link failed: Bad value
--- /usr/ports/net/asterisk/work/asterisk-22.214.171.124/main/asterisk.exports 2012-04-01 11:19:50.532808549 -0700 +++ /root/asterisk.exports 2012-04-01 10:43:28.258979089 -0700 @@ -44,6 +44,8 @@ res_srtp; res_srtp_policy; secure_call_info; + __progname; + environ; local: *; };