在64位Ubuntu上的32位matlab中的mex文件

时间:2013-02-18 18:33:20

标签: matlab mex gcc4.7

我试图从http://people.cs.uchicago.edu/~rbg/latent/编译对象检测程序,但没有任何运气。

我安装了64位Ubuntu 12.10,32位MATLAB 2012a。我也有gcc编译器

ivan@ubuntu:~$ gcc --version
gcc (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2

这是我得到的错误

EDU>> demo
compiling the code...
Warning: You are using gcc version "4.7.2-2ubuntu1)".  The version
     currently supported with MEX is "4.4.6".
     For a list of currently supported compilers see: 
     http://www.mathworks.com/support/compilers/current_release/

/usr/bin/ld: cannot find crti.o: No such file or directory
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libstdc++.so when       searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libstdc++.a when   searching for -lstdc++
/usr/bin/ld: cannot find -lstdc++
/usr/bin/ld: cannot find -lm
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libgomp.so when  searching for -lgomp
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libgomp.a when searching for -lgomp
/usr/bin/ld: cannot find -lgomp
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
/usr/bin/ld: cannot find -lpthread
/usr/bin/ld: cannot find -lc
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
/usr/bin/ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status

    mex: link of ' "bin/fv_cache.mexglx"' failed.

Warning: Maybe you need to call fv_cache('unlock') first? 
> In fv_compile at 50
  In compile at 48
  In demo at 5 

Warning: You are using gcc version "4.7.2-2ubuntu1)".  The version
     currently supported with MEX is "4.4.6".
     For a list of currently supported compilers see: 
     http://www.mathworks.com/support/compilers/current_release/

/usr/bin/ld: cannot find crti.o: No such file or directory
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libstdc++.a when searching for -lstdc++
/usr/bin/ld: cannot find -lstdc++
/usr/bin/ld: cannot find -lm
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
/usr/bin/ld: cannot find -lpthread
/usr/bin/ld: cannot find -lc
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
/usr/bin/ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status

    mex: link of ' "bin/cascade.mexglx"' failed.

Error using mex (line 206)
Unable to complete successfully.

Error in cascade_compile (line 43)
eval(mexcmd);

Error in compile (line 50)
  cascade_compile(opt, verb);

Error in demo (line 5)
compile;

我怀疑它与缺少的32位库有关。我是unix系统的新手,所以我可能没有包含你需要知道的所有信息。

更新

新错误看起来像

/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libstdc++.a when searching for -lstdc++
/usr/bin/ld: cannot find -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libgomp.so when searching for -lgomp
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libgomp.a when searching for -lgomp
/usr/bin/ld: cannot find -lgomp
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
collect2: error: ld returned 1 exit status

  mex: link of ' "bin/fv_cache.mexglx"' failed.

我试图创建一个符号链接

sudo ln -s /usr/lib/i386-linux-gnu/libc.so.6 /usr/lib/libc.so.6

然而它没有解决问题

1 个答案:

答案 0 :(得分:0)

首先尝试在系统中查找crti

~$ sudo find /usr/ -name crti*
/usr/lib/x86_64-linux-gnu/crti.o
/usr/lib32/crti.o

如果不存在,或者是lib32版本,请安装libc6-dev

~$ sudo apt-get install libc6-dev

如果有,请尝试添加库位置:

LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LIBRARY_PATH 
export LIBRARY_PATH

有关相关问题和帮助,请参阅Ask UbuntuSO中的这些帖子。