LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   cross compile (http://www.linuxquestions.org/questions/linux-software-2/cross-compile-278713/)

zaicheke 01-17-2005 12:02 AM

cross compile
 
how would i cross compile something on OS X for linux?

jailbait 01-17-2005 10:31 AM

"how would i cross compile something on OS X for linux"

Use gcc. Pass gcc two options. For the OS pass it:
-mcall-linux
For the CPU pass it the name of the target CPU. For example:
-mcpu=i386
for an Intel cpu.

Look at the target section of man gcc to find out all of the options available to describe the CPU and architecture of the target machine.

----------------------------
Steve Stites

rjlee 01-17-2005 10:34 AM

You may/will also need to compile libc for a Linux target, or at least get the header files onto the OS X computer, before you can compile any “real” code.

zaicheke 01-17-2005 11:23 AM

where do i put those options. In the makefile or is there an environmental variable for gcc options.

jailbait 01-17-2005 01:43 PM

"where do i put those options. In the makefile or is there an environmental variable for gcc options."

They are parameters to the gcc command. Your gcc command is probably in a make file so create a version of your make file with the cross compile options on the gcc command.

---------------------------
Steve Stites

zaicheke 01-19-2005 05:31 PM

-mcall-linux doesn't work and isn't in the man pages.

jailbait 01-19-2005 07:37 PM

"-mcall-linux doesn't work and isn't in the man pages."

It is in my man pages with the explanation:
-mcall-linux
On System V.4 and embedded PowerPC systems compile code for the Linux-based GNU system.

Which, on reading it again, I agree probably will not work on OS-X.

------------------------
Steve Stites

zaicheke 01-20-2005 08:23 PM

i was reading the OSX gcc man pages. That could explain it.


All times are GMT -5. The time now is 09:10 AM.