incubator-pegasus icon indicating copy to clipboard operation
incubator-pegasus copied to clipboard

GCC 8.3.1编译错误

Open JiajieSun opened this issue 5 years ago • 6 comments

gcc8.3.1检查更加严格,导致编译出现了一些错误。请看下是否需要修正

[root@localhost pegasus]# gcc -v gcc version 8.3.1 20190311 (Red Hat 8.3.1-3) (GCC)

  1. Rdsn部分 1.1 ./rdsn/include/dsn/utility/time_utils.h sprintf(str, "%04u-%02u-%02u %02u:%02u:%02u.%03u", static_cast<uint32_t>((ret->tm_year + 1900) % 10000), static_cast<uint32_t>((ret->tm_mon + 1) % 100), static_cast<uint32_t>(ret->tm_mday % 100), static_cast<uint32_t>(ret->tm_hour % 100), static_cast<uint32_t>(ret->tm_min % 100), static_cast<uint32_t>(ret->tm_sec % 100), static_cast<uint32_t>(ts_ms % 1000));

1.2 ./rdsn/src/dist/replication/meta_server/meta_split_service.cpp “zauto_write_lock(app_lock()); -> "zauto_write_lock l(app_lock());"

1.3 ./rdsn/src/core/core/rpc_message.cpp "memset(msg->header, 0, sizeof(message_header));" -> "memset(static_cast<void *>(msg->header), 0, sizeof(message_header));"

  1. Third Party部分,有些最新的repo已经修正了8.3.1的错误,比如说rapidjson。下面列取了有编译问题的文件 2.1 ./rdsn/thirdparty/src/zookeeper-3.4.10/src/c/src/zookeeper.c, "static char buf[128];" -> "static char buf[512];"

2.2 ./rdsn/thirdparty/output/include/s2/util/coding/coder.h "std::memset(array, 0, num_decoders * sizeof(Decoder));" -> "std::memset(static_cast<void *>array, 0, num_decoders * sizeof(Decoder));"

2.3 ./rdsn/thirdparty/output/include/rapidjson/document.h "std::memcpy(e, values, count * sizeof(GenericValue));" -> "std::memcpy(static_cast<void*>(e), values, count * sizeof(GenericValue));" "std::memcpy(m, members, count * sizeof(Member));" -> "std::memcpy(static_cast<void*>(m), members, count * sizeof(Member));"

  1. 此外moodycamel的新版本的namespace发生了变化, ./rdsn/src/core/tools/hpc/hpc_task_queue.h "moodycamel::details::mpmc_sema::LightweightSemaphore _sema;" -> "moodycamel::LightweightSemaphore _sema;"

JiajieSun avatar May 21 '20 13:05 JiajieSun

@JiajieSun 感谢提出问题! 其中

此外moodycamel的新版本的namespace发生了变化, ./rdsn/src/core/tools/hpc/hpc_task_queue.h "moodycamel::details::mpmc_sema::LightweightSemaphore _sema;" -> "moodycamel::LightweightSemaphore _sema;"

已经修复了https://github.com/XiaoMi/rdsn/pull/468 其他问题可以帮忙修复下吗?欢迎贡献代码

acelyc111 avatar May 21 '20 14:05 acelyc111

请教一下,代码提交之前需要跑哪些测试,以确保基本的质量?

JiajieSun avatar May 22 '20 01:05 JiajieSun

请教一下,代码提交之前需要跑哪些测试,以确保基本的质量?

  • Run ./scripts/format_files.sh if you modified any codes in Pegasus
  • Run ./rdsn/scripts/linux/run-clang-format.sh in rDSN if any
  • Run ./run.sh test to pass CI locally. We use travis-ci also.

neverchanje avatar May 22 '20 03:05 neverchanje

第三方库似乎都维护在小米购买的阿里云上,所以我应该无法修复第三方库连接问题(除非重新指回官方第三方库)。还请小米的小伙伴帮忙修复下这些问题,谢谢。 :)

比如说ZK,注释是从apache下载: zookeeper c client from: http://ftp.jaist.ac.jp/pub/apache/zookeeper/zookeeper-3.4.10/zookeeper-3.4.10.tar.gz

实际下载地址: http://pegasus-thirdparties.oss-cn-beijing.aliyuncs.com/zookeeper-3.4.10.tar.gz

JiajieSun avatar May 25 '20 06:05 JiajieSun

我们这么做主要是为了加速第三方包的下载速度,有些包在国内从官网下载太慢了。 @JiajieSun 可以说下需要更新的包的官方链接,我们先传到阿里云。

acelyc111 avatar May 26 '20 04:05 acelyc111

建议在run.sh build里面加一个选项,可以选择是用官方下载路径,还是阿里云下载路径

qinzuoyan avatar May 26 '20 06:05 qinzuoyan

The master branch will be built everyday on various of plats including gcc 7.5.0, 9.4.0, I guess the build failure has been fixed on gcc 8.3.1.

I'll close this issue, you can reopen it if you find the master branch build it failed, thanks.

acelyc111 avatar May 16 '23 16:05 acelyc111