[Home]

Summary:ASTERISK-02754: Asterisk build fails on Darwin/OSX
Reporter:benjk (benjk)Labels:
Date Opened:2004-11-06 19:23:18.000-0600Date Closed:2008-01-15 15:12:50.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:Since Darwin/OSX doesn't use poll(), the poll-compat wrapper needs to be used or the build will fail. It is of course possible to rename poll-compat.h to poll.h, but the fact remains that Asterisk will not build out of the box.

I therefore suggest that this will be automated and I provide a set of #ifdef #define directives, which if incorporated would let the build process automaticall pick the right header file.

****** ADDITIONAL INFORMATION ******

Additional #ifdef/#define directives to automate picking the correct poll header file (including Darwin/OSX) ...

in file include/asterisk/channel.h apply this:

+#ifdef HAVE_SYS_POLL_H
#include <sys/poll.h>
+#elif HAVE_POLL_H
+#include <poll.h>
+#else
+#include "poll-compat.h"
+#endif

in files channel.c, manager.c and asterisk.c apply this:

+#ifdef HAVE_SYS_POLL_H
#include <sys/poll.h>
+#elif HAVE_POLL_H
+#include <poll.h>
+#else
+#include "include/asterisk/poll-compat.h"
+#endif

An alternative way would be to have the Makefile do the check and rename poll-compat.h to poll.h before starting the build process.

In my view though the above #ifdef/#include directives are favourable because they represent the least possible impact on the OS environment.
Comments:By: benjk (benjk) 2004-11-06 19:28:29.000-0600

The five lines checking for HAVE_SYS_POLL_H and HAVE_POLL_H are all over the internet in various forums. I can't really disclaim this because I didn't come up with it. However, this would seem to be such trivial a thing and so commonly applied, that it should be considered a public domain technique which doesn't require any disclaimers.

By: Mark Spencer (markster) 2004-11-07 01:14:06.000-0600

These would require autoconf.

By: Mark Spencer (markster) 2004-11-07 01:14:29.000-0600

And it's not a major bug that it doesn't build on macos x

By: benjk (benjk) 2004-11-07 03:01:33.000-0600

Over the last couple of months, I have got in the order of about 100 email messages from MacOSX users who tried building Asterisk and Make stops the build with Error 1. I verified this on MacOSX server. I know most of those people who emailed wouldn't have MacOSX Server, but I don't think it makes a difference.

On the Mac, things just have to work out of the box. That's the culture on this platform. I am only making a suggestion to put this into CVS so that Mac heads will have a good experience about Asterisk when they try to build it. Besides, judging by the number of Google hits for this, it would seem to be a best practices technique that just about anybody else is using to make incompatibilities between OS libraries fade into the background. Before this background it would seem to be a good idea to condider it.

At the end of the day, it's up to you. I can always write a clickable script application that will patch the code for the Mac folks.

By: Mark Spencer (markster) 2004-11-07 10:58:46.000-0600

To be clear, it's not that I'm suggesting we should leave it broken, I'm just saying the classification of being a "major" bug seems a little excessive.

By: Mark Spencer (markster) 2004-11-07 11:20:14.000-0600

Fixed in CVS, I just set one definition in channel.h and made the rest that needed poll.h use channel.h instead.

By: Russell Bryant (russell) 2004-11-07 19:07:26.000-0600

fixed in 1.0 - will be in 1.0.3

By: Digium Subversion (svnbot) 2008-01-15 15:12:43.000-0600

Repository: asterisk
Revision: 4170

U   trunk/asterisk.c
U   trunk/channel.c
U   trunk/channels/chan_zap.c
U   trunk/include/asterisk/channel.h
U   trunk/manager.c
U   trunk/res/res_agi.c

------------------------------------------------------------------------
r4170 | markster | 2008-01-15 15:12:43 -0600 (Tue, 15 Jan 2008) | 2 lines

Disable echo canceller for digital calls (bug ASTERISK-2737), fix build on MacOSX (bug ASTERISK-2754)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=4170

By: Digium Subversion (svnbot) 2008-01-15 15:12:50.000-0600

Repository: asterisk
Revision: 4179

U   branches/v1-0/include/asterisk/channel.h

------------------------------------------------------------------------
r4179 | russell | 2008-01-15 15:12:50 -0600 (Tue, 15 Jan 2008) | 2 lines

fix build for Mac OSX (bug ASTERISK-2754)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=4179