Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Linux code

Linux code
Thread Tools
Senior User
Join Date: Feb 2000
Location: Webster, NY, USA
Status: Offline
Reply With Quote
Apr 14, 2001, 12:27 AM
 
Here is a question, and I think it goes in this forum but am uncertain. If I have a shareware game for Linux, and I have the .c (code file) can I port it to OS X and compile it and have it run on my mac? If so, how do I do this. I have yet to look at my Dev tools CD, is all the necessary stuff on that CD?

Then by extension, I must ask if I have the source code for apps on Linux, can I just email them to my mac, compile em and run em?
     
Grizzled Veteran
Join Date: Sep 2000
Location: San Francisco
Status: Offline
Reply With Quote
Apr 14, 2001, 12:55 AM
 
In general, the answer is yes. There are differences between Linux and OS X (FreeBSD), but therein lies the excitement. The first thing you must do is type setenv CC cc so that build scripts know that your C compiler is 'cc' rather than the usual 'gcc'.

Then you look at the instructions and follow them. Generally one does a ./configure followed by a make or make install. The error messages will tell you where the differences in the UNIXes are.

You will learn a lot. Good luck. Have fun.

------------------
Since EBCDIC
Make every post count!
Since EBCDIC
Using Macs since they were Lisas.
     
Dedicated MacNNer
Join Date: Jun 2000
Location: Dundas, Ontario, Canada
Status: Offline
Reply With Quote
Apr 17, 2001, 10:39 AM
 
The method described will create a Darwin app, not an OS X app (there is a big difference). If you wanted to actually make it a Mac OS X app you will have to map the user-end I/O to the cocoa API methods (mainly for drawing and user input) but the "thinking" code won't have to be touched and even some of the low-end hardware referrences might not have to be changed (it is based on what the names of things in the /dev/ directory are).

As for Darwin apps, for the most part the ports seem to be easy. You actually could compile gcc (a linux buddy of mine compiled it on my machine when I was out once but then I reformatted) for your Darwin/OS X system. After you fun ./configure you have to edit the configuration files to reflect that you are using "ppc" hardware (It doesn't seem to understand how to detect this) and a few other tweeks (this was months ago and I wasn't paying attention so I don't know). As Since EBCDIC says: "You will learn a lot." He isn't kidding and you might pull half the hair out of your head if you can't resolve some problems with it, as well.

Hope that helps, I don't know first hand too much of what I am talking about.
Jeff.
Spectral Class
"Shedding Light on Innovation"
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Apr 17, 2001, 04:24 PM
 
Originally posted by Apocalypse:
You actually could compile gcc (a linux buddy of mine compiled it on my machine when I was out once but then I reformatted) for your Darwin/OS X system.
for the quadrillionth time:
% cc -v
Reading specs from /usr/libexec/gcc/darwin/ppc/2.95.2/specs
Apple Computer, Inc. version gcc-926, based on gcc version 2.95.2 19991024 (release)

You can bootstrap gcc-3.0, though... If you really want to. Ho hum. I might have to try that at some point...
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:17 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2