在 solaris 上增加 1.64 构建错误

Boost 1.64 build error on solaris

本文关键字:构建 错误 增加 solaris      更新时间:2023-10-16
<built-in>: note: this is the location of the previous definition
In file included from /usr/include/limits.h:12:0,
                 from /export/home/user/gcc-6.2.0.bin/lib/gcc/i386-pc-solaris2.11/6.2.0/include-fixed/limits.h:168,
                 from /export/home/user/gcc-6.2.0.bin/lib/gcc/i386-pc-solaris2.11/6.2.0/include-fixed/syslimits.h:7,
                 from /export/home/user/gcc-6.2.0.bin/lib/gcc/i386-pc-solaris2.11/6.2.0/include-fixed/limits.h:34,
                 from ./boost/log/detail/config.hpp:33,
                 from libs/log/src/attribute_set.cpp:16:
/export/home/user/gcc-6.2.0.bin/lib/gcc/i386-pc-solaris2.11/6.2.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 
  ^~~~~
"g++"  -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -march=i686 -pthreads -m32 -fno-strict-aliasing -ftemplate-depth-1024 -fvisibility=hidden -DBOOST_ALL_NO_LIB=1 -DBOOST_ATOMIC_STATIC_LINK=1 -DBOOST_CHRONO_STATIC_LINK=1 -DBOOST_FILESYSTEM_STATIC_LINK=1 -DBOOST_LOG_BUILDING_THE_LIB=1 -DBOOST_LOG_USE_AVX2 -DBOOST_LOG_USE_SSSE3 -DBOOST_LOG_WITHOUT_DEBUG_OUTPUT -DBOOST_LOG_WITHOUT_EVENT_LOG -DBOOST_LOG_WITHOUT_IPC -DBOOST_SPIRIT_USE_PHOENIX_V3=1 -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_SYSTEM_STATIC_LINK=1 -DBOOST_THREAD_BUILD_LIB=1 -DBOOST_THREAD_DONT_USE_CHRONO=1 -DBOOST_THREAD_POSIX -DBOOST_THREAD_USE_LIB=1 -DDATE_TIME_INLINE -DNDEBUG -D_XOPEN_SOURCE=500 -D__EXTENSIONS__ -D__STDC_CONSTANT_MACROS  -I"." -I"libs/log/src" -c -o "bin.v2/libs/log/build/gcc-6.2.0/release/link-static/threading-multi/attribute_set.o" "libs/log/src/attribute_set.cpp"
...failed gcc.compile.c++ bin.v2/libs/log/build/gcc-6.2.0/release/link-static/threading-multi/attribute_set.o...
gcc.compile.c++ bin.v2/libs/log/build/gcc-6.2.0/release/link-static/threading-multi/attribute_value_set.o
<command-line>:0:0: warning: "_XOPEN_SOURCE" redefined
<built-in>: note: this is the location of the previous definition
In file included from /usr/include/limits.h:12:0,
                 from /export/home/user/gcc-6.2.0.bin/lib/gcc/i386-pc-solaris2.11/6.2.0/include-fixed/limits.h:168,
                 from /export/home/user/gcc-6.2.0.bin/lib/gcc/i386-pc-solaris2.11/6.2.0/include-fixed/syslimits.h:7,
                 from /export/home/user/gcc-6.2.0.bin/lib/gcc/i386-pc-solaris2.11/6.2.0/include-fixed/limits.h:34,
                 from ./boost/log/detail/config.hpp:33,
                 from libs/log/src/attribute_value_set.cpp:16:
/export/home/user/gcc-6.2.0.bin/lib/gcc/i386-pc-solaris2.11/6.2.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 
  ^~~~~
"g++"  -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -march=i686 -pthreads -m32 -fno-strict-aliasing -ftemplate-depth-1024 -fvisibility=hidden -DBOOST_ALL_NO_LIB=1 -DBOOST_ATOMIC_STATIC_LINK=1 -DBOOST_CHRONO_STATIC_LINK=1 -DBOOST_FILESYSTEM_STATIC_LINK=1 -DBOOST_LOG_BUILDING_THE_LIB=1 -DBOOST_LOG_USE_AVX2 -DBOOST_LOG_USE_SSSE3 -DBOOST_LOG_WITHOUT_DEBUG_OUTPUT -DBOOST_LOG_WITHOUT_EVENT_LOG -DBOOST_LOG_WITHOUT_IPC -DBOOST_SPIRIT_USE_PHOENIX_V3=1 -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_SYSTEM_STATIC_LINK=1 -DBOOST_THREAD_BUILD_LIB=1 -DBOOST_THREAD_DONT_USE_CHRONO=1 -DBOOST_THREAD_POSIX -DBOOST_THREAD_USE_LIB=1 -DDATE_TIME_INLINE -DNDEBUG -D_XOPEN_SOURCE=500 -D__EXTENSIONS__ -D__STDC_CONSTANT_MACROS  -I"." -I"libs/log/src" -c -o "bin.v2/libs/log/build/gcc-6.2.0/release/link-static/threading-multi/attribute_value_set.o" "libs/log/src/attribute_value_set.cpp"
...failed gcc.compile.c++ bin.v2/libs/log/build/gcc-6.2.0/release/link-static/threading-multi/attribute_value_set.o...
gcc.compile.c++ bin.v2/libs/log/build/gcc-6.2.0/release/link-static/threading-multi/code_conversion.o
<command-line>:0:0: warning: "_XOPEN_SOURCE" redefined


