Opened 13 years ago

Closed 7 years ago

#31485 closed defect (wontfix)

asterisk @1.6.2.10 fails to build with clang

Reported by: andrew@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.0.3
Keywords: clang Cc:
Port: asterisk

Description (last modified by ryandesign (Ryan Carsten Schmidt))

Asterisk fails to build on Lion with Xcode 4.2 DP7.

Build error is

:info:build error: invalid value '6' in '-O6'

Attachments (1)

main.log (63.8 KB) - added by andrew@… 13 years ago.

Download all attachments as: .zip

Change History (13)

Changed 13 years ago by andrew@…

Attachment: main.log added

comment:1 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: marc.blanchet@… added
Description: modified (diff)
Keywords: lion added
Owner: changed from macports-tickets@… to mr_bond@…
Summary: Asterisk fails to build on Lionasterisk: invalid value '6' in '-O6'

comment:2 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign@… added
Keywords: clang added; lion removed

This discussion from a few years ago claims that in all official versions of gcc, any optimization level greater than 3 is treated the same as optimization level 3, confirmed by this page this page. And as you found, clang dies with an error if optimization level 6 is requested. (I can reproduce this on Snow Leopard as well, if I request clang.) So we should modify asterisk to not request that optimization level. I've fixed this in r84891. It now fails with a different error for me with clang, but the clang on Lion is newer than mine; please selfupdate and test this version and let us know what happens. If it doesn't work for you either, we may have to try a newer version of asterisk; see #31497. In the mean time, we could also try using llvm-gcc-4.2 instead of clang.

comment:3 Changed 13 years ago by andrew@…

This now fails with the following error:

:info:build ld: symbol dyld_stub_binding_helper not found, normally in crt1.o/dylib1.o/bundle1.o for architecture x86_64

which is consistent with my builds of 1.8.7 as well.

This seems to offer a few suggestions, and recommends adding /usr/lib/bundle1.o to the LD_CONFIG

however no one trying to build this seems to actually have a functioning install at the end...

comment:4 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Yeah that's getting too weird for me. Instead, please try llvm-gcc-4.2:

sudo port clean asterisk
sudo port install asterisk configure.compiler=llvm-gcc-4.2

comment:5 Changed 13 years ago by andrew@…

Still no joy. Compiles with the same error. Seems like this is probably an Asterisk bug, and might be best addressed by them.

I've done some more investigating, and the following things seem to be true.

The asterisk configure script is incorrectly deciding that Mac OSX does not support weak_import, and so is not correctly defining

HAVE_ATTRIBUTE_weak_import

Manually defining this in include/asterisk/autoconfig.h once configure is run succeeds. The correct thing to do here would be for someone to work out why the configure script test for this issue does not actually work successfully.

The code I added was:

#define HAVE_ATTRIBUTE_weak_import 1

In addition, you need to define

CONFIG_LDFLAGS=/usr/lib/bundle1.so

in the makeopts file. I'm assuming you can pass this option to the configure script via environment variables or something, but not sure.

This was for Asterisk 1.8.7.0, and making these changes resulted in a successful build of Asterisk, that actually works (test calls even made...!!!!)

comment:6 Changed 13 years ago by andrew@…

Looks like these issues have been addressed by Asterisk devs:

https://issues.asterisk.org/jira/browse/ASTERISK-18213

and

https://issues.asterisk.org/jira/browse/ASTERISK-17612

Neither of these changes have made the 1.8.7 release, but should be included in 1.8

comment:7 in reply to:  6 Changed 13 years ago by stefan.van.der.eijk@…

Neither of these changes have made the 1.8.7 release, but should be included in 1.8

It didn't make it into 1.8.7.1 either. Building the SVN doesn't show these issues, but others pop up.

See: #31497

Last edited 12 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:8 Changed 12 years ago by jmroot (Joshua Root)

Summary: asterisk: invalid value '6' in '-O6'asterisk @1.6.2.10 fails to build with clang

comment:9 Changed 10 years ago by mf2k (Frank Schima)

Cc: marc.blanchet@… ryandesign@… removed
Owner: changed from mr_bond@… to marc.blanchet@…

Assigning to current maintainer. See #44845.

comment:10 Changed 10 years ago by mf2k (Frank Schima)

Owner: changed from marc.blanchet@… to macports-tickets@…

This port no longer has a maintainer. See #46360.

comment:11 Changed 7 years ago by janstary (Jan Starý)

We have 1.6.2.20 now.

comment:12 Changed 7 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.