views:

93

answers:

3

Hi All,

I want to build 64bit libraries for some of my C++ components. Is it required to compile/link the libraries in OS running on physical machine directly? Or can i use a OS running as virtual machine in ESX server to build the libraries? Would i need to take care of anything if i am building in a virtual machine? Please advice

I was interested in 32/64bit for linux.

Thanks in advance!

+1  A: 

Depending on the compiler (what are you using?) you might even just need to pass the right options to it and it will compile it wherever you want - even on a 32-bit machine.

Vilx-
I have gcc 2.96 on a 32bit SuSE 7.3 machine. I use it for 32bit. When i tried -m64, it was not recognizing the flag and in another machine it was asking for 64bit system libraries. I thought building 32bit is possible in 64, but not the other way around.
Aviator
+1  A: 

This is a bit platform-specific. For example: on Windows I build the 64-bit binaries on a 32-bit machine (I have the 64-bit compiler installed with VS) and make sure that the correct redistributable pack is available on the target.

dirkgently
I agree. I do the same thing. I was wondering about linux specifically. I will edit the tags.
Aviator
Are you using multilib? See: http://www.airs.com/ian/configure/configure_8.html
dirkgently
No. I am not using it. :(
Aviator
That probably is causing the trouble. Multilib would provide the additional target platform binaries.
dirkgently
Thanks. I will read about it.
Aviator
+2  A: 

If the guest OS is 64-bit and you have a 64-bit compiler, there is not reason why you can't compile and run a 64-bit library/application in your virtualised OS.

alexr
Will it create any problems if we run it in a physical machine later?
Aviator
For all intents and purposes your *are* running on 64-bit hardware when you are running a virtualised 64-bit OS. So the binaries will then run on physical 64-bit hardware.But you should be sure you aren't using a special compiler build that may have hooks into the hypervisor. This is unlikely to happen if you use something like a stock GCC compiler.
alexr
THanks a lot! I am much clear now
Aviator