How to run an executive file compiled in mac on linux?

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
ainis
Forum Newbie
Posts: 1
Joined: Sat Feb 07, 2009 8:44 pm

How to run an executive file compiled in mac on linux?

Post by ainis »

Hello all:
I have compiled a C source code on my Mac OS X (Leopard) and I have the executive file now called foo. In mac normally I can run it by ./foo . But I cannot run it on a red hat linux. It says it is a binary file. Is there any way to transform foo in a way sothat I be able to run it on Linux. I don't have access to the source code anymore.
Any help is appreciated.
Thank you,
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: How to run an executive file compiled in mac on linux?

Post by Chris Corbyn »

ainis wrote:Hello all:
I have compiled a C source code on my Mac OS X (Leopard) and I have the executive file now called foo. In mac normally I can run it by ./foo . But I cannot run it on a red hat linux. It says it is a binary file. Is there any way to transform foo in a way sothat I be able to run it on Linux. I don't have access to the source code anymore.
Any help is appreciated.
Thank you,
I'm not sure it will work at all. I think you'll need to take your C code and compile it on a host that is running the Linux kernel.

I could be wrong. I'm trying to find out if there are some CFLAGS/LDFLAGS you can use with gcc but I'm not too hopeful. Really though, if you're able to test that it works on a Linux machine, why not just compile it on one?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: How to run an executive file compiled in mac on linux?

Post by Chris Corbyn »

ainis wrote:I don't have access to the source code anymore.
Ok, this is your dead end. Forget what I said, if all you have is the compiled program for OS X architecture forget running it on Linux.

EDIT | Research done with regards to previous post. Even if you still had the source code you'd have to compile it on Linux. The compilers that come with OS X are not capable of cross compiling and producing a cross compiler for OS X is very difficult. Simply put, it's not worth the effort if you can just compile the same source under Linux.
Post Reply