Is it possible to compile a 64 bit executable on a 32 bit system under Ubuntu?

半世苍凉 提交于 2019-12-31 05:32:05

问题


And, if it is possible, can you please point me to an example of this? Thanks!


回答1:


What you are looking for is cross compilation. http://en.wikipedia.org/wiki/Cross_compiler#GCC_and_cross_compilation

As Tomas said, you need the libs of the target machine installed and assuming you are using gcc you will need to use the "-b machine" option, and probably a few other options also (man gcc, and spend a lot of time reading!).

This can be a real pain to get right, so i would ask whether it is really necessary?




回答2:


No, it isn't possible because you need specific x86_64 libraries that can't be used in a 32 bit system.

Believe it or not, you can build 32 bit binaries in a 64 bit system.

You should check this https://wiki.archlinux.org/index.php/Arch64_FAQ#Can_I_build_32-bit_packages_for_i686_inside_Arch64.3F and http://www.linuxquestions.org/questions/linux-hardware-18/compiling-64-bit-kernel-in-32-bit-linux-240183/

Is not ubuntu specific, but is similar.



来源:https://stackoverflow.com/questions/4939464/is-it-possible-to-compile-a-64-bit-executable-on-a-32-bit-system-under-ubuntu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!