code4fun
code4fun

Reputation: 2739

unable to run a binary in mac,running on Linux

I am using a software for graph mining. I have got the binary of that software in 2 folders for Linux mode and SunOs mode but don't have the source. I am able to run the binary in Linux machine. But when I want to run the binary in a Mac machine I am getting "command not found" for both the Linux and SunOs folders' binaries.

Could someone suggest if it can be able to run this in a MAC machine by any means like using a Linux shell or something

Gaurav

EDIT:I am getting "cannot execute binary" error when I set chmod to "u+x"

Upvotes: 2

Views: 22549

Answers (3)

Grady Player
Grady Player

Reputation: 14549

Operating systems generally don't support executing object code any extra formats... If Mac osx decended from solaris or Linux, then there could be some incentive for legacy support. But just assume everything to be binarily incomparable if it was compiled for a different arch and platform. There are a few places where you inherit backwards compatibility, running 32 but code on 64 bit oses... Or ppc code support on intel macs, but I suspect that both of those, especially the latter were non trivial engineering tasks.

Here are your options... Get the source and compile on the Mac, if it compiles on Linux and solaris good chance it will compile and run ok on Mac.

Run through an emulator or boot camp

Upvotes: 0

Diego Torres Milano
Diego Torres Milano

Reputation: 69198

If you use the file command you will see the difference, on the linux executable you'll have something like:

ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, for GNU/Linux 2.6.15, not stripped

and something like this for OS X executables:

command: Mach-O universal binary with 2 architectures command (for architecture x86_64): Mach-O 64-bit executable x86_64 command (for architecture i386): Mach-O executable i386

Upvotes: 3

Dave Newton
Dave Newton

Reputation: 160191

You'll need to recompile it for OS X or use a VM.

A command not found just means you're not executing it right, make sure it's chmod u+x and it's either on your PATH, or you specify the path explicitly.

Upvotes: 4

Related Questions