...skipped <pbin.v2/libs/log/build/gcc-6.2.0/release/threading-multi>libboost_log.so.1.64.0 for lack of <pbin.v2/libs/log/build/gcc-6.2.0/release/threading-multi>attribute_name.o...
...skipped <pstage/lib>libboost_log.so.1.64.0 for lack of <pbin.v2/libs/log/build/gcc-6.2.0/release/threading-multi>libboost_log.so.1.64.0...
...skipped <pstage/lib>libboost_log.so for lack of <pstage/lib>libboost_log.so.1.64.0...
                 from ./boost/log/detail/config.hpp:33,
                 from ./boost/log/detail/setup_config.hpp:20,
                 from ./boost/log/detail/config.hpp:33,
                 from ./boost/log/detail/setup_config.hpp:20,
                 from ./boost/log/detail/config.hpp:33,
                 from ./boost/log/detail/setup_config.hpp:20,
                 from ./boost/log/detail/config.hpp:33,
                 from ./boost/log/detail/setup_config.hpp:20,
                 from ./boost/log/detail/config.hpp:33,
                 from ./boost/log/detail/setup_config.hpp:20,
                 from ./boost/log/detail/config.hpp:33,
                 from ./boost/log/detail/setup_config.hpp:20,
                 from ./boost/log/detail/config.hpp:33,
                 from ./boost/log/detail/setup_config.hpp:20,
                 from ./boost/log/detail/config.hpp:33,
                 from ./boost/log/detail/setup_config.hpp:20,
                 from ./boost/log/detail/config.hpp:33,
                 from ./boost/log/detail/setup_config.hpp:20,
...skipped <pbin.v2/libs/log/build/gcc-6.2.0/release/threading-multi>libboost_log_setup.so.1.64.0 for lack of <pbin.v2/libs/log/build/gcc-6.2.0/release/threading-multi>setup/parser_utils.o...
...skipped <pstage/lib>libboost_log_setup.so.1.64.0 for lack of <pbin.v2/libs/log/build/gcc-6.2.0/release/threading-multi>libboost_log_setup.so.1.64.0...
...skipped <pstage/lib>libboost_log_setup.so for lack of <pstage/lib>libboost_log_setup.so.1.64.0...

使用 GCC 6.2 版本构建 Boost C++库 1.64 时有一些错误日志。怎么了? 它是众多错误日志之一。

$b2

这发生在执行上述命令期间。日志和 python 库具有密集的错误日志。

我想知道为什么会发生此错误。

  • 构建环境
  • Oracle Solaris 11.2 x86 2014年6月23日
  • 海湾合作委员会 6.2
  • 构建目标
  • 提升C++库 1.64

我认为您在 feature_test.h 中遇到了这一块标准检查:

#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

这是触发的第一个 #error。

UNIX标准有许多(令人困惑的(名称,POSIX,Xopen,IEEE XPG,SUS。在使用单一Unix标准3(SUSv3(之前,C90被使用。SUSv3 和使用后使用 C99。G++ 6.2,默认为C++14,C++也设置了C11标志(#define __STDC_VERSION__ 201112L (

所有这一切的结果是您可能需要设置_XPG6宏。通常您不直接执行此操作,您应该将_XOPEN_SOURCE设置为 600,我看到它在命令行中设置为 500。

正如在 Paul Floyd 回答之后的讨论中所发现的那样,Solaris 标头与C++不兼容,这会导致您看到的错误。

这可以通过修改 Boost.Log 源代码、libs/log/build/Jamfile.v2 第 256 行来解决。从这里更改它:

<target-os>solaris:<define>_XOPEN_SOURCE=500

对此:

<target-os>solaris:<define>_XOPEN_SOURCE=600

(为了简洁起见,我删除了评论(。

在 Boost 1.65 中,库应尝试自动解决此问题,因此不需要此修改。