I thought I'd start a thread about how to develop applications for PowerPC Macs running Tiger and Leopard, as I learn to do so.
(I know there is a programming-specific sub-forum here, but that's really oriented towards modern macOS / iOS development, so I figured this sub-forum is a better fit for PowerPC-specific retrodev.)
We'll use Leopard and Xcode 3.1.4 as our development environment, but modify the project settings to ensure compatibility with Tiger.
Note: regardless of the "All rights reserved" notices which Xcode automatically inserts into each file, I hereby release all of the code posted in this thread under the MIT license. (MIT is basically "public domain but you can't sue me").
The first step, of course is installing Xcode 3.1.4. This is available via https://macintoshgarden.org/apps/apple-xcode (download #10), and surprisingly is still available via Apple at https://developer.apple.com/service...eveloper_tools/xcode314_2809_developerdvd.dmg (by way of xcodereleases.com), but requires signing in to your Apple ID account.
(or, if you have leopard.sh installed, you can
As a first program, we'll use
Create a
This program simply imports Foundation (needed for NSLog), logs "Hello, world!", and exits.
To compile this program run
However, to make a "run anywhere" binary, we will build for G3 processors and target the 10.4 SDK:
The resulting binary will be called
We'll create a
(note: the indentation in Makefiles needs to be actual tab characters, this forum substitutes four spaces in the above code snippet.).
Now we can run
(I know there is a programming-specific sub-forum here, but that's really oriented towards modern macOS / iOS development, so I figured this sub-forum is a better fit for PowerPC-specific retrodev.)
We'll use Leopard and Xcode 3.1.4 as our development environment, but modify the project settings to ensure compatibility with Tiger.
License
Note: regardless of the "All rights reserved" notices which Xcode automatically inserts into each file, I hereby release all of the code posted in this thread under the MIT license. (MIT is basically "public domain but you can't sue me").
Install Xcode
The first step, of course is installing Xcode 3.1.4. This is available via https://macintoshgarden.org/apps/apple-xcode (download #10), and surprisingly is still available via Apple at https://developer.apple.com/service...eveloper_tools/xcode314_2809_developerdvd.dmg (by way of xcodereleases.com), but requires signing in to your Apple ID account.
(or, if you have leopard.sh installed, you can
leopard.sh xcode-3.1.4
)Hello, world!
As a first program, we'll use
NSLog
to write a command-line "Hello, world" program, but we don't need to create an Xcode project for this.Create a
main.m
file:
Objective-C:
#import <Foundation/Foundation.h>
int main(int argc, char** argv) {
NSLog(@"Hello, world!");
return 0;
}
This program simply imports Foundation (needed for NSLog), logs "Hello, world!", and exits.
To compile this program run
gcc -framework Foundation main.m
.However, to make a "run anywhere" binary, we will build for G3 processors and target the 10.4 SDK:
Code:
gcc -Wall -framework Foundation -mmacosx-version-min=10.4 -mcpu=750 main.m
The resulting binary will be called
a.out
and can be run in the terminal via ./a.out
Code:
$ ./a.out
2023-03-15 23:41:51.204 a.out[53570:10b] Hello, world!
We'll create a
Makefile
to capture this build process:
Code:
run: a.out
./a.out
.PHONY: run
a.out: main.m
gcc -Wall -framework Foundation -mmacosx-version-min=10.4 -mcpu=750 main.m
clean:
rm -f a.out
.PHONY: clean
(note: the indentation in Makefiles needs to be actual tab characters, this forum substitutes four spaces in the above code snippet.).
Now we can run
make a.out
, make run
and make clean
. Or if you just type make
it will build and run.Attachments
Last edited: