Targets may link only to libraries.CMake is dropping the item. error: undefined reference to 'tgoto'

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/

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值