Unable to build asterisk 10 port with updated GCC


Looks like asterisk port is not compatible with newer GCC that are installed according to handbook:
freebsd.org/doc/en/articles/ … ticle.html

I’m getting the following error when trying to make /usr/ports/net/asterisk10 with GCC 4.6:

creating makelist creating config.h [LD] ../res/res_adsi.o abstract_jb.o acl.o alaw.o aoc.o app.o ast_expr2.o ast_expr2f.o asterisk.o astfd.o astmm.o astobj2.o audiohook.o autochan.o autoservice.o bridging.o callerid.o ccss.o cdr.o cel.o channel.o chanvars.o cli.o config.o data.o datastore.o db.o devicestate.o dial.o dns.o dnsmgr.o dsp.o enum.o event.o features.o file.o fixedjitterbuf.o format.o format_cap.o format_pref.o frame.o framehook.o fskmodem.o global_datastores.o hashtab.o heap.o http.o image.o indications.o io.o jitterbuf.o loader.o lock.o logger.o manager.o md5.o message.o netsock.o netsock2.o pbx.o plc.o poll.o privacy.o rtp_engine.o say.o sched.o security_events.o sha1.o slinfactory.o srv.o ssl.o stdtime/localtime.o strcompat.o strings.o stun.o syslog.o taskprocessor.o tcptls.o tdd.o term.o test.o threadstorage.o timing.o translate.o udptl.o ulaw.o utils.o version.o xml.o xmldoc.o editline/libedit.a -> asterisk /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 collect2: ld returned 1 exit status

Same problem with /usr/ports/net/asterisk (
But /usr/ports/net/asterisk16 ( is NOT affected and build ok.

I encountered the same problem. Neither asterisk18 (/usr/ports/net/asterisk) nor asterisk10 (/usr/ports/net/asterisk10) can currently be compiled with gcc46.

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- as an example) does that:

— /usr/ports/net/asterisk/work/asterisk- 2012-04-01 11:19:50.532808549 -0700
+++ /root/asterisk.exports 2012-04-01 10:43:28.258979089 -0700
@@ -44,6 +44,8 @@

  •           __progname;
  •           environ;

After encountering the above link error, apply the patch to (or edit) the “work/asterisk-[VERSION]/main/asterisk.exports” file and execute “make” again.

Cool! Probably you shall post this patch to the reviewboard

Currently there is no such problem with up to date GCC and up to date port.