Bug 31999 - C99 and XPG5 don't match on Solaris 10+
Summary: C99 and XPG5 don't match on Solaris 10+
Status: NEW
Alias: None
Product: Runtime
Classification: Mono
Component: General (show other bugs)
Version: 4.0.0
Hardware: PC Other
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-07-16 04:56 UTC by Rainer Orth
Modified: 2015-07-16 04:58 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
proposed patch (599 bytes, patch)
2015-07-16 04:58 UTC, Rainer Orth
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 31999 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

Description Rainer Orth 2015-07-16 04:56:55 UTC
When I tried to configure mono 4.0.2.5 on 64-bit Solaris 11/x86 (x86_64-pc-solaris2.11) with gcc 4.8, it failed
like this:

checking for PTHREAD_MUTEX_RECURSIVE... no
configure: error: Posix system lacks support for recursive mutexes

which is wrong.  In config.log I find

configure:22190: checking for PTHREAD_MUTEX_RECURSIVE
configure:22206: gcc -m64 -R/vol/gnu/lib/amd64 -c -g -O2 -std=gnu99 -fno-strict-aliasing -fwrapv -DMONO_DLL_EXPORT -Wno-unused-but-set-variable -g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes  -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wwrite-strings -Wno-switch -Wno-switch-enum -Wno-unused-value -mno-tls-direct-seg-refs -Wno-char-subscripts -I/vol/mono-4.0/include -DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_MMAP -DUSE_MUNMAP -DPLATFORM_SOLARIS -g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes  -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wwrite-strings -Wno-switch -Wno-switch-enum -Wno-unused-value -DLARGE_CONFIG  -D_XOPEN_SOURCE=500 -D__EXTENSIONS__ -D_XOPEN_SOURCE_EXTENDED=1 conftest.c >&5
In file included from /usr/include/pthread.h:8:0,
                 from conftest.c:106:
/vol/gcc-4.8/lib/gcc/i386-pc-solaris2.11/4.8.0/include-fixed/sys/feature_tests.h:363:2: error: #error "Compiler or options invalid for pre-UNIX 03 X/Open applications  and pre-2001 POSIX applications"
 #error "Compiler or options invalid for pre-UNIX 03 X/Open applications \
  ^
conftest.c:108:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
  ^
conftest.c:108:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
 main ()
 ^
configure:22206: $? = 1
configure: failed program was:
[...]
configure:22213: result: no
configure:22215: error: Posix system lacks support for recursive mutexes

This error is an artefact of the fact that configure.ac has

CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"

while on Solaris 10 and up C99 can only be used with XPG6/_XOPEN_SOURCE=600.  Completely omitting the 
_XOPEN_SOURCE definition isn't an option since without it, <sys/socket.h> struct msghdr lacks the msg_flags member

In addition, as discovered later, -D__EXTENSIONS__ is still needed to get the definition of PTHREAD_STACK_MIN
from <limits.h>, used in mono/io-layer/collection.c.

The attached patch allowed the configure to finish on Solaris 10 and 11/x86_64.

  Rainer
Comment 1 Rainer Orth 2015-07-16 04:58:28 UTC
Created attachment 12055 [details]
proposed patch