gcc -m32错误/ usr / bin / ld:跳过不兼容

时间:2017-04-11 16:43:40

标签: gcc cross-compiling

我正在尝试为64bit32bit系统编译应用程序。在编译期间,我收到了32bit应用程序的错误:

/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.9/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.9/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.9/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.9/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
collect2: error: ld returned 1 exit status

我已经阅读并发现我需要gcc-multilib所以我尝试安装它:

me@ubuntu:~/bin/c/find-files$ sudo apt-get install gcc-multilib
Reading package lists... Done
Building dependency tree       
Reading state information... Done
gcc-multilib is already the newest version (4:5.3.1-1ubuntu1).
The following packages were automatically installed and are no longer required:
  linux-headers-4.8.0-41 linux-headers-4.8.0-41-generic
  linux-image-4.8.0-36-generic linux-image-4.8.0-41-generic
  linux-image-extra-4.8.0-36-generic linux-image-extra-4.8.0-41-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

它已经安装好了。所以我再看一点,发现我应该导出到lib32目录:

me@ubuntu:~/bin/c/find-files$ export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib32:/usr/lib32:/usr/lib/i386-linux-gnu

试图再次编译,同样的错误。然后我可能会使用g++并安装它的multilib:

me@ubuntu:~/bin/c/find-files$ sudo apt-get install g++-multilib
Reading package lists... Done
Building dependency tree       
Reading state information... Done
g++-multilib is already the newest version (4:5.3.1-1ubuntu1).
The following packages were automatically installed and are no longer required:
  linux-headers-4.8.0-41 linux-headers-4.8.0-41-generic
  linux-image-4.8.0-36-generic linux-image-4.8.0-41-generic
  linux-image-extra-4.8.0-36-generic linux-image-extra-4.8.0-41-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.9/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.9/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.9/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.9/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
collect2: error: ld returned 1 exit status

如何为32bit64bit操作系统交叉编译应用程序?

0 个答案:

没有答案