您正在查看: EOS-新手问答 分类下的文章

eos build tag --dirty

git describe --tags --dirty
git update-index --refresh
git describe --tags --dirty

参考

https://stackoverflow.com/questions/16035240/why-is-git-describe-dirty-adding-a-dirty-suffix-when-describing-a-clean-ch

test_cypher_suites ubuntu 18.04 build failure due to lack of pthread linkage {pthread_atfork}

一个老问题,编译时出现以下错误

[ 91%] �[32mBuilding CXX object libraries/chain/CMakeFiles/eosio_chain.dir/chain_id_type.cpp.o�[0m

/usr/lib/x86_64-linux-gnu/libcrypto.a(threads_pthread.o): In function `fork_once_func':

(.text+0x16): undefined reference to `pthread_atfork'

clang: [0;1;31merror: [0mlinker command failed with exit code 1 (use -v to see invocation) [0m

libraries/fc/test/crypto/CMakeFiles/test_cypher_suites.dir/build.make:113: recipe for target 'libraries/fc/test/crypto/test_cypher_suites' failed

make[2]: *** [libraries/fc/test/crypto/test_cypher_suites] Error 1

CMakeFiles/Makefile2:783: recipe for target 'libraries/fc/test/crypto/CMakeFiles/test_cypher_suites.dir/all' failed

make[1]: *** [libraries/fc/test/crypto/CMakeFiles/test_cypher_suites.dir/all] Error 2

解决方案

~/eos1.6/eos/libraries/fc$ git diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8056cf0..efb09db 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -157,7 +157,7 @@ IF(APPLE)
   find_library(security_framework Security)
   find_library(corefoundation_framework CoreFoundation)
 ENDIF()
-target_link_libraries( fc PUBLIC ${LINK_USR_LOCAL_LIB} ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES} ${PLATFORM_SPECIFIC_LIBS} ${RPCRT4} ${CMAKE_DL_LIBS} ${rt_library} ${readline_libraries} ${ECC_LIB} ${security_framework} ${corefoundation_framework} )
+target_link_libraries( fc PUBLIC ${LINK_USR_LOCAL_LIB} ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES} ${PLATFORM_SPECIFIC_LIBS} ${RPCRT4} ${CMAKE_DL_LIBS} ${rt_library} ${readline_libraries} ${ECC_LIB} ${security_framework} ${corefoundation_framework} pthread )


 SET(OPENSSL_CONF_TARGET )

参考

https://github.com/EOSIO/eos/issues/7490

owner account does not exist

执行

cleos push action eosio init '[0,"4,SYS"]' -p eosio@active

报错

Error 3050003: eosio_assert_message assertion failure
Error Details:
assertion failure with message: owner account does not exist
pending console output:

原因

https://github.com/EOSIO/eosio.contracts/blob/52fbd4ac7e6c38c558302c48d00469a4bed35f7c/contracts/eosio.system/src/eosio.system.cpp#L365

token::open_action open_act{ token_account, { {get_self(), active_permission} } };
      open_act.send( rex_account, core, get_self() );

https://github.com/EOSIO/eosio.contracts/blob/52fbd4ac7e6c38c558302c48d00469a4bed35f7c/contracts/eosio.token/src/eosio.token.cpp#L133
没有创建 rex_account eosio.rex账户

解决方案

创建 eosio.rex 账户,在执行

Unable to locate package eosio

安装eosio deb包时报错

sudo apt install eosio_1.6.6-1-ubuntu-18.04_amd64.deb
[sudo] password for surou:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package eosio_1.6.6-1-ubuntu-18.04_amd64.deb
E: Couldn't find any package by glob 'eosio_1.6.6-1-ubuntu-18.04_amd64.deb'
E: Couldn't find any package by regex 'eosio_1.6.6-1-ubuntu-18.04_amd64.deb'

解决方案,使用sudo dpkg -i安装

$ sudo dpkg -i eosio_1.6.6-1-ubuntu-18.04_amd64.deb
Selecting previously unselected package eosio.
(Reading database ... 57664 files and directories currently installed.)
Preparing to unpack eosio_1.6.6-1-ubuntu-18.04_amd64.deb ...
Unpacking eosio (1.6.6-1) ...
Setting up eosio (1.6.6-1) ...

Invalid cast from type 'string_type' to Object

查询交易返回

clfsc -u https://beta-api-chain.xxx.com get transaction_id 784886dbbc6cbbbfd2a223e1fc91a7b87231718aa94efdf39ec1e085331d9490
Error 3010006: Invalid transaction
Ensure that your transaction JSON follows the right transaction format!
You can refer to contracts/fsciolib/transaction.hpp for reference
Error Details:
Fail to parse transaction JSON '784886dbbc6cbbbfd2a223e1fc91a7b87231718aa94efdf39ec1e085331d9490'
Invalid cast from type 'string_type' to Object

查看数据

{
"timestamp": "2019-07-31T09:47:28.000",
"producer": "peacock15chy",
"confirmed": 0,
"previous": "006174d7444f5590416508b2cc03991549a9163ef8cf96dab4a5ce00f0f5ebf2",
"transaction_mroot": "d5cf5dc8b315844c92b625c3ff25ffb62766cdc6cb86ff69c64f4d0c927bd3cb",
"action_mroot": "3fbfdf22745803b79bd90022c9308775a1b6296beee81987efce8ef877dac543",
"schedule_version": 1,
"new_producers": null,
"header_extensions": [],
"producer_signature": "SIG_K1_KfnTYbdhByrtGbHrdNStbhYo2MQakmoweyBeQcRMmpXcgdPKB66yGnGAfT1g1rPfK3SVXFXAULU2CexRCoEqxdg6wSYUii",
"transactions": [
{
"status": "executed",
"cpu_usage_us": 419,
"net_usage_words": 0,
"trx": "784886dbbc6cbbbfd2a223e1fc91a7b87231718aa94efdf39ec1e085331d9490"
}
],
"block_extensions": [],
"id": "006174d85cf3afe91baaca598413f4395e412723ed9478eb6e797085dc6ab391",
"block_num": 6386904,
"ref_block_prefix": 1506454043
}

发现trx非object导致,查看本地代码

get_transaction_id_subcommand(CLI::App* actionRoot) {
      auto get_transaction_id = actionRoot->add_subcommand("transaction_id", localized("Get transaction id given transaction object"));
      get_transaction_id->add_option("transaction", trx_to_check, localized("The JSON string or filename defining the transaction which transaction id we want to retrieve"))->required();

      get_transaction_id->set_callback([&] {
         try {
            auto trx_var = json_from_file_or_string(trx_to_check);
            auto trx = trx_var.as<transaction>();
            std::cout << string(trx.id()) << std::endl;
         } EOS_RETHROW_EXCEPTIONS(transaction_type_exception, "Fail to parse transaction JSON '${data}'", ("data",trx_to_check))
      });
   }
};

并未做判断,怀疑版本太旧,查看github 最新代码
https://github.com/EOSIO/eos/blob/eb88d033c0abbc481b8a481485ef4218cdaa033a/programs/cleos/main.cpp#L1316

 get_transaction_id->set_callback([&] {
         try {
            fc::variant trx_var = json_from_file_or_string(trx_to_check);
            if( trx_var.is_object() ) {  // 增加了判断
               fc::variant_object& vo = trx_var.get_object();
               // if actions.data & actions.hex_data provided, use the hex_data since only currently support unexploded data
               if( vo.contains("actions") ) {
                  if( vo["actions"].is_array() ) {
                     fc::mutable_variant_object mvo = vo;
                     fc::variants& action_variants = mvo["actions"].get_array();
                     for( auto& action_v : action_variants ) {
                        if( !action_v.is_object() ) {
                           std::cerr << "Empty 'action' in transaction" << endl;
                           return;
                        }
                        fc::variant_object& action_vo = action_v.get_object();
                        if( action_vo.contains( "data" ) && action_vo.contains( "hex_data" ) ) {
                           fc::mutable_variant_object maction_vo = action_vo;
                           maction_vo["data"] = maction_vo["hex_data"];
                           action_vo = maction_vo;
                           vo = mvo;
                        } else if( action_vo.contains( "data" ) ) {
                           if( !action_vo["data"].is_string() ) {
                              std::cerr << "get transaction_id only supports un-exploded 'data' (hex form)" << std::endl;
                              return;
                           }
                        }
                     }
                  } else {
                     std::cerr << "transaction json 'actions' is not an array" << std::endl;
                     return;
                  }
               } else {
                  std::cerr << "transaction json does not include 'actions'" << std::endl;
                  return;
               }
               auto trx = trx_var.as<transaction>();
               transaction_id_type id = trx.id();
               if( id == transaction().id() ) {
                  std::cerr << "file/string does not represent a transaction" << std::endl;
               } else {
                  std::cout << string( id ) << std::endl;
               }
            } else {
               std::cerr << "file/string does not represent a transaction" << std::endl;
            }
         } EOS_RETHROW_EXCEPTIONS(transaction_type_exception, "Fail to parse transaction JSON '${data}'", ("data",trx_to_check))
      });

所以解决方案就是更新对应的代码,或者直接升级版本。