我已经在linux(archlinux)上编译了vlfeat,并通过以下命令为matlab编写了mex
make MEX=MATLABROOT/bin/mex
在VLFEATROOT目录中。输出似乎没有报告错误。顺便说一句,我使用gcc4.7编译上面的内容。
我在matlab中执行非常简单的代码:
VLFEATROOT = '~/user-libs/vlfeat/vlfeat-0.9.19/';
path_vlfeat = [VLFEATROOT 'toolbox/vl_setup'];
run(path_vlfeat);
vl_version;
matlab报告以下红线:
Invalid MEX-file '/home/bingqingqu/user-libs/vlfeat/vlfeat-0.9.19/toolbox/mex/mexa64/vl_version.mexa64':
/home/bingqingqu/user-libs/vlfeat/vlfeat-0.9.19/toolbox/mex/mexa64/libvl.so: undefined symbol: GOMP_parallel
我对openmp了解不多,但似乎与此有关。我注意到在vlfeat的makefile中有一个关闭openmp的选项:
# DISABLE_OPENMP=yes
我将其设置为“是”,编译并运行简单代码。上面的所有内容现在都可以毫无错误地执行。
但是如果我把选项留给否,我想知道是什么问题。 makefile评论说:
# If defined to anything other than "no", the following falgs disable
# specific features in the library. By defaults, all the features are
# enabled. If the makefile finds that the environment is unable to
# support some of them, it may decide to disable them automatically
# (in this case it will print a message). This behaviour can be
# overriden by defining the flag to be "no".
我在谷歌上简要搜索一些openmp知识,似乎所有我的openmp或gomp都安装得很好。见下文: ldconfig -p | grep gomp 结果是:
libgomp.so.1 (libc6,x86-64) => /usr/lib/libgomp.so.1
libgomp.so.1 (libc6) => /usr/lib32/libgomp.so.1
libgomp.so (libc6,x86-64) => /usr/lib/libgomp.so
libgomp.so (libc6) => /usr/lib32/libgomp.so
提前感谢您的帮助!