3
我试图使用64位的32位2012A Matlab来MEX C代码的Ubuntu 12.10符号链接编译使用32位库的代码在64位的Ubuntu 12.10
我已经下载了所有可能的库(GCC 4.7,建立必要的,库-32等),但是我收到以下错误
/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
我发现,这个问题可以通过从64位库设置符号链接到32要解决位的。我试图创建不同的链接,但无法完成编译。
预先感谢您。
更新1
的gcc-multilib的失踪了,所以以后
sudo apt-get install gcc-multilib
我收到以下错误
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: 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++
collect2: error: ld returned 1 exit status
我mexopts.sh看起来像
CC='gcc'
CFLAGS='-ansi -D_GNU_SOURCE'
CFLAGS="$CFLAGS -fPIC -pthread -m32"
CFLAGS="$CFLAGS -fexceptions"
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64"
CLIBS="$RPATH $MLIBS -lm"
COPTIMFLAGS='-O -DNDEBUG'
CDEBUGFLAGS='-g'
CLIBS="$CLIBS -lstdc++"
-m32在那里,但我不确定它是否应该以这种方式写入。 有人可以详细说明如何编辑mexopts.sh使matlab看看32位库吗?看着Linking using g++ fails searching for -lstdc++
后
更新2
我试图安装的g ++ - multilib的
sudo apt-get install g++-multilib
现在,错误的格式如下:
/usr/bin/ld: i386:x86-64 architecture of input file `bin/fv_cache.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `bin/obj_func.o' is incompatible with i386 output
...
您可以通过在命令行上执行gcc(使用-m32选项?)和一些虚拟.c代码来构建32位可执行文件吗? – durasm 2013-02-19 21:40:43
我刚刚尝试过 - 因为缺少gcc 4.7-multilib,所以无法启动。感谢您指出了这一点! – Gnattuha 2013-02-20 14:16:53