如何在Ubuntu上构建SVMstruct Python模块

时间:2015-04-16 14:49:02

标签: python ubuntu gcc glibc eglibc

我从here下载了源代码。当我运行make时,我收到以下错误消息:

make: Entering directory `/home/christopher/SourceCode/svm-python-v204'
cd svm_light; make svm_learn_hideo_noexe
make[1]: Entering directory `/home/christopher/SourceCode/svm-python-v204/svm_light'
make[1]: Nothing to be done for `svm_learn_hideo_noexe'.
make[1]: Leaving directory `/home/christopher/SourceCode/svm-python-v204/svm_light'
cd svm_struct; make svm_struct_noexe
make[1]: Entering directory `/home/christopher/SourceCode/svm-python-v204/svm_struct'
make[1]: Nothing to be done for `svm_struct_noexe'.
make[1]: Leaving directory `/home/christopher/SourceCode/svm-python-v204/svm_struct'
gcc -g -lm svm_struct/svm_struct_learn.o svm_struct_api.o svm_light/svm_hideo.o svm_light/svm_learn.o svm_light/svm_common.o svm_struct/svm_struct_common.o svm_struct/svm_struct_main.o pyobjs/array.o pyobjs/constraints.o pyobjs/default.o pyobjs/document.o pyobjs/kernelparm.o pyobjs/model.o pyobjs/sample.o pyobjs/sparm.o pyobjs/sparse.o pyobjs/structmodel.o pyobjs/svmapi.o -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions -L/usr/lib/python2.7/config-x86_64-linux-gnu -lpython2.7 -lpthread -ldl  -lutil  -o svm_python_learn
/usr/bin/ld: svm_light/svm_common.o: undefined reference to symbol 'exp@@GLIBC_2.2.5'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libm.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [svm_python_learn_hideo] Error 1
make: Leaving directory `/home/christopher/SourceCode/svm-python-v204'
christopher@christopher-laptop:~/SourceCode/svm-python-v204-build$ make -C ./../svm-python-v204
make: Entering directory `/home/christopher/SourceCode/svm-python-v204'
cd svm_light; make svm_learn_hideo_noexe
make[1]: Entering directory `/home/christopher/SourceCode/svm-python-v204/svm_light'
make[1]: Nothing to be done for `svm_learn_hideo_noexe'.
make[1]: Leaving directory `/home/christopher/SourceCode/svm-python-v204/svm_light'
cd svm_struct; make svm_struct_noexe
make[1]: Entering directory `/home/christopher/SourceCode/svm-python-v204/svm_struct'
make[1]: Nothing to be done for `svm_struct_noexe'.
make[1]: Leaving directory `/home/christopher/SourceCode/svm-python-v204/svm_struct'
gcc -g -lm svm_struct/svm_struct_learn.o svm_struct_api.o svm_light/svm_hideo.o svm_light/svm_learn.o svm_light/svm_common.o svm_struct/svm_struct_common.o svm_struct/svm_struct_main.o pyobjs/array.o pyobjs/constraints.o pyobjs/default.o pyobjs/document.o pyobjs/kernelparm.o pyobjs/model.o pyobjs/sample.o pyobjs/sparm.o pyobjs/sparse.o pyobjs/structmodel.o pyobjs/svmapi.o -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions -L/usr/lib/python2.7/config-x86_64-linux-gnu -lpython2.7 -lpthread -ldl  -lutil  -o svm_python_learn
/usr/bin/ld: svm_light/svm_common.o: undefined reference to symbol 'exp@@GLIBC_2.2.5'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libm.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [svm_python_learn_hideo] Error 1
make: Leaving directory `/home/christopher/SourceCode/svm-python-v204'

一切都是“开箱即用”,所以我怀疑这是一个Ubuntu问题。特别是,我怀疑glibc已经过时了

undefined reference to symbol 'exp@@GLIBC_2.2.5'

当我尝试/lib/x86_64-linux-gnu/libc.so.6时,我得到了

GNU C Library (Ubuntu EGLIBC 2.19-0ubuntu6.6) stable release version 2.19

最新版本是2.2.5,但eglibc似乎是Ubuntu用户获得glibc的方式,但没有2.2 branch。我已经尝试了apt-get upgrade,但我仍处于2.19版本。我该怎么做才能解决这个问题?


截至2014年,Debian似乎又回到了glibc。

1 个答案:

答案 0 :(得分:1)

在MakeFile顶部附近添加LIBS=-lm以链接数学库解决了我的问题。