File is not of required architecture

Jan Gustafsson jan.gustafsson at
Wed Nov 18 21:17:08 CET 2009


First, thanks for your tips. I have been trying to

 1.  compile my application as a 64 bit application
 2.  compile GMP in 32 bit mode (using gmp-4.3.1.tar.bz2)

Both have failed :(. In case 1, ld complained (warning: file is not of required architecture). In case 2. I couldn't get GMP to compile with 32 bits. I have been playing around with the -arch, m32/64 and ABI options.

At some point I decided to upgrade the standard Apple gcc (4.0.1) to gcc 4.2, which I installed using MacPorts. The nice thing was that MacPorts also installed gmp 4.3.1. And the libs installed by MacPorts link perfectly with my application.

So, problem is solved.

Kind regards,

Jan G

Den 2009-11-13 22.34, skrev "Hans Aberg" <haberg at>:

On 13 Nov 2009, at 21:41, Torbjorn Granlund wrote:

>>  When I try to link with my program, I get
>>  warning: file is not of required architecture
>>  Can you advise?

> My only feeble guess is that there is an ABI clash.  Apple's various
> compiler releases default to different ABIs, but GMP tries to use the
> fastest one, which is typically invoked by passing -m64.  You need the
> same ABI for your program.

Yes, the error means that one tries to link code of different
architectures. On 10.5, gcc defaults to 32-bit, and on 10.6 to 64-bit.


More information about the gmp-bugs mailing list