Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gcc: Compile a 64-bit binary on 32-bit platform

Tags:

Is it possible to compile a 64-bit binary on a 32-bit Linux platform using gcc?

like image 748
weekens Avatar asked Sep 28 '11 11:09

weekens


People also ask

How do I compile 64-bit gcc?

Just type the following command on Linux terminal. Command: gcc -v Output Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper Target: x86_64-linux-gnu ...................... ......................

Is gcc 32 or 64-bit?

Compile 32-bit program on 64-bit gcc in C and C++ Nowadays the compiler comes with default 64-bit version. Sometimes we need to compile and execute a code into some 32bit system. In that time, we have to use thisS feature. At first, we Shave to check the current target version of the gcc compiler.

Is gcc 32-bit compiler?

The -m32 flag tells GCC to compile in 32-bit mode.

What is difference between G ++ and gcc?

DIFFERENCE BETWEEN g++ & gccg++ is used to compile C++ program. gcc is used to compile C program.


1 Answers

If you have a multilib GCC installed, it's as simple as adding -m64 to the commandline. The compiler should complain if it is not built with multilib support.

In order to link, you'll need all the 64-bit counterparts of the standard libraries. If your distro has a multilib GCC, these should also be in the repositories.

like image 186
rubenvb Avatar answered Oct 12 '22 20:10

rubenvb