2

If I am using automake to build a library if there are no specific flags specifying target system will the result be according to the system that the build is happening on? Meaning compiler on 64bit OS will produce 64bit result and 32bit will produce 32bit? (I am using Fedora 16 and g++ compiler)

3 Answers 3

3

I assume that that binary output will be the same as the architecture you are running on....unless flags to change this behavior are present. So, you can verify this by compiling something and then doing a file command on the binary. This will tell you if things are 64 or 32 bit.

1
  • 1
    This can be guaranteed on a sufficiently modern version of gcc with the -march=native and -mtune=native flags. That will actually make an executable that's specifically tuned to the exact CPU you are using on the machine you're compiling on. Nov 19, 2012 at 21:38
0

Yes, unless you've gone out of your way to set it up differently, GCC will compile for your processor's architecture. (The generic architecture, not your specific CPU variant — in your case amd64 a.k.a. x86_64).

In typical installations of 64-bit GCC, pass -m32 to compile for the corresponding 32-bit architecture (e.g. x86 on an amd64 system). Run gcc --print-multi-lib to see what architectures are supported.

0

If the particular project has no explicit or implicit dependencies on libraries that are only 32 bit, then automake will compile a 64 bit executable.

With the abundance of 64 bit systems and re-implementations of things that used to be 32 bit only, this will not happen on a modern system (that is post 2010, including Fedora 16)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .