• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Universal Binaries with 10.2.8 vs 10.4 conditional compiling
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Universal Binaries with 10.2.8 vs 10.4 conditional compiling


  • Subject: Re: Universal Binaries with 10.2.8 vs 10.4 conditional compiling
  • From: Stephane Odul <email@hidden>
  • Date: Mon, 17 Apr 2006 02:28:20 -0700


On Apr 7, 2006, at 13:00 , Steve Christensen wrote:

On Apr 7, 2006, at 9:17 AM, Stephane Odul wrote:

I have some code that I want to work with 10.2.8 and 10.4 Intel, and I have slight problem with ne of the system functions:

in 10.2 I had this:

clock_get_uptime( &now );

but with 10.4 sdk it has to be like this or I get a compiler error (and this line is not working with the 10.2 sdk):

clock_get_uptime( (uint64_t *) &now );

So I tried to use MAC_OS_X_VERSION_MAX_ALLOWED

#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_3
    // Works with 10.2.8 sdk, 10.4 gives an error
    clock_get_uptime( &now );
#else
    // Works with 10.4 sdk, 10.2.8 gives an error
    clock_get_uptime( (uint64_t *) &now );
#endif

And it's working just fine so long as I only compile for 10.2.8 or 10.4, but when I'm doing an universal binary it seems I'm always hitting the 10.4u SDK and of course I'm getting a compile error on clock_get_uptime.

I do have the SDK_ROOT variables set correctly:

SDKROOT_i386 $(SYSTEM_DEVELOPER_DIR)/SDKs/MacOSX10.4u.sdk
SDKROOT_ppc $(SYSTEM_DEVELOPER_DIR)/SDKs/MacOSX10.2.8.sdk

I have the following set for my Universal projects:

SDKROOT                       = /Developer/SDKs/MacOSX10.4u.sdk
GCC_VERSION_ppc               = 3.3
MACOSX_DEPLOYMENT_TARGET_ppc  = 10.3 (you could use 10.2.8 here)
MACOSX_DEPLOYMENT_TARGET_i386 = 10.4

That way you always build against the universal SDK, but post-10.2.8 symbols would be weak-linked. You could also get rid of the conditional code.

If you'd rather leave your build settings alone, how about doing the following instead?

#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4
    clock_get_uptime( &now );
#else
    clock_get_uptime( (uint64_t *) &now );
#endif

I'm actually building a Kernel extension so I have to use the proper SDK I'm targeting. Even if I was only targeting 10.4 I would have to d/l and use the non universal 10.4 SDK for ppc (available as a separate d/l) and the 10.4u for i386.


I've tried to use MAC_OS_X_VERSION_MIN_REQUIRED but it does not help either. A workaround I found is this:

#if __GNUC__ == 3
    // Works with 10.2.8 sdk, 10.4 gives an error
    clock_get_uptime( &now );
#else
    // Works with 10.4 sdk, 10.2.8 gives an error
    clock_get_uptime( (uint64_t *) &now );
#endif

I don't like it because I test against the version of GCC, while I want to test the current SDK.

And sorry for the delayed response I switched to a MacBook Pro last week and haven't fully transitioned yet.

Thanks,

- Stephane


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Universal Binaries with 10.2.8 vs 10.4 conditional compiling (From: Stephane Odul <email@hidden>)
 >Re: Universal Binaries with 10.2.8 vs 10.4 conditional compiling (From: Steve Christensen <email@hidden>)

  • Prev by Date: RE: Printing resolution problems
  • Next by Date: NSOutlineView setAutosaveExpandedItems
  • Previous by thread: Re: Universal Binaries with 10.2.8 vs 10.4 conditional compiling
  • Next by thread: nubie: help return an object from another class
  • Index(es):
    • Date
    • Thread