我尝试在英特尔 Solaris V11.2 平台上使用全新的 Solaris Studio 12.4 编译器构建 Boost V1.57。我试图在 OTN 开发论坛上发布错误,但事实证明我的简单 OTN 帐户不允许我添加新帖子。因此,SO的问题。
小结:1(引导正常:
cd tools/build
./bootstrap.sh --with-toolset=sun
2(构建命令行(请注意,我将b2
和编译器放在PATH
中(。这是一个"阶段"构建,即没有安装步骤,只是为了看到所有库都可以构建:
b2 -j2 --build-dir=build toolset=sun address-model=64 threading=multi variant=release stage >& /tmp/boost_1_57_build.log
以下是压缩的错误列表:
"./boost/archive/binary_iarchive.hpp", line 57: Error: Multiple declaration for adjust_counter.
"./boost/archive/binary_iarchive.hpp", line 57: Error: Unexpected type name "get_counter<boost::archive::binary_iarchive>::type" encountered.
"./boost/archive/binary_oarchive.hpp", line 57: Error: Multiple declaration for adjust_counter.
"./boost/archive/binary_oarchive.hpp", line 57: Error: Unexpected type name "get_counter<boost::archive::binary_oarchive>::type" encountered.
"./boost/archive/detail/register_archive.hpp", line 45: Error: The function "adjust_counter" must have a prototype.
"./boost/archive/detail/register_archive.hpp", line 46: Error: Expression must have a constant value.
"./boost/archive/detail/register_archive.hpp", line 47: Error: Expression must have a constant value.
"./boost/archive/detail/register_archive.hpp", line 48: Error: An integer constant expression is required within the array subscript operator.
"./boost/archive/polymorphic_iarchive.hpp", line 170: Error: Multiple declaration for adjust_counter.
"./boost/archive/polymorphic_iarchive.hpp", line 170: Error: Unexpected type name "get_counter<boost::archive::polymorphic_iarchive>::type" encountered.
"./boost/archive/polymorphic_oarchive.hpp", line 153: Error: Multiple declaration for adjust_counter.
"./boost/archive/polymorphic_oarchive.hpp", line 153: Error: Unexpected type name "get_counter<boost::archive::polymorphic_oarchive>::type" encountered.
"./boost/archive/text_iarchive.hpp", line 136: Error: Multiple declaration for adjust_counter.
"./boost/archive/text_iarchive.hpp", line 136: Error: Unexpected type name "get_counter<boost::archive::text_iarchive>::type" encountered.
"./boost/archive/text_oarchive.hpp", line 121: Error: Multiple declaration for adjust_counter.
"./boost/archive/text_oarchive.hpp", line 121: Error: Unexpected type name "get_counter<boost::archive::text_oarchive>::type" encountered.
"./boost/archive/text_wiarchive.hpp", line 132: Error: Multiple declaration for adjust_counter.
"./boost/archive/text_wiarchive.hpp", line 132: Error: Unexpected type name "get_counter<boost::archive::text_wiarchive>::type" encountered.
"./boost/archive/text_woarchive.hpp", line 146: Error: Multiple declaration for adjust_counter.
"./boost/archive/text_woarchive.hpp", line 146: Error: Unexpected type name "get_counter<boost::archive::text_woarchive>::type" encountered.
"./boost/archive/xml_iarchive.hpp", line 146: Error: Multiple declaration for adjust_counter.
"./boost/archive/xml_iarchive.hpp", line 146: Error: Unexpected type name "get_counter<boost::archive::xml_iarchive>::type" encountered.
"./boost/archive/xml_oarchive.hpp", line 135: Error: Multiple declaration for adjust_counter.
"./boost/archive/xml_oarchive.hpp", line 135: Error: Unexpected type name "get_counter<boost::archive::xml_oarchive>::type" encountered.
"./boost/archive/xml_wiarchive.hpp", line 152: Error: Multiple declaration for adjust_counter.
"./boost/archive/xml_wiarchive.hpp", line 152: Error: Unexpected type name "get_counter<boost::archive::xml_wiarchive>::type" encountered.
"./boost/archive/xml_woarchive.hpp", line 142: Error: Multiple declaration for adjust_counter.
"./boost/archive/xml_woarchive.hpp", line 142: Error: Unexpected type name "get_counter<boost::archive::xml_woarchive>::type" encountered.
"./boost/math/cstdfloat/cstdfloat_types.hpp", line 378: Error: The type "boost::STATIC_ASSERTION_FAILURE<0>" is incomplete.
"/opt/solarisstudio12.4/lib/compilers/include/CC/stlport4/stl/_algo.c", line 436: Error: The function "lrand48" must have a prototype.
"/usr/include/stdlib.h", line 113: Error: putenv(char*) was declared before with a different language.
"libs/atomic/src/lockpool.cpp", line 74: Error: "}" expected instead of ",".
"libs/context/src/unsupported.cpp", line 7: Error: #error "platform not supported".
"libs/log/src/date_time_format_parser.cpp", line 399: Error: Linker scopes may not change after symbol definition.
"libs/log/src/date_time_format_parser.cpp", line 412: Error: Linker scopes may not change after symbol definition.
IMO 任何像样的C++编译器都应该能够构建 Boost,因为我很难想象没有 Boost 库的任何严肃C++项目。所以我只是想知道 Boost 或 Solaris Studio 开发人员是否阅读了这篇文章并帮助我完成一些补丁......
非常感谢您的任何提示!
Solaris Studio 构建 Boost,首先要知道的是 Jam 文件已经超过 5 年没有更新了,并且使用 STLport 作为其C++标准库。 这可能不是您想要的。 Solaris Studio 12.4 可以在 C++11 模式下运行,在该模式下,它使用 GNU libstdc++ 来提供其标准库。 即使您在默认的 C++03 模式下运行,您也可能希望使用 Apache C++ 标准库。 如果您没有将 STLport 用于其余C++代码,请询问另一个有关将 Solaris Studio 的 Boost Jam 文件更改为使用其他标准库的问题。
转到您看到的确切错误消息,我认为存档库中的所有错误消息都有相同的原因,并且很容易修复。 编辑提升/存档/详细信息/register_archive.hpp 并将第 31 行从:
#ifdef __SUNPRO_CC
自:
#if 0
很久以前,有人在旧版本的 Solaris Studio 中添加了一个 bug 的解决方法,但现在 Solaris Studio 12.4 发现该解决方法代码无效,但可以处理所有其他编译器看到的代码。
对于来自上下文库的"平台不受支持"消息,如果您使用的是 Solaris,那么您就不走运了,但如果您不使用此特定的 Boost 库,也许这并不重要。
"符号定义后链接器作用域可能不会更改"错误是由尝试使用 Solaris 符号可见性指令引起的。 我认为 Boost 开发人员最好将这些删除,因为他们不再在 Solaris 上进行测试,因为默认可见性是全局的,至少可以工作。 要使所有符号全局化并避免这些问题,请编辑 boost/config/compiler/sunpro_cc.hpp 并删除以下行:
//
// Dynamic shared object (DSO) and dynamic-link library (DLL) support
//
#if __SUNPRO_CC > 0x500
# define BOOST_SYMBOL_EXPORT __global
# define BOOST_SYMBOL_IMPORT __global
# define BOOST_SYMBOL_VISIBLE __global
#endif
并编辑 libs/math/build/Jamfile.v2 并删除此行:
<toolset>sun:<cxxflags>-xldscope=hidden
对于最后几个错误,您需要粘贴更多上下文才能查看它们的来源。