1:提示找不到gdbm.h
頭文件linux
/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
解決方法:bash
安裝一個gdbm庫 $ apt install libgdbm-dev
2 invalid conversion from ‘const char*’ to ‘char*’ui
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 (*)())’
解決方法:spa
打開文件 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
文件code
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
解決方法:blog
去搜索一下系統是否已經有文件 $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/ 而後編譯 再把文件拷過去