在solaris上增加1.64构建错误

时间:2017-06-30 10:09:11

标签: c++ gcc boost g++ solaris

<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日
  • GCC 6.2
  • 构建目标
  • Boost C ++ Libraries 1.64

2 个答案:

答案 0 :(得分:3)

我认为您在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。在使用Single Unix Standard 3(SUSv3)C90之前。 SUSv3和使用后C99。 g ++ 6.2,默认为C ++ 14 for C ++也设置了c11标志(#define __STDC_VERSION__ 201112L

所有这一切的结果是您可能需要设置_XPG6宏。通常你不直接这样做,你应该将_XOPEN_SOURCE设置为600,我看到你的命令行设置为500.

答案 1 :(得分:-1)

正如在 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中,库应该尝试自动解决问题,因此不需要进行此修改。