How to compile Asterisk18+ with gcc46

Neither asterisk18 (net/asterisk) nor asterisk10 (net/asterisk10) can currently be compiled with gcc46. If you try, you will encounter this link error:
Code:
/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
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-1.8.11.0 as an example) does that:
Code:
--- /usr/ports/net/asterisk/work/asterisk-1.8.11.0/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:
                *;
 };
After encountering the above link error, apply the patch to (or edit) the "work/asterisk-[VERSION]/main/asterisk.exports" file and execute "make" again.
 
Asterisk incomplete port

Looks fixed now. Running net/asterisk11 here compiled with lang/gcc46. Not sure if make config can build and install using options chosen with Linux-intended gmake menuselect found in work/asterisk-$VERSION (after cd menuselect; ./configure; gmake)
 
Back
Top