mysql c connector 编译时出现的错误
使用cmake生成Makefile时出现了这样两句警告,以为是没有问题,直接忽略掉了。警告信息如下:
WARNING: Target "edit" requests linking to directory "/home/leq/tools/install/ncurse/usr/lib". Targets may link only to libraries. CMake is dropping the item.
WARNING: Target "mysql" requests linking to directory "/home/leq/tools/install/ncurse/usr/lib". Targets may link only to libraries. CMake is dropping the item.
执行make 命令时,出错信息如下:
/home/lvenqiang/tools/mysql/mysql-8.0.17/extra/libedit/terminal.c:726: error: undefined reference to 'tgoto'
/home/lvenqiang/tools/mysql/mysql-8.0.17/extra/libedit/terminal.c:1235: error: undefined reference to 'tputs'
/home/lvenqiang/tools/mysql/mysql-8.0.17/extra/libedit/terminal.c:1235: error: undefined reference to 'tputs'
/home/lvenqiang/tools/mysql/mysql-8.0.17/extra/libedit/terminal.c:1235: error: undefined reference to 'tputs'
/home/lvenqiang/tools/mysql/mysql-8.0.17/extra/libedit/terminal.c:893: error: undefined reference to 'tgetent'
/home/lvenqiang/tools/mysql/mysql-8.0.17/extra/libedit/terminal.c:911: error: undefined reference to 'tgetflag'
/home/lvenqiang/tools/mysql/mysql-8.0.17/extra/libedit/terminal.c:912: error: undefined reference to 'tgetflag'
/home/lvenqiang/tools/mysql/mysql-8.0.17/extra/libedit/terminal.c:914: error: undefined reference to 'tgetflag'
/home/lvenqiang/tools/mysql/mysql-8.0.17/extra/libedit/terminal.c:915: error: undefined reference to 'tgetflag'
/home/lvenqiang/tools/mysql/mysql-8.0.17/extra/libedit/terminal.c:920: error: undefined reference to 'tgetnum'
/home/lvenqiang/tools/mysql/mysql-8.0.17/extra/libedit/terminal.c:921: error: undefined reference to 'tgetnum'
/home/lvenqiang/tools/mysql/mysql-8.0.17/extra/libedit/terminal.c:924: error: undefined reference to 'tgetstr'
/home/lvenqiang/tools/mysql/mysql-8.0.17/extra/libedit/terminal.c:572: error: undefined reference to 'tgoto'
/home/lvenqiang/tools/mysql/mysql-8.0.17/extra/libedit/terminal.c:1235: error: undefined reference to 'tputs'
/home/lvenqiang/tools/mysql/mysql-8.0.17/extra/libedit/terminal.c:615: error: undefined reference to 'tgoto'
/home/lvenqiang/tools/mysql/mysql-8.0.17/extra/libedit/terminal.c:576: error: undefined reference to 'tgoto'
/home/lvenqiang/tools/mysql/mysql-8.0.17/extra/libedit/terminal.c:1542: error: undefined reference to 'tgetstr'
最终定位到原因是因为 cmake 命令中有宏定义执行动态库,确错误的指向了动态库路径,导致程序没有连接到库
例子如下:
cmake .. -DCURSES_LIBRARY=/home/lvenqiang/tools/install/ncurse/usr/lib/libncurses.so
被错误的写为
cmake .. -DCURSES_LIBRARY=/home/lvenqiang/tools/install/ncurse/usr/lib/