0

我尝试在 Intel 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 开发人员是否会阅读这篇文章并帮助我解决一些补丁......

非常感谢任何提示!

4

1 回答 1

2

关于使用 Solaris Studio 构建 Boost 的第一件事是 Jam 文件已经超过 5 年没有更新,并且使用 STLport 作为其 C++ 标准库。这可能不是你想要的。Solaris Studio 12.4 可以在 C++11 模式下运行,它使用 GNU libstdc++ 来提供其标准库。即使您在默认的 C++03 模式下运行,您也可能希望使用 Apache C++ 标准库。如果您的 C++ 代码的其余部分没有使用 STLport,那么请询问另一个关于更改 Solaris Studio 的 Boost Jam 文件以使用不同标准库的问题。

继续查看您看到的确切错误消息,我认为存档库中的所有错误消息都有相同的原因,并且很容易修复。编辑 boost/archive/detail/register_archive.hpp 并将第 31 行更改为:

#ifdef __SUNPRO_CC

至:

#if 0

很久以前,有人为旧版本的 Solaris Studio 中的错误添加了解决方法,但现在 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

对于您粘贴的最后几个错误,需要更多上下文才能查看它们的来源。

于 2015-01-23T17:48:41.430 回答