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/ 然后编译 再把文件拷过去
最新评论