次のコマンドでmatlab用のmexを作成して、Linux(archlinux)でvlfeatをコンパイルしました
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 のメイクファイルに、openmp をオフにするオプションがあることに気付きました。
# DISABLE_OPENMP=yes
「はい」に設定し、単純なコードをコンパイルして実行します。上記のすべてがエラーなしで実行できるようになりました。
しかし、オプションを「いいえ」のままにしておくと、何が問題なのか知りたいです。メイクファイルのコメントには次のように書かれています:
# 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はすべて正常にインストールされているようです。以下を参照してください。結果は次のとおりです。
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
よろしくお願いします。