安装QConf 报错及解决方案

本文解决在编译过程中遇到的gdbm相关错误,包括找不到gdbm.h头文件、无效转换类型问题及找不到libgdbm.a文件等,并提供详细步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1:提示找不到gdbm.h头文件

/alidata/QConf/agent/qconf_dump.cc:1:18: fatal error: gdbm.h: No such file or directory
compilation terminated.
agent/CMakeFiles/qconf_agent.dir/build.make:206: recipe for target 'agent/CMakeFiles/qconf_agent.dir/qconf_dump.cc.o' failed
make[2]: *** [agent/CMakeFiles/qconf_agent.dir/qconf_dump.cc.o] Error 1
CMakeFiles/Makefile2:85: recipe for target 'agent/CMakeFiles/qconf_agent.dir/all' failed
make[1]: *** [agent/CMakeFiles/qconf_agent.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

  解决方法:

安装一个gdbm库
$ apt install libgdbm-dev

2  invalid conversion from ‘const char*’ to ‘char*’

QConf/agent/qconf_dump.cc:63:50: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
     _qconf_dbf = gdbm_open(_qconf_dump_file.c_str(), 0, flags, mode, NULL);
                                                  ^
In file included from /root/QConf/agent/qconf_dump.cc:1:0:
/usr/include/gdbm.h:85:18: note:   initializing argument 1 of ‘<anonymous struct>* gdbm_open(char*, int, int, int, void (*)())’

  解决方法:

打开文件 agent/qconf_dump.cc  找到63行

gdbm_open  第一个参数应该是 char* 类型  而 _qconf_dump_file.c_str() 返回的是 const char* 类型  转换一下即可

原来的是:
qconf_dbf = gdbm_open(qconf_dump_file.c_str(), 0, flags, mode, NULL);


改成:
char* cc;
strcpy(cc,_qconf_dump_file.c_str());
qconf_dbf = gdbm_open(cc, 0, flags, mode, NULL);

  

3 提示找不到libgdbm.a文件

make[2]: *** No rule to make target `../agent/../deps/gdbm/_install/lib/libgdbm.a', needed by `agent/qconf_agent'.  Stop.
make[1]: *** [agent/CMakeFiles/qconf_agent.dir/all] Error 2
make: *** [all] Error 2

  解决方法:

去搜索一下系统是否已经有文件
$find / -name "libgdbm.a"

如果能够搜索到 比如我这边就是在
/usr/lib/x86_64-linux-gnu/libgdbm.a

直接复制到  
$cp /usr/lib/x86_64-linux-gnu/libgdbm.a deps/gdbm/_install/lib


如果系统中没有 那么就直接下载:https://ftp.gnu.org/gnu/gdbm/  然后编译 再把文件拷过去

  

 

转载于:https://www.cnblogs.com/wangxusummer/p/8819274.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值