# need help understanding binary incompatibility

## commander-keen

Well as the title states...

maybe you can help me understand the following observation:

I am using one installation of amd64 Gentoo on three machines. Lets call them A,B,C. The installations are (apart from kernels and some machine specific files like fstab, etc...) absolutely identical.

However in some rare cases machine C fails to execute binaries working well on A and B. For instance the when I want to build an android project (thus using the Android SDK) on machine C I get:

```
/opt/android-sdk-linux/build-tools/23.0.2/aapt: cannot execute binary file
```

(The same scenario works flawlessly on A and B)

What I don't get here is: A, B, and C have altogether x86 compatible CPUs and as far as I can tell even share the exact same instruction set extensions.

I looked up the models in /proc/cpuinfo:

CPU in B:    Intel(R) Core(TM)2 Duo CPU     P7550  @ 2.26GHz

CPU in C:    Intel(R) Core(TM)2 Duo CPU     T9600  @ 2.80GHz

According to the datasheets I found here http://www.cpu-world.com/sspec/SL/SLG9F.html and here http://www.cpu-upgrade.com/CPUs/Intel/Core_2_Duo_Mobile/P7550.html both use the following extensions:

MMX

SSE

SSE2

SSE3

SSSE3

SSE4.1

How can a binary then be compatible to one CPU but not to the other?

I'm aware that, whenever I compile a program I can specify the cpu flags in make.conf, here is my current selection:

CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 sse4_1 ssse3"

However if I remember correctly the android sdk (or at least parts of it) were provided as a binaries. I'd be happy if there were a way to make android devs on machine C...

Any help is appreciated!

----------

## eccerr0r

There's a difference between "Cannot execute binary file" and "Illegal Instruction"

Usually "Cannot execute binary" comes from when the architecture is wrong (amd64 vs x86 vs armel vs mipsbe vs sparc, etc).  Illegal Instruction usually happens when the processor needs to run an instruction (mmx, sse, etc.) that it can't run.

----------

## NeddySeagoon

commander-keen,

When I try to run grub, I get

```
# grub

-su: /sbin/grub: cannot execute binary file: Exec format error
```

My AMD64 kernel does not support 32 bit executable files.

You mention the boxes differ by kernel.  The above is caused by 

```
# CONFIG_IA32_EMULATION is not set
```

That's a deliberate choice.  I can't think why I would want to run any 32 bit code after grub is installed and working.

Check your kernel. I suspect that the Android SDK is 32 bit only.

----------

## commander-keen

And you are absolutely right... just checked the kernel configs. Indeed on machine B I have IA32_EMULATION enabled and on machine C not.

You truly impressed me there! :-)

----------

## commander-keen

Now I recompiled the Kernel for machine C with:

```
Executable file formats / Emulations -> IA32 Emulation
```

selected. 

Aaaaaand the Android error has disappeared. Again, thank you very much!

----------

