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 > Universal Binary Backwards Compatible?

Universal Binary Backwards Compatible?
Thread Tools
Bobby
Mac Enthusiast
Join Date: Apr 2001
Location: Camarillo, CA
Status: Offline
Reply With Quote
Mar 8, 2006, 09:12 PM
 
I'm updating a small screensaver I wrote to universal Binary, and I'm wondering about backwards compatiblity.

I wrote it origionally on 10.3 and found it works on 10.2 as well (so that's what I used as my cutoff under system requirements). I changed the compile opitons for Universal Binary and it built & works with no modifications (small screensaver).

What I'm wondering (since I can't easily test) is if it should still be compatible with 10.2 since the code was before hand...

Anybody know if it should???
     
Brass
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Mar 8, 2006, 11:57 PM
 
If you compile as universal binary, you must use the 10.4u SDK. This makes it incompatible with anything less than 10.4. So "no", it will not work with 10.2, but even more significant, it will not work with 10.3 either.

Many developers now are building twice: once using the 10.3 SDK (PPC only) and once using the 10.4u SDK (PPC/Intel). It's a pain, but there's no other way around it that I'm aware of.

If there is, I'd be grateful to hear about it.

(I have simplified things a little by creating a build style for each, but you still have to manually change the SDK each time).
     
Chuckit
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Mar 9, 2006, 12:22 AM
 
I'll preface this with the caveat that I have no Macintels, so I haven't tested any of this myself. That said, it should be possible to create a 10.2-compatible universal binary. For some reason, though, Apple doesn't make it very obvious how to do this in Xcode. Here are a couple of links that should help:

http://developer.apple.com/documenta...section_6.html

http://developer.apple.com/technotes/tn2005/tn2137.html
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
saddino
Mac Enthusiast
Join Date: Nov 2003
Status: Offline
Reply With Quote
Mar 9, 2006, 10:00 AM
 
Originally Posted by Brass
If you compile as universal binary, you must use the 10.4u SDK. This makes it incompatible with anything less than 10.4. So "no", it will not work with 10.2, but even more significant, it will not work with 10.3 either.

Many developers now are building twice: once using the 10.3 SDK (PPC only) and once using the 10.4u SDK (PPC/Intel). It's a pain, but there's no other way around it that I'm aware of.

If there is, I'd be grateful to hear about it.
Yes, there is a way.

As you note, the SDK will affect what APIs are availble to your code, but unless you are using "fully deprecated" APIs (meaning APIs which are only present in in 10.3 SDK and not in the 10.4 SDK, of which I know of none), you can still compile code that runs on 10.3 with the 10.4u SDK. You simly have to do the following:

1) In your Build settings, set "Mac OS X Deployment Target" to "Max OS X 10.3"
2) If you use (or any of your Frameworks reference any 10.4-only Frameworks, make sure you specify them in your "Other Linker Flags" as "-weak_framework FrameWorkName"
3) DO NOT set "Accelerated Objective-C Dispatch"

Then Build: you get a Universal Binary that runs on OS X 10.3 and 10.4 (PPC and Intel).
     
Bobby  (op)
Mac Enthusiast
Join Date: Apr 2001
Location: Camarillo, CA
Status: Offline
Reply With Quote
Mar 9, 2006, 06:27 PM
 
Originally Posted by saddino
Yes, there is a way.

As you note, the SDK will affect what APIs are availble to your code, but unless you are using "fully deprecated" APIs (meaning APIs which are only present in in 10.3 SDK and not in the 10.4 SDK, of which I know of none), you can still compile code that runs on 10.3 with the 10.4u SDK. You simly have to do the following:

1) In your Build settings, set "Mac OS X Deployment Target" to "Max OS X 10.3"
2) If you use (or any of your Frameworks reference any 10.4-only Frameworks, make sure you specify them in your "Other Linker Flags" as "-weak_framework FrameWorkName"
3) DO NOT set "Accelerated Objective-C Dispatch"

Then Build: you get a Universal Binary that runs on OS X 10.3 and 10.4 (PPC and Intel).
Question: If I can compile for 10.3, and everything I use also works & compiles in the 10.2 SDK (it's a very small screensaver), can I set the target for 10.2 with the 10.4u.sdk???
     
Bobby  (op)
Mac Enthusiast
Join Date: Apr 2001
Location: Camarillo, CA
Status: Offline
Reply With Quote
Mar 9, 2006, 06:35 PM
 
Originally Posted by Bobby
Question: If I can compile for 10.3, and everything I use also works & compiles in the 10.2 SDK (it's a very small screensaver), can I set the target for 10.2 with the 10.4u.sdk???
You know what, nevermind...

I followed the link given above ( http://developer.apple.com/technotes/tn2005/tn2137.html ) and thoes directions make a little more sence to me... I'm just using this method...
     
Brass
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Mar 9, 2006, 09:33 PM
 
Ah, I'm very glad to hear that I was wrong! I shall have to look into those suggestions.
     
Bobby  (op)
Mac Enthusiast
Join Date: Apr 2001
Location: Camarillo, CA
Status: Offline
Reply With Quote
Mar 9, 2006, 11:47 PM
 
I'm glad I posted this thread, because I quickly discovered I wasn't even compiling Universal Binary to begin with. And My saver was never compiled for 10.2... The URL above helped me take care of all that...
     
   
 
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
Top
Privacy Policy
All times are GMT -4. The time now is 06:50 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,