1

I try to understand the requirements for developing Linux application running on 64-bit OS (with 64-bit architecture). If the code was written for 32-bits architecture, does it mean that on regular compilation (gcc -m32) it will run on the 64-bit system OS, without any problems ?

Thank you, Ran

ransh
  • 1,589
  • 4
  • 30
  • 56

1 Answers1

2

Yes, it will. The only caveats to this are that you need 32 bit libraries to run the program, and 32 bit development packages to compile it. Most distros provide these and make it simple to install them as well.

Tom Tromey
  • 21,507
  • 2
  • 45
  • 63
  • Hi Tom, Thanks first of all. When I compile with -m64, I understand that compiler does its interpretation for int, long , etc, as part of compilation, but does it also mark somehow the application as 32-bit application (in windows task bar it seems that windows knows if the program is 32-bit or 64-bit) – ransh Feb 19 '15 at 16:01
  • Yes, it's recorded in the ELF. You can use `file` to see whether you have a 32- or 64-bit executable. – Tom Tromey Feb 19 '15 at 16:27
  • Hi Tom, Do you think that compiling source-code in 32-bit OS gcc (on ubuntu 32) for a linux 64-bit OS should work ? From previous answer, I assume it does. Thanks! – ransh Feb 23 '15 at 13:53