riak,cpp库和构建错误

时间:2012-01-26 20:59:39

标签: c++ riak

我是riak的新手并且使用scons构建库。我从https://github.com/ajtack/riak-cpp.git下载了cpp库。我在ubuntu 64上。这是我的gcc版本:

gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4)

在命令提示符下输入:

> scons .

所以......我做了scons的错误吗?或者是代码问题。

以下是我得到的错误;

scons: Building targets ...
(compile)  build/riak/client.cxx
In file included from ./riak/client.hxx:2:0,
                 from build/riak/client.cxx:1:
./riak/message.hxx:29:28: error: ‘error_code’ is not a member of ‘std’
./riak/message.hxx:29:76: error: functional cast expression list treated as compound expression
./riak/message.hxx:29:77: error: template argument 1 is invalid
./riak/message.hxx:29:86: error: invalid type in declaration before ‘;’ token
build/riak/client.cxx: In member function ‘void riak::client::delete_object(const riak::key&, const riak::key&, riak::delete_response_handler)’:
build/riak/client.cxx:95:105: error: cannot convert ‘std::_Bind<bool (*(std::function<void(const std::error_code&, const std::basic_string<char>&, const std::basic_string<char>&)>, std::basic_string<char>, std::basic_string<char>, std::_Placeholder<1>, std::_Placeholder<2>, std::_Placeholder<3>))(std::function<void(const std::error_code&, const std::basic_string<char>&, const std::basic_string<char>&)>, const std::basic_string<char>&, const std::basic_string<char>&, const std::error_code&, long unsigned int, const std::basic_string<char>&)>’ to ‘riak::message::handler’ in initialization
build/riak/client.cxx: In member function ‘void riak::client::get_object(const riak::key&, const riak::key&, riak::get_response_handler)’:
build/riak/client.cxx:171:70: error: cannot convert ‘std::_Bind<bool (*(std::basic_string<char>, std::basic_string<char>, std::function<std::shared_ptr<RpbContent>(const google::protobuf::RepeatedPtrField<RpbContent>&)>, riak::<unnamed>::delivery_arguments, std::function<void(const std::error_code&, std::shared_ptr<RpbContent>&, std::function<void(const std::shared_ptr<RpbContent>&, std::function<void(const std::error_code&)>&)>&)>, std::_Placeholder<1>, std::_Placeholder<2>, std::_Placeholder<3>))(const std::basic_string<char>&, const std::basic_string<char>&, std::function<std::shared_ptr<RpbContent>(const google::protobuf::RepeatedPtrField<RpbContent>&)>&, riak::<unnamed>::delivery_arguments&, std::function<void(const std::error_code&, std::shared_ptr<RpbContent>&, std::function<void(const std::shared_ptr<RpbContent>&, std::function<void(const std::error_code&)>&)>&)>, const std::error_code&, long unsigned int, const std::basic_string<char>&)>’ to ‘riak::message::handler’ in initialization
build/riak/client.cxx: In function ‘riak::message::handler riak::<unnamed>::make_resolution_response_handler(std::shared_ptr<RpbContent>&, riak::<unnamed>::resolution_response_handler_for_object)’:
build/riak/client.cxx:246:63: error: cannot convert ‘std::_Bind<std::function<bool(std::shared_ptr<RpbContent>&, const std::error_code&, long unsigned int, const std::basic_string<char>&)>(std::shared_ptr<RpbContent>, std::_Placeholder<1>, std::_Placeholder<2>, std::_Placeholder<3>)>’ to ‘riak::message::handler’ in return
build/riak/client.cxx: In function ‘void riak::<unnamed>::put_cold(const riak::key&, const riak::key&, const std::shared_ptr<RpbContent>&, riak::<unnamed>::delivery_arguments&, riak::put_response_handler&)’:
build/riak/client.cxx:350:107: error: cannot convert ‘std::_Bind<bool (*(std::function<void(const std::error_code&)>, std::_Placeholder<1>, std::_Placeholder<2>, std::_Placeholder<3>))(std::function<void(const std::error_code&)>, const std::error_code&, long unsigned int, const std::basic_string<char>&)>’ to ‘riak::message::handler’ for argument ‘3’ to ‘void riak::<unnamed>::send_put_request(RpbPutReq&, riak::<unnamed>::delivery_arguments&, riak::message::handler)’
scons: *** [build/riak/client.o] Error 1
scons: building terminated because of errors.

1 个答案:

答案 0 :(得分:1)

尝试升级到gcc 4.6.1,对我来说它运行良好:

