lujisen commented on issue #4113: URL: https://github.com/apache/doris/issues/4113#issuecomment-1522887048
starrocks 编译报错信息: opt/starrocks/starrocks-2.5.4/be/src/common/logconfig.cpp: In function ‘bool starrocks::init_glog(const char*, bool)’: /opt/starrocks/starrocks-2.5.4/be/src/common/logconfig.cpp:144:5: error: ‘FLAGS_log_filenum_quota’ was not declared in this scope 144 | FLAGS_log_filenum_quota = config::sys_log_roll_num; | ^~~~~~~~~~~~~~~~~~~~~~~ /opt/starrocks/starrocks-2.5.4/be/src/common/logconfig.cpp:174:9: error: ‘FLAGS_log_split_method’ was not declared in this scope 174 | FLAGS_log_split_method = "day"; | ^~~~~~~~~~~~~~~~~~~~~~ /opt/starrocks/starrocks-2.5.4/be/src/common/logconfig.cpp:177:9: error: ‘FLAGS_log_split_method’ was not declared in this scope 177 | FLAGS_log_split_method = "hour"; | ^~~~~~~~~~~~~~~~~~~~~~ /opt/starrocks/starrocks-2.5.4/be/src/common/logconfig.cpp:180:9: error: ‘FLAGS_log_split_method’ was not declared in this scope 180 | FLAGS_log_split_method = "size"; | ^~~~~~~~~~~~~~~~~~~~~~ make[2]: *** [src/common/CMakeFiles/Common.dir/build.make:118: src/common/CMakeFiles/Common.dir/logconfig.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:649: src/common/CMakeFiles/Common.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... 解决方案: 1、这个报错是由于FLAGS_log_split_method 没有声明,logconfig.cpp文件中其实有很多FLAGS_开头的变量,部分没有声明,修改添加声明即可,这里引用的是Google的glog日志,所以需要在2中先了解下glog的用法和原理; 2、可以参考下这个链接,GFlags使用文档:https://blog.csdn.net/weixin_43778179/article/details/104668113,了解下; 3、logconfig.cpp文件引入#include <glog/logging.h>(本身已经引入的不用再次引入),然后找个starrocks的已安装的第三方库,路径一般为:/opt/starrocks/starrocks-2.5.4/thirdparty/installed/include/glog,这是编译好的,直接修改这个也可以,或者直接修改第三方库的源码中的glog/logging.h文件,重新编译三方库都可以; 4、在很多DECLARE_int32的下方声明上面报错的变量即可,我这里报错的是:FLAGS_log_split_method 和FLAGS_log_split_method ,所以这在文件中添加了两个变量的声明,如下: // add by lujise...@inspur.com DECLARE_int32(log_filenum_quota); DECLARE_string(log_split_method); 详细信息请登录我的CSDN账号查看:[https://blog.csdn.net/lujisen/article/details/130386165?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22130386165%22%2C%22source%22%3A%22lujisen%22%7D](https://blog.csdn.net/lujisen/article/details/130386165?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22130386165%22%2C%22source%22%3A%22lujisen%22%7D) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org