链接器错误,编译库时对LAPACK子例程的未定义引用(CMU sphinx3)

时间:2013-08-04 13:01:41

标签: static-linking lapack cmusphinx

我在尝试编译cmu sphinx toolkit

的sphinx3模块时遇到以下错误消息
Making all in programs
make[2]: Entering directory `/cygdrive/c/Downloads/src/cmusphinx-code/sphinx3/src/programs'
/bin/sh ../../libtool --tag=CC    --mode=link gcc  -g -O2 -Wall -fvisibility=hidden    -o sphinx3_decode.exe main_decode.o ../../src/libs3decoder/libs3decoder.la  -lsphinxbase -lsphinxad -lm 
libtool: link: gcc -g -O2 -Wall -fvisibility=hidden -o .libs/sphinx3_decode.exe main_decode.o  ../../src/libs3decoder/.libs/libs3decoder.a -lsphinxbase -lsphinxad
/usr/local/lib/libsphinxbase.a(matrix.o): In function `determinant':
/cygdrive/c/Downloads/src/cmusphinx-code/sphinxbase/src/libsphinxbase/util/matrix.c:196: undefined reference to `_spotrf_'
/usr/local/lib/libsphinxbase.a(matrix.o): In function `solve':
/cygdrive/c/Downloads/src/cmusphinx-code/sphinxbase/src/libsphinxbase/util/matrix.c:226: undefined reference to `_sposv_'
/usr/local/lib/libsphinxbase.a(matrix.o): In function `invert':
/cygdrive/c/Downloads/src/cmusphinx-code/sphinxbase/src/libsphinxbase/util/matrix.c:254: undefined reference to `_sposv_'
/usr/local/lib/libsphinxbase.a(matrix.o): In function `matrixmultiply':
/cygdrive/c/Downloads/src/cmusphinx-code/sphinxbase/src/libsphinxbase/util/matrix.c:272: undefined reference to `_ssymm_'
collect2: ld returned 1 exit status
Makefile:420: recipe for target `sphinx3_decode.exe' failed
make[2]: *** [sphinx3_decode.exe] Error 1
make[2]: Leaving directory `/cygdrive/c/Downloads/src/cmusphinx-code/sphinx3/src/programs'
Makefile:284: recipe for target `all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/cygdrive/c/Downloads/src/cmusphinx-code/sphinx3/src'
Makefile:407: recipe for target `all-recursive' failed
make: *** [all-recursive] Error 1

问题似乎不是找不到cmu sphinx库liblsphinxbase.a。相反,该库存在问题。我在这个库上运行nm命令,这是所有我得到的(似乎是空的)。

nm libsphinxbase.a | grep _spotrf_
U _spotrf_

是否应将标记-llapack添加到链接步骤?

1 个答案:

答案 0 :(得分:0)

我用llapack测试了失败的步骤,但它确实有效。似乎需要将-llapack添加到链接命令中。