我已经在 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".
我在google上简单搜索了一些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
在此先感谢您的帮助!