0

I'm developing a Mac OSX application using OSX 10.8. I want to make sure that my application will run correctly on 10.7.

In my source I believe I am not using 10.8 specific API calls (but I could be mistaken). There are third party libraries that I link to that may use 10.8 specific API calls.

I don't have a test system for 10.7. How can I test such a binary (executable or library) to see if it should work on 10.7 or not?

Brad Larson
  • 170,088
  • 45
  • 397
  • 571
koan
  • 3,596
  • 2
  • 25
  • 35
  • In general you can look at the info.plist if there is one, binary is a bit vague. It might be difficult to say if an API call signature is the same on multiple SDKs but implementation changed. This is where documentation comes in handy :( – uchuugaka Aug 13 '13 at 00:19
  • 1
    Best way is to test your app on 10.7. – asveikau Aug 13 '13 at 00:31
  • Making a test for 10.7 with 100% coverage would be very difficult. – koan Aug 13 '13 at 20:09
  • @koan - What do you do to test on 10.8? If you can do that to your satisfaction on 10.7 then that is best. – asveikau Aug 15 '13 at 18:38
  • @asveikau Best would be an automated test to check the differences betweem 10.7 and 10.8 and then only do one set of manual testing on 10.8. – koan Aug 15 '13 at 19:07
  • @koan - Actually the best thing is probably automated testing on both. :-) Remember that directly linking to functions in a shared library is not the only way to have problems running on 10.7. What if some calls exist in both versions but have different behavior? What if something is loaded by `dlsym()` or loading a bundle at runtime? – asveikau Aug 16 '13 at 00:13

2 Answers2

1

If you have specific API you're looking for, you can use tools like otool and nm to see if a binary includes calls to those APIs. See the man pages of each for details on how they work.

user1118321
  • 25,567
  • 4
  • 55
  • 86
  • Is there some way to automate this ? It's going to take forever to look up each function in the docs. – koan Aug 13 '13 at 07:54
  • You can probably check the header /usr/include/AvailabilityMacros.h and use the `#defines` in there. The API will generally mark things as `MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_8`, for example. You could probably parse the headers and extract that sort of information for your purposes. – user1118321 Aug 13 '13 at 17:52
  • That sounds like quite a project, to write a parser to read through all the system include files, build a database of which functions require which version and then match the results from nm. – koan Aug 13 '13 at 20:08
1

The first, best solution is to just compile with the 10.7 SDK. Then you know for certain that it will run on 10.7.

If that's not possible for some reason, then the best tools available are DeployMate and AppCode which can search for incorrect usage.

But I strongly recommend compiling with the SDK that you are targeting. See also Mac SDK: using latest SDK but ensuring backwards compatibility with earlier deployment target

See also https://gist.github.com/rnapier/3370649 for a script to assist in managing this.

Community
  • 1
  • 1
Rob Napier
  • 286,113
  • 34
  • 456
  • 610