My team recently worked on JNI, so we ran into various problems regarding 32-bit and 64-bit architectures. Take an example ( temp.c ).
#include <stdio.h> void main(){ printf("long=%d\n",sizeof(long)); }
Is there a difference between gcc_32_bit temp.c and gcc_64_bit -m32 temp.c ?
Verified cases:
Case-1: compiled on 64-bit ubuntu using gcc temp.c Conclusion: long=8 on 64-bit ubuntu.
Case-2: compiled on 64-bit ubuntu using gcc -m32 temp.c Conclusion: long=4 on 64-bit ubuntu.
Code-3: compiled on a 64-bit MAC address (a 64-bit cross-compiler is used ) using /usr/local/gcc-4.8.1-for-linux64/bin/x86_64-pc-linux-gcc temp.c . Conclusion: long=8 on 64-bit ubuntu.
Code 4: compiled on a 64-bit MAC ( 32-bit cross-compiler used ) using /usr/local/gcc-4.8.1-for-linux32/bin/i586-pc-linux-gcc temp.c Conclusion: Error: cannot run on 64-bit ubuntu.
We use the MAC cross compiler because we do not have a 32-bit Linux machine.
source share