Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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)

share|improve this question

3 Answers 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.

share|improve this answer
    
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. –  Omnifarious Nov 19 '12 at 21:38

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.

share|improve this answer

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)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.