求助:Make时出错,undefined reference to 'sqrt‘,加入-lm后,make check出错

amanut 2011-10-21 08:06:13
我在安装别人的一个工具时,安装INSTALL说明把它依赖的库都装好了,然后
./configre 后,运行 make,出现:

gcc -Wall -O3 -o scopy scopy.o gggetopt.o -lm -L. -lspro -L/usr/local/nist/lib -lsp -lutil
./libspro.a(misc.o): In function `spf_buf_normalize':
misc.c:(.text+0xa9d): undefined reference to `sqrt'
misc.c:(.text+0xae1): undefined reference to `sqrt'
./libspro.a(misc.o): In function `set_lifter':
misc.c:(.text+0xe75): undefined reference to `sin'
./libspro.a(misc.o): In function `sig_normalize':
misc.c:(.text+0x1030): undefined reference to `sqrt'
./libspro.a(misc.o): In function `set_sig_win':
misc.c:(.text+0x10e2): undefined reference to `cos'
misc.c:(.text+0x11bb): undefined reference to `cos'
misc.c:(.text+0x11da): undefined reference to `cos'
misc.c:(.text+0x12b2): undefined reference to `cos'
collect2: ld 返回 1

然后,1. 可以修改Makefile,在LDADO后面加 -lm
原来的:LDADD = -lm -L. -lspro -L/usr/local/nist/lib -lsp -lutil
加-lm后:LDADD = -lm -L. -lspro -L/usr/local/nist/lib -lsp -lutil -lm
可以make成功
2.或者在每一次都报错的是是,用gcc 在编译一下,即在后面加-lm

结果是,编译成功,但是make check出错。install后,别的函数调用这个库时,依然出现上面的undefined reference to sqrt等错误。。。


求指教啊。。。。
...全文
537 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
amanut 2011-10-23
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 delphiwcdj 的回复:]

原来的不是已经加过了吗
[/Quote]

问题是原来已经有,但是不知道为何还是出错;如果在后面加上 -lm,就可以通过了
xunxun 2011-10-23
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 amanut 的回复:]

make install后,安装另一个包时,需要用到这库,然后出现如下错误

gcc -g -O2 -o spfcat spfcat.o script.o getopt.o getopt1.o -L. -laudioseg -lm -lspro -L/usr/local/nist/lib -lsp -lutil
/usr/local/lib/libspro.a(misc.o): ……
[/Quote]
你是说,install的时候会执行这个?
那么就改他makefile的install部分,在-lspro的后面加上-lm,要注意顺序
xunxun 2011-10-23
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 amanut 的回复:]

引用 2 楼 xunxun1982 的回复:

make check时是啥错?

install后别的函数调用时你加-lm了么


make[3]: 正在进入目录 `/home/ywang/SpeechA/spro-5.0/test'
checking scopy:
build test passed
copy test failed (see test/log/sc……
[/Quote]
那得看你makefile的check部分是啥,为什么错,具体命令行是什么
amanut 2011-10-22
  • 打赏
  • 举报
回复
make install后,安装另一个包时,需要用到这库,然后出现如下错误

gcc -g -O2 -o spfcat spfcat.o script.o getopt.o getopt1.o -L. -laudioseg -lm -lspro -L/usr/local/nist/lib -lsp -lutil
/usr/local/lib/libspro.a(misc.o): In function `spf_buf_normalize':
misc.c:(.text+0xa9d): undefined reference to `sqrt'
misc.c:(.text+0xae1): undefined reference to `sqrt'
/usr/local/lib/libspro.a(misc.o): In function `set_lifter':
misc.c:(.text+0xe75): undefined reference to `sin'
/usr/local/lib/libspro.a(misc.o): In function `sig_normalize':
amanut 2011-10-22
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 xunxun1982 的回复:]

make check时是啥错?

install后别的函数调用时你加-lm了么
[/Quote]

make[3]: 正在进入目录 `/home/ywang/SpeechA/spro-5.0/test'
checking scopy:
build test passed
copy test failed (see test/log/scopy.stderr for details)
FAIL: copy.sh
checking sfbank:
build test passed
run test failed (see test/log/sfbank.stderr for details)
FAIL: bank.sh
checking sfbcep:
build test passed
run test failed (see test/log/sfbcep.stderr for details)
FAIL: fbcep.sh
checking slpc:
build test passed
run test failed (see test/log/slpc.stderr for details)
FAIL: lpc.sh
checking slpcep:
build test passed
run test failed (see test/log/slpcep.stderr for details)
FAIL: lpcep.sh
checking splp:
build test passed
run test failed (see test/log/splp.stderr for details)
FAIL: plp.sh
===================
6 of 6 tests failed

xunxun 2011-10-21
  • 打赏
  • 举报
回复
make check时是啥错?

install后别的函数调用时你加-lm了么
delphiwcdj 2011-10-21
  • 打赏
  • 举报
回复
原来的不是已经加过了吗

23,116

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 应用程序开发区
社区管理员
  • 应用程序开发区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