我将最后一个 mono tar 下载到 Solaris 11 我安装了所需的软件包:
# pkg install autoconf
# pkg install automake
# pkg install libtool
# pkg install gcc
当我尝试使用 gcc 4.8.2 在 64 位 Solaris 11/x86 (x86_64-pc-solaris2.11) 上配置 mono 5.18.0.268 时,失败如下:
$ ./configure.sh
(...)
checking for PTHREAD_MUTEX_RECURSIVE... no
configure: error:
Posix system lacks support for recursive mutexes
我在configure.ac中将“D_XOPEN_SOURCE=500”更改为“D_XOPEN_SOURCE=600”,但没有任何改进
dnl *****************************
dnl *** Checks for libxnet ***
dnl *****************************
case "${host}" in
*solaris* )
AC_MSG_CHECKING(for Solaris XPG4 support)
if test -f /usr/lib/libxnet.so; then
CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600"
CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED=1"
LIBS="$LIBS -lxnet"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
运行 autogen.sh 将调用配置,所以同样的问题。
我知道 Bug 31999 - C99 和 XPG5 在 Solaris 10+ 上不匹配 https://bugzilla.xamarin.com/show_bug.cgi?id=31999
我 7 天前在 mono github 中创建了一个问题/错误 (268) https://github.com/mono/gtk-sharp/issues/268
我还阅读了有关 Solaris 上的单声道安装的其他页面。我应该更新 gcc
答案1
您设置的确切值_XOPEN_SOURCE
并不重要。 Mono 错误地定义了_XOPEN_SOURCE_EXTENDED
宏:
case "${host}" in
*solaris* )
AC_MSG_CHECKING(for Solaris XPG4 support)
if test -f /usr/lib/libxnet.so; then
CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600"
CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED=1" <-- WRONG
LIBS="$LIBS -lxnet"
该_XOPEN_SOURCE_EXTENDED
宏不存在于POSIX 6或者POSIX 7 标准。
即使 Linux 也同意_XOPEN_SOURCE_EXTENDED
不应该在这里定义。每Linuxfeature_test_macros
手册页:
_XOPEN_SOURCE_EXTENDED
如果定义了此宏,并且
_XOPEN_SOURCE
已定义,则公开与 XPG4v2 (SUSv1) UNIX 扩展 (UNIX 95) 相对应的定义。_XOPEN_SOURCE
使用 500 或更大的值进行定义也会产生与定义 相同的效果_XOPEN_SOURCE_EXTENDED
。_XOPEN_SOURCE_EXTENDED
应避免在新源代码中使用。由于使用
_XOPEN_SOURCE
500 或更大的值进行定义与定义 具有相同的效果_XOPEN_SOURCE_EXTENDED
,因此后者(过时的)功能测试宏通常不会在手册页的概要中进行描述。
注意准确的措辞:
_XOPEN_SOURCE_EXTENDED
如果定义了此宏 ( ),并且_XOPEN_SOURCE
已定义,则公开与 XPG4v2 (SUSv1) UNIX 扩展 (UNIX 95) 对应的定义。 ...
定义_XOPEN_SOURCE
为任意值同时也在_XOPEN_SOURCE_EXTENDED
XPG4v2 中定义结果,那就是不是XPG6 是获取递归互斥体所必需的。
你可能会遇到Solaris 11 中的此检查/usr/include/sys/feature_tests.h
:
/*
* It is invalid to compile an XPG3, XPG4, XPG4v2, or XPG5 application
* using c99. The same is true for POSIX.1-1990, POSIX.2-1992, POSIX.1b,
* and POSIX.1c applications. Likewise, it is invalid to compile an XPG6
* or a POSIX.1-2001 application with anything other than a c99 or later
* compiler. Therefore, we force an error in both cases.
*/
#if defined(_STDC_C99) && (defined(__XOPEN_OR_POSIX) && !defined(_XPG6))
#error "Compiler or options invalid for pre-UNIX 03 X/Open applications \
and pre-2001 POSIX applications"
#elif !defined(_STDC_C99) && \
(defined(__XOPEN_OR_POSIX) && defined(_XPG6))
#error "Compiler or options invalid; UNIX 03 and POSIX.1-2001 applications \
require the use of c99"
#endif
_XPG6
被定义在文件的前面,在这个块中:
/*
* Use of _XOPEN_SOURCE
*
* The following X/Open specifications are supported:
*
* X/Open Portability Guide, Issue 3 (XPG3)
* X/Open CAE Specification, Issue 4 (XPG4)
* X/Open CAE Specification, Issue 4, Version 2 (XPG4v2)
* X/Open CAE Specification, Issue 5 (XPG5)
* Open Group Technical Standard, Issue 6 (XPG6), also referred to as
* IEEE Std. 1003.1-2001 and ISO/IEC 9945:2002.
*
* XPG4v2 is also referred to as UNIX 95 (SUS or SUSv1).
* XPG5 is also referred to as UNIX 98 or the Single Unix Specification,
* Version 2 (SUSv2)
* XPG6 is the result of a merge of the X/Open and POSIX specifications
* and as such is also referred to as IEEE Std. 1003.1-2001 in
* addition to UNIX 03 and SUSv3.
*
* When writing a conforming X/Open application, as per the specification
* requirements, the appropriate feature test macros must be defined at
* compile time. These are as follows. For more info, see standards(5).
*
* Feature Test Macro Specification
* ------------------------------------------------ -------------
* _XOPEN_SOURCE XPG3
* _XOPEN_SOURCE && _XOPEN_VERSION = 4 XPG4
* _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED = 1 XPG4v2
* _XOPEN_SOURCE = 500 XPG5
* _XOPEN_SOURCE = 600 (or POSIX_C_SOURCE=200112L) XPG6
*
* In order to simplify the guards within the headers, the following
* implementation private test macros have been created. Applications
* must NOT use these private test macros as unexpected results will
* occur.
*
* Note that in general, the use of these private macros is cumulative.
* For example, the use of _XPG3 with no other restrictions on the X/Open
* namespace will make the symbols visible for XPG3 through XPG6
* compilation environments. The use of _XPG4_2 with no other X/Open
* namespace restrictions indicates that the symbols were introduced in
* XPG4v2 and are therefore visible for XPG4v2 through XPG6 compilation
* environments, but not for XPG3 or XPG4 compilation environments.
*
* _XPG3 X/Open Portability Guide, Issue 3 (XPG3)
* _XPG4 X/Open CAE Specification, Issue 4 (XPG4)
* _XPG4_2 X/Open CAE Specification, Issue 4, Version 2 (XPG4v2/UNIX 95/SUS)
* _XPG5 X/Open CAE Specification, Issue 5 (XPG5/UNIX 98/SUSv2)
* _XPG6 Open Group Technical Standard, Issue 6 (XPG6/UNIX 03/SUSv3)
*/
/* X/Open Portability Guide, Issue 3 */
#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0 < 500) && \
(_XOPEN_VERSION - 0 < 4) && !defined(_XOPEN_SOURCE_EXTENDED)
#define _XPG3
/* X/Open CAE Specification, Issue 4 */
#elif (defined(_XOPEN_SOURCE) && _XOPEN_VERSION - 0 == 4)
#define _XPG4
#define _XPG3
/* X/Open CAE Specification, Issue 4, Version 2 */
#elif (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED - 0 == 1)
#define _XPG4_2
#define _XPG4
#define _XPG3
/* X/Open CAE Specification, Issue 5 */
#elif (_XOPEN_SOURCE - 0 == 500)
#define _XPG5
#define _XPG4_2
#define _XPG4
#define _XPG3
#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 199506L
/* Open Group Technical Standard , Issue 6 */
#elif (_XOPEN_SOURCE - 0 == 600) || (_POSIX_C_SOURCE - 0 == 200112L)
#define _XPG6
#define _XPG5
#define _XPG4_2
#define _XPG4
#define _XPG3
#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 200112L
#undef _XOPEN_SOURCE
#define _XOPEN_SOURCE 600
#endif