ivan@ubuntu:/tmp/riak-cpp$ scons .
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
(link)     build/test/units/unit_tests
build/test/units/unit_tests
[==========] Running 22 tests from 4 test cases.
[----------] Global test environment set-up.
[----------] 5 tests from deleting_client
[ RUN      ] deleting_client.client_survives_nonsense_reply_to_unmap
[       OK ] deleting_client.client_survives_nonsense_reply_to_unmap (1 ms)
[ RUN      ] deleting_client.client_survives_wrong_code_reply_to_unmap
[       OK ] deleting_client.client_survives_wrong_code_reply_to_unmap (0 ms)
[ RUN      ] deleting_client.client_survives_trailing_data_with_RpbDelResp
[       OK ] deleting_client.client_survives_trailing_data_with_RpbDelResp (0 ms)
[ RUN      ] deleting_client.client_accepts_well_formed_RbpDelResp
[       OK ] deleting_client.client_accepts_well_formed_RbpDelResp (0 ms)
[ RUN      ] deleting_client.client_accepts_well_formed_unmap_response_in_parts
[       OK ] deleting_client.client_accepts_well_formed_unmap_response_in_parts (0 ms)
[----------] 5 tests from deleting_client (1 ms total)

[----------] 6 tests from getting_client
[ RUN      ] getting_client.client_survives_long_nonsense_reply_to_get
[       OK ] getting_client.client_survives_long_nonsense_reply_to_get (0 ms)
[ RUN      ] getting_client.client_survives_wrong_code_reply_to_get
[       OK ] getting_client.client_survives_wrong_code_reply_to_get (0 ms)
[ RUN      ] getting_client.client_survives_extra_data_in_empty_get_response
[       OK ] getting_client.client_survives_extra_data_in_empty_get_response (0 ms)
[ RUN      ] getting_client.client_accepts_nonempty_get_response
[       OK ] getting_client.client_accepts_nonempty_get_response (1 ms)
[ RUN      ] getting_client.client_accepts_empty_RbpGetResp
[       OK ] getting_client.client_accepts_empty_RbpGetResp (0 ms)
[ RUN      ] getting_client.client_accepts_well_formed_response_in_parts
[       OK ] getting_client.client_accepts_well_formed_response_in_parts (0 ms)
[----------] 6 tests from getting_client (1 ms total)

[----------] 5 tests from get_and_put_client
[ RUN      ] get_and_put_client.put_for_cold_object_with_well_formed_response_is_successful
[       OK ] get_and_put_client.put_for_cold_object_with_well_formed_response_is_successful (0 ms)
[ RUN      ] get_and_put_client.client_survives_long_nonsense_reply_to_cold_put
[       OK ] get_and_put_client.client_survives_long_nonsense_reply_to_cold_put (0 ms)
[ RUN      ] get_and_put_client.client_survives_extra_data_in_cold_put_response
[       OK ] get_and_put_client.client_survives_extra_data_in_cold_put_response (0 ms)
[ RUN      ] get_and_put_client.client_accepts_well_formed_put_response_in_parts
[       OK ] get_and_put_client.client_accepts_well_formed_put_response_in_parts (1 ms)
[ RUN      ] get_and_put_client.client_correctly_delivers_put_reply_with_vector_clock
[       OK ] get_and_put_client.client_correctly_delivers_put_reply_with_vector_clock (0 ms)
[----------] 5 tests from get_and_put_client (1 ms total)

[----------] 6 tests from get_with_siblings
[ RUN      ] get_with_siblings.getting_siblinged_value_triggers_resolution
[       OK ] get_with_siblings.getting_siblinged_value_triggers_resolution (0 ms)
[ RUN      ] get_with_siblings.resolved_sibling_is_returned_to_server
[       OK ] get_with_siblings.resolved_sibling_is_returned_to_server (0 ms)
[ RUN      ] get_with_siblings.resolved_sibling_produces_get_result
[       OK ] get_with_siblings.resolved_sibling_produces_get_result (0 ms)
[ RUN      ] get_with_siblings.resolving_sibling_handles_erroneous_server_reply
[       OK ] get_with_siblings.resolving_sibling_handles_erroneous_server_reply (0 ms)
[ RUN      ] get_with_siblings.resolving_sibling_handles_server_failure
[       OK ] get_with_siblings.resolving_sibling_handles_server_failure (1 ms)
[ RUN      ] get_with_siblings.multiple_sibling_resolutions_are_correctly_handled
[       OK ] get_with_siblings.multiple_sibling_resolutions_are_correctly_handled (0 ms)
[----------] 6 tests from get_with_siblings (1 ms total)

[----------] Global test environment tear-down
[==========] 22 tests from 4 test cases ran. (4 ms total)
[  PASSED  ] 22 tests.
scons: done building targets.
ivan@ubuntu:/tmp/riak-cpp$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6.1/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.1-9ubuntu3' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)