编译Licode报错:ifndef header guard has wrong style

在编译licode项目的erizoAPI模块时遇到头文件风格错误,原因是未正确设置--root参数导致cpplint.py无法识别目录。通过指定包含.git目录的路径作为--root参数,成功解决了编译问题。

编译licode git上的master的时候,一切都很顺利,但下载release中的压缩包,解压并编译,当编译到erizoAPI的时候却报了很多相同的错误,都是说头文件的风格不对,错误如下:

MediaStream.h:2:  #ifndef header guard has wrong style, please use: _HOME_TOPSLUO_WORKSPACE_TEST_LICODE_PRE_V7_14_ERIZOAPI_MEDIASTREAM_H_  [build/header_guard]

后来通过查找编译脚本发现,在cpplint.py中找到一个参数:

--root=subdir
  The root directory used for deriving header guard CPP variable.
   By default, the header guard CPP variable is calculated as the relative path
    to teh directory that contains .git, .hg, or .svn, When this flag is specified, the relative 
    path is calculated from the specified directory. If the specified directory does not exist, 
    this flag is ignored.
    Examples:
    No flag => CHROME_BROWSER_UI_BROWSER_H_
    --root=chrome => BROWSER_UI_BROWSER_H_
    --root=chrome/browser => UI_BROWSER_H_

也就是说,如果当前目录下存在.git或者.svn等目录,root参数是会计算出来参数,否则–root参会被忽略掉,那就会出现开头说的错误。

问题正是如此,因为从master中clone下来的源码存在.git目录,而解压压缩包的源码中不存在.git目录,所以在调用cpplint.py的时候,可以指定–root参数来解决此问题,比如:

