Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
need help understanding binary incompatibility
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
commander-keen
n00b
n00b


Joined: 09 Oct 2013
Posts: 47
Location: Europe

PostPosted: Sat Feb 20, 2016 2:45 pm    Post subject: need help understanding binary incompatibility Reply with quote

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:
Code:
/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!
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9883
Location: almost Mile High in the USA

PostPosted: Sat Feb 20, 2016 3:34 pm    Post subject: Reply with quote

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.
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54809
Location: 56N 3W

PostPosted: Sat Feb 20, 2016 4:29 pm    Post subject: Reply with quote

commander-keen,

When I try to run grub, I get
Code:
# 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
Code:
# 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.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
commander-keen
n00b
n00b


Joined: 09 Oct 2013
Posts: 47
Location: Europe

PostPosted: Sat Feb 20, 2016 6:54 pm    Post subject: Reply with quote

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! :-)
Back to top
View user's profile Send private message
commander-keen
n00b
n00b


Joined: 09 Oct 2013
Posts: 47
Location: Europe

PostPosted: Sat Feb 20, 2016 10:43 pm    Post subject: Reply with quote

Now I recompiled the Kernel for machine C with:
Code:
Executable file formats / Emulations -> IA32 Emulation

selected.
Aaaaaand the Android error has disappeared. Again, thank you very much!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum