Bug 22925 - Build fixes for solaris
Summary: Build fixes for solaris
Status: RESOLVED FIXED
Alias: None
Product: nice
Classification: Unclassified
Component: General (show other bugs)
Version: unspecified
Hardware: SPARC Solaris
: medium normal
Assignee: Dafydd Harries
QA Contact:
URL: http://build.gnome.org/builders/libni...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-24 01:15 UTC by James Andrewartha
Modified: 2013-10-29 16:53 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
build fixes for solaris (845 bytes, patch)
2009-07-24 01:15 UTC, James Andrewartha
Details | Splinter Review
updated patch to allow SUSv3 & C99 compilation environments (712 bytes, patch)
2012-11-27 00:16 UTC, Tim Mooney
Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description James Andrewartha 2009-07-24 01:15:14 UTC
Created attachment 27974 [details] [review]
build fixes for solaris

As can be seen at http://build.gnome.org/builders/libnice-opensol-gcc/builds/2/steps/libnice%20build/logs/stdio libnice doesn't build on Solaris. It also needs some defines for msg_* and CMSG_SPACE.
Comment 1 Tim Mooney 2009-11-02 10:02:47 UTC
Some of these fixes are definitely needed on Solaris -- the additional library check for certain.

On Solaris 10, though, compiling against the XPG4v2 interfaces causes more trouble that it solves, at least if you're using the no-cost Sun Workshop compiler.  This is because libnice currently requires stdbool.h (note: there's a configure *check* for stdbool.h, but most of the source files don't conditionally include it, so it's currently going to cause an error if it's not available) which means C99, and the XPG4v2 interfaces are incompatible with C99.

What worked better for me was to start with this patch but remove the define for _XOPEN_SOURCE_EXTENDED and change the _XOPEN_SOURCE define to 600 -- meaning SUSv3 (only available on Solaris 10 and I'm guessing OpenSolaris).  That allowed the stun stuff to compile.  I needed an additional tweak for all of the gcc CFLAGS that are hard-coded and one for a missing include (<sys/sockio.h>) in interfaces.c, but the end result was that the compilation succeeded with the Workshop compiler.

I'll happily provide a patch, if there's any chance it might be included in some future version of libnice.

Comment 2 Youness Alaoui 2010-03-18 12:59:26 UTC
Thanks for the patches, could you please provide me with a proper patch? I don't have Solaris, so all I can do is review/merge your patch, so make sure it works correctly.
Tim Mooney: I don't really understand what issues you found with the original patch, and what needs to be fixed, so please provide a new, proper patch and it will be included in the next release of libnice.
Thanks.
Comment 3 Olivier Crête 2012-11-23 09:45:41 UTC
I'm pretty sure we could remove stdbool.h without too many problems also.
Comment 4 Tim Mooney 2012-11-27 00:15:12 UTC
Until I saw Olivier's comment I had forgotten I had even commented on this bug.

What I was trying to say in comment #1 is that James' patch (to enable access to functions/symbols that comply with the XPG4v2 interface) doesn't completely work for Solaris, because the stdbool.h header is part of C99, which is incompatible with XPG4v2.  You can't use both at the same time, it's a compilation error.

My patch is similar to his, but instead of adding

  -D_XOPEN_SOURCE_EXTENDED=1 -D_XOPEN_SOURCE=2

it does

  -D_XOPEN_SOURCE=600

which means compile for the SUSv3 interface, which is compatible with C99.

Note that I just tried libnice-0.1.3 and it now also requires a new library check (in addition to the one James added for -lsocket) for -lnsl for the inet_* functions.

I will attach a patch with my updated change.

Note that I need a second patch, to remove all the gcc-specific CFLAGS from the Makefile.ams and from configure.ac, before compilation will succeed with the Sun Workshop compiler.  It would be nice if the gcc-specific flags could be tested via configure and substituted as necessary.  This is how some other projects handle the issue, but it would require an additional configure macro (I think it's part of gnulib, but would have to check).
Comment 5 Tim Mooney 2012-11-27 00:16:02 UTC
Created attachment 70630 [details] [review]
updated patch to allow SUSv3 & C99 compilation environments
Comment 6 Olivier Crête 2013-10-29 16:53:13 UTC
Fixed in git master

commit f3a68a35f6ac423376cc9e26d66fac9dd882bc97
Author: Tim Mooney <Tim.Mooney@ndsu.edu>
Date:   Tue Oct 29 16:52:12 2013 +0000

    Add special case to make it compile on Solaris


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.