./cpplint.py --filter=-legal.copyright,-build/include --root=/home/topsluo/licode --linelength=120 *.cc *.h
make[6]: Entering directory '/home/wuyilun/Desktop/NVMP/NVMP/nvmp/build_dir/host/e2fsprogs-1.42.4/lib/quota' CC mkquota.c In file included from mkquota.c:22: mkquota.c: In function 'quota_write_inode': common.h:17:5: warning: too many arguments for format [-Wformat-extra-args] 17 | "[ERROR] %s:%d:%s:: " format "\n", \ | ^~~~~~~~~~~~~~~~~~~~~ mkquota.c:133:3: note: in expansion of macro 'log_err' 133 | log_err("Unable to allocate quota handle", ""); | ^~~~~~~ common.h:17:5: warning: too many arguments for format [-Wformat-extra-args] 17 | "[ERROR] %s:%d:%s:: " format "\n", \ | ^~~~~~~~~~~~~~~~~~~~~ mkquota.c:149:4: note: in expansion of macro 'log_err' 149 | log_err("Cannot initialize io on quotafile", ""); | ^~~~~~~ mkquota.c: In function 'quota_init_context': common.h:17:5: warning: too many arguments for format [-Wformat-extra-args] 17 | "[ERROR] %s:%d:%s:: " format "\n", \ | ^~~~~~~~~~~~~~~~~~~~~ mkquota.c:219:3: note: in expansion of macro 'log_err' 219 | log_err("Failed to allocate quota context", ""); | ^~~~~~~ common.h:17:5: warning: too many arguments for format [-Wformat-extra-args] 17 | "[ERROR] %s:%d:%s:: " format "\n", \ | ^~~~~~~~~~~~~~~~~~~~~ mkquota.c:229:4: note: in expansion of macro 'log_err' 229 | log_err("Failed to allocate dictionary", ""); | ^~~~~~~ mkquota.c: In function 'get_dq': common.h:17:5: warning: too many arguments for format [-Wformat-extra-args] 17 | "[ERROR] %s:%d:%s:: " format "\n", \ | ^~~~~~~~~~~~~~~~~~~~~ mkquota.c:274:4: note: in expansion of macro 'log_err' 274 | log_err("Unable to allocate dquot", ""); | ^~~~~~~ mkquota.c: In function 'scan_dquots_callback': common.h:17:5: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 7 has type 'qsize_t' {aka 'long int'} [-Wformat=] 17 | "[ERROR] %s:%d:%s:: " format "\n", \ | ^~~~~~~~~~~~~~~~~~~~~ mkquota.c:421:3: note: in expansion of macro 'log_err' 421 | log_err("Usage inconsistent for ID %d: (%llu, %llu) != " | ^~~~~~~ mkquota.c:421:46: note: format string is defined here 421 | log_err("Usage inconsistent for ID %d: (%llu, %llu) != " | ~~~^ | | | long long unsigned int | %lu In file included from mkquota.c:22: common.h:17:5: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 8 has type 'qsize_t' {aka 'long int'} [-Wformat=] 17 | "[ERROR] %s:%d:%s:: " format "\n", \ | ^~~~~~~~~~~~~~~~~~~~~ mkquota.c:421:3: note: in expansion of macro 'log_err' 421 | log_err("Usage inconsistent for ID %d: (%llu, %llu) != " | ^~~~~~~ mkquota.c:421:52: note: format string is defined here 421 | log_err("Usage inconsistent for ID %d: (%llu, %llu) != " | ~~~^ | | | long long unsigned int | %lu In file included from mkquota.c:22: common.h:17:5: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 9 has type 'qsize_t' {aka 'long int'} [-Wformat=] 17 | "[ERROR] %s:%d:%s:: " format "\n", \ | ^~~~~~~~~~~~~~~~~~~~~ mkquota.c:421:3: note: in expansion of macro 'log_err' 421 | log_err("Usage inconsistent for ID %d: (%llu, %llu) != " | ^~~~~~~ mkquota.c:422:9: note: format string is defined here 422 | "(%llu, %llu)", dq->dq_id, dq->dq_dqb.dqb_curspace, | ~~~^ | | | long long unsigned int | %lu In file included from mkquota.c:22: common.h:17:5: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 10 has type 'qsize_t' {aka 'long int'} [-Wformat=] 17 | "[ERROR] %s:%d:%s:: " format "\n", \ | ^~~~~~~~~~~~~~~~~~~~~ mkquota.c:421:3: note: in expansion of macro 'log_err' 421 | log_err("Usage inconsistent for ID %d: (%llu, %llu) != " | ^~~~~~~ mkquota.c:422:15: note: format string is defined here 422 | "(%llu, %llu)", dq->dq_id, dq->dq_dqb.dqb_curspace, | ~~~^ | | | long long unsigned int | %lu In file included from mkquota.c:22: mkquota.c: In function 'quota_update_inode': common.h:17:5: warning: too many arguments for format [-Wformat-extra-args] 17 | "[ERROR] %s:%d:%s:: " format "\n", \ | ^~~~~~~~~~~~~~~~~~~~~ mkquota.c:488:3: note: in expansion of macro 'log_err' 488 | log_err("Unable to allocate quota handle", ""); | ^~~~~~~ common.h:17:5: warning: too many arguments for format [-Wformat-extra-args] 17 | "[ERROR] %s:%d:%s:: " format "\n", \ | ^~~~~~~~~~~~~~~~~~~~~ mkquota.c:494:3: note: in expansion of macro 'log_err' 494 | log_err("Open quota file failed", ""); | ^~~~~~~ mkquota.c: In function 'quota_compare_and_update': common.h:17:5: warning: too many arguments for format [-Wformat-extra-args] 17 | "[ERROR] %s:%d:%s:: " format "\n", \ | ^~~~~~~~~~~~~~~~~~~~~ mkquota.c:534:3: note: in expansion of macro 'log_err' 534 | log_err("Open quota file failed", ""); | ^~~~~~~ common.h:17:5: warning: too many arguments for format [-Wformat-extra-args] 17 | "[ERROR] %s:%d:%s:: " format "\n", \ | ^~~~~~~~~~~~~~~~~~~~~ mkquota.c:544:3: note: in expansion of macro 'log_err' 544 | log_err("Error scanning dquots", ""); | ^~~~~~~ CC quotaio.c In file included from quotaio.c:21: quotaio.h:19: warning: "MAXQUOTAS" redefined 19 | #define MAXQUOTAS 2 | In file included from /usr/include/x86_64-linux-gnu/sys/quota.h:57, from quotaio.c:18: /usr/include/linux/quota.h:40: note: this is the location of the previous definition 40 | #define MAXQUOTAS 3 | In file included from quotaio.c:20: quotaio.c: In function 'quota_file_open': common.h:17:5: warning: too many arguments for format [-Wformat-extra-args] 17 | "[ERROR] %s:%d:%s:: " format "\n", \ | ^~~~~~~~~~~~~~~~~~~~~ quotaio.c:245:3: note: in expansion of macro 'log_err' 245 | log_err("qh_ops->check_file failed", ""); | ^~~~~~~ common.h:17:5: warning: too many arguments for format [-Wformat-extra-args] 17 | "[ERROR] %s:%d:%s:: " format "\n", \ | ^~~~~~~~~~~~~~~~~~~~~ quotaio.c:251:3: note: in expansion of macro 'log_err' 251 | log_err("qh_ops->init_io failed", ""); | ^~~~~~~ quotaio.c: In function 'quota_inode_init_new': common.h:17:5: warning: too many arguments for format [-Wformat-extra-args] 17 | "[ERROR] %s:%d:%s:: " format "\n", \ | ^~~~~~~~~~~~~~~~~~~~~ quotaio.c:266:3: note: in expansion of macro 'log_err' 266 | log_err("ex2fs_read_inode failed", ""); | ^~~~~~~ quotaio.c: In function 'quota_file_create': common.h:17:5: warning: too many arguments for format [-Wformat-extra-args] 17 | "[ERROR] %s:%d:%s:: " format "\n", \ | ^~~~~~~~~~~~~~~~~~~~~ quotaio.c:318:3: note: in expansion of macro 'log_err' 318 | log_err("init_new_quota_inode failed", ""); | ^~~~~~~ common.h:17:5: warning: too many arguments for format [-Wformat-extra-args] 17 | "[ERROR] %s:%d:%s:: " format "\n", \ | ^~~~~~~~~~~~~~~~~~~~~ quotaio.c:341:3: note: in expansion of macro 'log_err' 341 | log_err("qh_ops->new_io failed", ""); | ^~~~~~~ quotaio.c: In function 'get_empty_dquot': common.h:17:5: warning: too many arguments for format [-Wformat-extra-args] 17 | "[ERROR] %s:%d:%s:: " format "\n", \ | ^~~~~~~~~~~~~~~~~~~~~ quotaio.c:388:3: note: in expansion of macro 'log_err' 388 | log_err("Failed to allocate dquot", ""); | ^~~~~~~ CC quotaio_v2.c In file included from quotaio_v2.c:15: quotaio_v2.c: In function 'v2_check_file': common.h:17:5: warning: too many arguments for format [-Wformat-extra-args] 17 | "[ERROR] %s:%d:%s:: " format "\n", \ | ^~~~~~~~~~~~~~~~~~~~~ quotaio_v2.c:163:4: note: in expansion of macro 'log_err' 163 | log_err("Your quota file is stored in wrong " | ^~~~~~~ quotaio_v2.c: In function 'v2_report': common.h:17:5: warning: too many arguments for format [-Wformat-extra-args] 17 | "[ERROR] %s:%d:%s:: " format "\n", \ | ^~~~~~~~~~~~~~~~~~~~~ quotaio_v2.c:282:2: note: in expansion of macro 'log_err' 282 | log_err("Not Implemented.", ""); | ^~~~~~~ CC quotaio_tree.c In file included from quotaio_tree.c:15: quotaio_tree.c: In function 'getdqbuf': common.h:17:5: warning: too many arguments for format [-Wformat-extra-args] 17 | "[ERROR] %s:%d:%s:: " format "\n", \ | ^~~~~~~~~~~~~~~~~~~~~ quotaio_tree.c:27:3: note: in expansion of macro 'log_err' 27 | log_err("Failed to allocate dqbuf", ""); | ^~~~~~~ quotaio_tree.c: In function 'get_free_dqblk': common.h:17:5: warning: too many arguments for format [-Wformat-extra-args] 17 | "[ERROR] %s:%d:%s:: " format "\n", \ | ^~~~~~~~~~~~~~~~~~~~~ quotaio_tree.c:103:4: note: in expansion of macro 'log_err' 103 | log_err("Cannot allocate new quota block " | ^~~~~~~ quotaio_tree.c: In function 'find_free_dqentry': common.h:17:5: warning: too many arguments for format [-Wformat-extra-args] 17 | "[ERROR] %s:%d:%s:: " format "\n", \ | ^~~~~~~~~~~~~~~~~~~~~ quotaio_tree.c:233:3: note: in expansion of macro 'log_err' 233 | log_err("find_free_dqentry(): Data block full but it " | ^~~~~~~ CC ../../e2fsck/dict.c GEN_LIB libquota.a CONFIG.STATUS quota.pc
08-19
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值