Recent

Author Topic: I wish I could test my first app under OS X 10.4, 10.5 and 10.6!  (Read 14093 times)

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 687
Re: I wish I could test my first app under OS X 10.4, 10.5 and 10.6!
« Reply #15 on: March 26, 2012, 08:38:13 pm »
I have a sneaky suspicion that, if I specify the -macosx_version_min, then the resulting application will check if the system runs under that version or above and, if it doesn't, it will shut down without even trying to run.
Your suspicion is incorrect. And not specifying any -macosx_version_min switch is exactly the same as specifying "-macosx_version_min 10.7" if you compile on Mac OS X 10.7 (or "-macosx_version_min 10.6" if compiling on 10.6 etc, up to and including 10.5; before that, fixed defaults were used by gcc and the linker such as 10.1 for PowerPC and 10.4 for Intel).

This will change in a future version of FPC (see http://wiki.freepascal.org/FPC_New_Features_Trunk#Support_for_specifying_and_querying_the_deployment_version ), but until that point the linker defaults as explained above will apply).
« Last Edit: March 26, 2012, 08:41:06 pm by Jonas Maebe »

pasquale

  • Full Member
  • ***
  • Posts: 183
    • Esposito Software
Re: I wish I could test my first app under OS X 10.4, 10.5 and 10.6!
« Reply #16 on: March 26, 2012, 09:08:47 pm »
Quote
Your suspicion is incorrect. And not specifying any -macosx_version_min switch is exactly the same as specifying "-macosx_version_min 10.7" if you compile on Mac OS X 10.7 (or "-macosx_version_min 10.6" if compiling on 10.6 etc, up to and including 10.5; before that, fixed defaults were used by gcc and the linker such as 10.1 for PowerPC and 10.4 for Intel).

Since I compiled under Mac OS X 10.7 without specifying any -macosx_version_min switch, how come that jwdietrich was able to run my application under Snow Leopard? Shouldn't it have got stuck?
I'm beginning to love the Mac and hate Apple's money-hungry policy.

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 687
Re: I wish I could test my first app under OS X 10.4, 10.5 and 10.6!
« Reply #17 on: March 26, 2012, 09:26:20 pm »
Quote
Your suspicion is incorrect. And not specifying any -macosx_version_min switch is exactly the same as specifying "-macosx_version_min 10.7" if you compile on Mac OS X 10.7 (or "-macosx_version_min 10.6" if compiling on 10.6 etc, up to and including 10.5; before that, fixed defaults were used by gcc and the linker such as 10.1 for PowerPC and 10.4 for Intel).

Since I compiled under Mac OS X 10.7 without specifying any -macosx_version_min switch, how come that jwdietrich was able to run my application under Snow Leopard? Shouldn't it have got stuck?
No, because as I said earlier: "your suspicion is incorrect" (your suspicion was that a program linked for a particular Mac OS X version would always refuse to even start on earlier Mac OS X versions). Linking an application for a particular Mac OS X version means that it is guaranteed that will start on that version and later... at least if you don't use any libraries, library versions or APIs that are only available on later Mac OS X versions -- which is why you should also link against the appropriate SDK. It does not guarantee that it will immediately crash and burn on previous Mac OS X versions, it simply does not guarantee anything in that scenario.

I really don't understand why I am writing this for the third time in a single thread. Why is it so hard for you to accept the fact that if you compile against Mac OS X 10.7 libraries and tell the linker (implicitly or explicitly) that it only has to ensure that the program should run on Mac OS X 10.7 or later, that there are absolutely no guarantees whatsoever that the program will run in any way on previous Mac OS X versions? And that if it does run (somewhat, or even completely), it's pure luck?

Also, I can guarantee it won't start on 10.5 or earlier, because when targeting 10.6 or 10.7 the linker will insert mach-o loader commands that the 10.5 dynamic linker does not understand.

pasquale

  • Full Member
  • ***
  • Posts: 183
    • Esposito Software
Re: I wish I could test my first app under OS X 10.4, 10.5 and 10.6!
« Reply #18 on: March 26, 2012, 09:53:48 pm »
Quote
Linking an application for a particular Mac OS X version means that it is guaranteed that will start on that version and later... at least if you don't use any libraries, library versions or APIs that are only available on later Mac OS X versions -- which is why you should also link against the appropriate SDK. It does not guarantee that it will immediately crash and burn on previous Mac OS X versions, it simply does not guarantee anything in that scenario.

Believe it or not, I find your comments reassuring, simply because I am not using any particular Mac OS X "last generation" libraries. So, I think there are good chances that my app will never crash.

Initially, I developed my application for Windows. Then I ported the Lazarus source files to my iMac and the modifications I had to make were minimal. I'm sure all of the code I used could be defined as "prehistoric" and it is quite unlikely that it may cause compatibility problems.

In my opinion, mine was not pure luck. I just don't have enough experience to make references to Mac libraries, especially those which are so new that they may make an application "crash and burn" if the -macosx_version_min has not been specified.
I'm beginning to love the Mac and hate Apple's money-hungry policy.

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 687
Re: I wish I could test my first app under OS X 10.4, 10.5 and 10.6!
« Reply #19 on: March 26, 2012, 10:00:54 pm »
Quote
Linking an application for a particular Mac OS X version means that it is guaranteed that will start on that version and later... at least if you don't use any libraries, library versions or APIs that are only available on later Mac OS X versions -- which is why you should also link against the appropriate SDK. It does not guarantee that it will immediately crash and burn on previous Mac OS X versions, it simply does not guarantee anything in that scenario.

Believe it or not, I find your comments reassuring, simply because I am not using any particular Mac OS X "last generation" libraries. So, I think there are good chances that my app will never crash.
I gave an example in my previous post about how every single application compiled on 10.6 and 10.7 will fail to start on 10.5 and earlier unless you use special switches, completely unrelated to any library you use (even an empty program won't start).

Another example: if you compile an application that uses the cwstring unit on Mac OS X >= 10.5, it will fail to start on 10.4 and earlier because the iconv library of Mac OS X 10.5 and later has an newer, incompatible version number compared to earlier systems (and the version number of the linked library is embedded inside applications when they are linked).

And this is the last time I post in this thread, because for reasons I can't understand you appear to be determined to go for the most unsupported and unpredictable route available regardless of what anyone says.

pasquale

  • Full Member
  • ***
  • Posts: 183
    • Esposito Software
Re: I wish I could test my first app under OS X 10.4, 10.5 and 10.6!
« Reply #20 on: March 26, 2012, 10:14:55 pm »
I thought I had made it clear that I couldn't care less about Mac OS X 10.5. Statistics show that more than 80% of Mac users have switched to either Snow Leopard or Lion. The remaining percentage is marginal, especially from the commercial point of view: those who have no money to upgrade their OS have no money to buy software.

I don't know what the "cwstring unit" is and does, therefore I don't think I'm going to use it in the foreseeable future. If this unit is peculiar to Mac, I may never have to use it. As I said, the first version of my applications is always for Windows and, if the unit you mentioned is only for Mac, for me it can go to hell.

I will be determined to go for my "unsupported and unpredictable route" until somebody tells me, "Hold on! I've tested your application under Snow Leopard and, at a certain point, it crashed!". If that happens, I'll certainly start using the macosx_version_min switch.


« Last Edit: March 26, 2012, 10:23:58 pm by pasquale »
I'm beginning to love the Mac and hate Apple's money-hungry policy.

jwdietrich

  • Hero Member
  • *****
  • Posts: 1042
    • formatio reticularis
Re: I wish I could test my first app under OS X 10.4, 10.5 and 10.6!
« Reply #21 on: March 26, 2012, 11:15:31 pm »
Believe it or not, I find your comments reassuring, simply because I am not using any particular Mac OS X "last generation" libraries. So, I think there are good chances that my app will never crash.

Here we are again discussing about "some circumstances" and "all circumstances".

Don't forget that the Lazarus IDE itself generates calls to Mac OS (as an example: in normal situations you never have to deal with QuickDraw functions or update events for windows as they are handled automatically by Lazarus). Therefore, even if your application doesn't use any Lion-specific function, the IDE may do, and this could render your application incompatible with earlier versions.

When I tested your application on Snow Leopard this was for curiosity and to give you an impression about the possibilities of cross-version compiling. However, it was not intended to give you the feeling that your application is guaranteed to run on Tiger, Leopard or Snow Leopard.



In order to discuss the issue on the spread of different Mac OS X versions and even processor architectures: This is a very difficult question that doesn't have a sure and unambiguous answer. Nobody knows how many Macs with certain system versions are in use, we can only try to assess this from e.g. browser statistics or selling figures of certain application versions. I know two large university hospitals in Germany that have still PowerMacs from the 90ies with Mac OS 9 in productive use, e.g. as database servers, statistical workstations and for image acquisition. They never appear in browser statistics as they are either behind a firewall and use only intranet services or they operate as servers.

To make the thing more complicated, the distribution of certain system versions may vary among different countries and industrial sectors. Web designers, publishing offices and software developers (opinion makers on the question, which system version may be relevant) have usually much newer systems than average users. In some business branches, e.g. handcrafting, stock holding and small trade, quite old machines may be in use, because there is no reason to waste money for upgrading working computers - the more as some quite expensive industry-sector-specific software solutions would need an upgrade or would be useless at all on newer systems.

Therefore, I cannot make the decision for you, which system versions you should develop for. It depends from the structure and interests of your customers. One possibility would be to state on your website that your software runs on Lion upwards. The other and possibly better option would be - as previously suggested - to buy a cheap older Mac with Tiger and to develop a second version for older Mac OS versions. Thanks to the qualities of  Lazarus and Free Pascal this should reduce to a simple recompiling of the same sources.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.0.6 | FPC 3.0.4 | PPC, Intel, ARM | macOS, Windows, Linux

pasquale

  • Full Member
  • ***
  • Posts: 183
    • Esposito Software
Re: I wish I could test my first app under OS X 10.4, 10.5 and 10.6!
« Reply #22 on: March 27, 2012, 07:39:17 am »
Of course, it was not up to you to guarantee that my application can run under Snow Leopard. You were just so kind as to download it and see if you got any error messages. Thank you for that.

As I am a very pragmatical person, only when somebody tells me that he or she had problems running my app will I think about using the macosx_version_min switch. Until that happens, I don't feel like using code that, according to Apple themselves, should not be used since Xcode 4.3.1 guarantees backwards compatibility up to Snow Leopard.

I agree with Jonas Maebe when he says that my app would fail to start under Mac OS X 10.5 but, as I said, those users do not represent potential customers.
I'm beginning to love the Mac and hate Apple's money-hungry policy.

leosok

  • New member
  • *
  • Posts: 9
Re: I wish I could test my first app under OS X 10.4, 10.5 and 10.6!
« Reply #23 on: April 10, 2012, 03:46:19 pm »
With Osx 10.5.5 it crashed on start:

Process:         Inventario [329]
Path:            /Users/MacAdmin/Downloads/gestione_inventario_officina_meccanica_macosx/Inventario.app/Contents/MacOS/Inventario
Identifier:      espositosoftware.it.Inventario
Version:         ??? (???)
Code Type:       X86 (Native)
Parent Process:  launchd [88]

Date/Time:       2012-04-10 09:44:12.664 -0400
OS Version:      Mac OS X 10.5.5 (9F33)
Report Version:  6

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000002, 0x0000000000000000
Crashed Thread:  0

Dyld Error Message:
  unknown required load command 0x80000022


pasquale

  • Full Member
  • ***
  • Posts: 183
    • Esposito Software
Re: I wish I could test my first app under OS X 10.4, 10.5 and 10.6!
« Reply #24 on: April 10, 2012, 06:40:49 pm »
Thank you. It confirmed what I had suspected. It is only compatible with Snow Leopard and Lion.
I'm beginning to love the Mac and hate Apple's money-hungry policy.

Shebuka

  • Sr. Member
  • ****
  • Posts: 422
Re: I wish I could test my first app under OS X 10.4, 10.5 and 10.6!
« Reply #25 on: April 11, 2012, 01:10:03 pm »
btw Identifier must be: it.espositosoftware.Inventario, if not, apple can refuse your software.

pasquale

  • Full Member
  • ***
  • Posts: 183
    • Esposito Software
Re: I wish I could test my first app under OS X 10.4, 10.5 and 10.6!
« Reply #26 on: April 11, 2012, 11:54:15 pm »
btw Identifier must be: it.espositosoftware.Inventario, if not, apple can refuse your software.

Thanks for the tip.
I'm beginning to love the Mac and hate Apple's money-hungry policy.