[英]Building 64bit executables with g++
I build g++3.4.6 on a solaris 10 x86 machine. 我在solaris 10 x86机器上构建g ++ 3.4.6。 using this g++, i tried to build a 64 bit binary using -m64 option
使用这个g ++,我尝试使用-m64选项构建64位二进制文件
g++ -m64 test.cpp -o test.exe
I didn't faced any issue with this. 我没有遇到任何问题。 Then i copied the entire gcc install directory to another solaris machine (identical hardware and OS)(let us call it machine 2).
然后我将整个gcc安装目录复制到另一台solaris机器(相同的硬件和操作系统)(让我们称之为机器2)。 But now if am trying to build a 64 bit binary, i am getting the following error
但是现在如果我试图构建64位二进制文件,我会收到以下错误
test.cpp:1: sorry, unimplemented: 64-bit mode not compiled in
However, when i used another version of g++ compiler(3.4.3) available on machine 2 to build 64 bit binaries, i didn't get any error. 但是,当我在机器2上使用另一个版本的g ++编译器(3.4.3)来构建64位二进制文件时,我没有收到任何错误。 This left me confused as
这让我很困惑
What i need to do with respect to building compiler again or with respect to machine configuration so that i will be able to build 64 bit binaries on machine 2 using g++3.4.6 ? 我需要做什么再次构建编译器或关于机器配置,以便我能够使用g ++ 3.4.6在机器2上构建64位二进制文件?
I think you may need to configure gcc and binutils to have the following options: 我认为您可能需要配置gcc 和 binutils以具有以下选项:
--enable-multilib
--enable-targets=i686-pc-linux-gnu,x86_64-pc-linux-gnu
also you will need both the 32 bit and 64 bit versions of, for example, glibc (not sure about this last bit, but thats the way my linux system is set up and seems ok for 64 bit and 32 bit compilation. 你还需要32位和64位版本,例如glibc(不确定这最后一位,但这就是我的linux系统设置的方式,似乎可以用于64位和32位编译。
These posts are worth a look too (from gcc help) 这些帖子也值得一看(来自gcc帮助)
Feel free to get back to me if you need any more help, will strive to do so. 如果您需要更多帮助,请随时回复我,并努力做到这一点。
Addendum: 附录:
just found these posts too which may help: here 刚发现这些帖子也可能有所帮助: 这里
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.