I wish I could test my first app under OS X 10.4, 10.5 and 10.6! lazarus / 33-macOS - Mac OS X ---------------------------------------------------------------------- pasquale · 2012-03-25 20:44 Hello, everybody. I have been working hard over the last few days to develop my first application for Mac using Lazarus 0.9.30.4 and Xcode 4.3.1. In another thread in this Forum, I discussed compatibility problems trying to understand if my app could be compatible with OS X 10.4, 10.5 and 10.6. Unfortunately, I still don't know the answer. Apple say that compiling with Xcode 4.3.1 guarantees backwards compatibility on condition that the application does not contain any references to new libraries. On the contrary, other developers believe that under no circumstances can you run an application under OS X 4.0, 5.0 and 6.0 if it was compiled with Xcode 4.3.1. Now, I have just finished to develop my first Mac application and put it on my Italian Web site. I decided not to use the following reference to macosx_version_min: Code: [Select] -k-macosx_version_min -k10.6 -XR/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platfor m/Developer/SDKs/MacOSX10.6.sdk in the Project Option because I was afraid this code could prevent my app from working under Mac OS X 10.4, 10.5, provided that what Apple say is true. The reason for this post of mine is to ask those of you who are willing to help me and have access to Mac machines running under OS X 10.4, 10.5 and 10.6 to test my app under those versions of OS X. I am aware I am probably asking too much but I am desperate because where I live nobody can help me. The few Mac users I know have already upgraded to Lion. Please consider that I have not used an installation package. All you should do is download the zip file, explode it and double click on the app to see whether it runs or not. This is the link that you can use to download my app: http://www.espositosoftware.it/programmi/gestione_inventario_officina_ meccanica_macosx.zip Thanks in advance for your help. ---------------------------------------------------------------------- jwdietrich · 2012-03-25 21:05 I would like to check your application with Mac OS X 10.4 and 10.5 if it could run on PPC based Macs. Please create a version for PPC processors (Project Options : Code generation : Target CPU family : powerpc) and leave a note where the binary can be loaded from. ---------------------------------------------------------------------- Jonas Maebe · 2012-03-25 21:07 If you don't use any options at all, the program is only guaranteed to work on the Mac OS X version under which it was compiled. Even without testing, I can guarantee that it will not work on Mac OS X 10.5 or 10.4 if it's compiled under 10.6 without any special options. ---------------------------------------------------------------------- pasquale · 2012-03-25 21:09 Quote from: Jonas Maebe on March 25, 2012, 11:07:03 pmIf you don't use any options at all, the program is only guaranteed to work on the Mac OS X version under which it was compiled. Even without testing, I can guarantee that it will not work on Mac OS X 10.5 or 10.4 if it's compiled under 10.6 without any special options. Then when Apple guarantee backwards compatibility, they are just kidding us! Actually, I compiled it under 10.7 (Lion) and I didn't even put the "-k-macosx_version_min -k10.6" code, which I could and should have done! Who knows if compiling under Lion guarantees compatibility at least under Snow Leopard without specifying the macosx_version_min? ---------------------------------------------------------------------- Jonas Maebe · 2012-03-25 21:14 Quote from: pasquale on March 25, 2012, 11:09:17 pmQuote from: Jonas Maebe on March 25, 2012, 11:07:03 pmIf you don't use any options at all, the program is only guaranteed to work on the Mac OS X version under which it was compiled. Even without testing, I can guarantee that it will not work on Mac OS X 10.5 or 10.4 if it's compiled under 10.6 without any special options. Then when Apple guarantee backwards compatibility, they are just kidding us! Where you have seen any guarantees by Apple for backwards compatibility? That said, in general, programs compiled for older OS releases will work fine on newer OS releases (up to a point). That is what backwards compatibility means. It does not mean that if you compile a program for Mac OS X 10.6, it is guaranteed to run on 10.5 and 10.4 (that would be something like "future compatibility", which is almost impossible). To make sure that your application runs on older Mac OS X releases, you must compile it *for* that Mac OS X release. This means that you have to compile it using the appropriate -k-macosx_version_min switch, and link it against the appropriate Mac OS X SDK. ---------------------------------------------------------------------- pasquale · 2012-03-25 21:24 QuoteWhere you have seen any guarantees by Apple for backwards compatibility? I think I read it here: http://lists.apple.com/archives/xcode-users/2011/Jul/msg00223.html Quote(Backwards compatibility) does not mean that if you compile a program for Mac OS X 10.6, it is guaranteed to run on 10.5 and 10.4 (that would be something like "future compatibility", which is almost impossible). Sorry, I don't understand your reasoning. If you compile a program for Mac OS X 10.6 and want it to run on 10.5, you want it to be compatible with previous versions. Hence, you should talk about "backwards compatibility". I didn't use any options in my app which was compiled with Xcode 4.3.1 under Lion. If you had Snow Leopard handy and downloaded my app, you could solve the mistery with a simple double-click. ---------------------------------------------------------------------- pasquale · 2012-03-25 21:26 Quote from: jwdietrich on March 25, 2012, 11:05:02 pmI would like to check your application with Mac OS X 10.4 and 10.5 if it could run on PPC based Macs. Please create a version for PPC processors (Project Options : Code generation : Target CPU family : powerpc) and leave a note where the binary can be loaded from. Sure. I'll do it tomorrow, when I can use my iMac again. Right now I am using my Windows PC. ---------------------------------------------------------------------- Jonas Maebe · 2012-03-25 21:44 Quote from: pasquale on March 25, 2012, 11:24:43 pmQuoteWhere you have seen any guarantees by Apple for backwards compatibility? I think I read it here: http://lists.apple.com/archives/xcode-users/2011/Jul/msg00223.html What Christiaan Hofman says in that post about libraries is correct. That is why you should always compile against the SDK corresponding to the earliest Mac OS X version you want to support. QuoteQuote(Backwards compatibility) does not mean that if you compile a program for Mac OS X 10.6, it is guaranteed to run on 10.5 and 10.4 (that would be something like "future compatibility", which is almost impossible). Sorry, I don't understand your reasoning. If you compile a program for Mac OS X 10.6 and want it to run on 10.5, you want it to be compatible with previous versions. Hence, you should talk about "backwards compatibility". As mentioned: if you do *not* use any special options, the system tools will always only guarantee compatibility with the current Mac OS X version. That is why you have to use special options. In your original message you said that you did not want to use the "-macosx_version_min" parameter (at least that is how I understood it; if you simply meant that you would use 10.5 instead of 10.6, then I don't understand what you are asking), so in that case all you can count on is that the program will run on Mac OS X versions equal or greater than your own system version. QuoteI didn't use any options in my app which was compiled with Xcode 4.3.1 under Lion. If you had Snow Leopard handy and downloaded my app, you could solve the mistery with a simple double-click. I have Mac OS X 10.6. And your program may or may not run on my system (I won't test it, because it's useless to test -- read on why). All I'm saying is that it's not guaranteed to run. And as soon as you add a single unit to your program, or call an extra routine from a unit you already use, it may stop working on previous Mac OS X versions even if it works today. Again, and for the last time: the only way to make sure that programs run on previous Mac OS X versions, is to use the appropriate -kmacosx_version_min switch and to link against the appropriate Mac OS X SDK. Now, Apple does not like to spend money on keeping supporting old systems (they don't earn any money from it), so with almost every new Xcode version they remove support for yet another older Mac OS X version (Xcode 2.5 was the last one with 10.4 support, Xcode 3.2.x the last with 10.5 support, ...). This is a pain, makes it hard to support systems older than Apple deems worthy (especially since older Xcode versions don't necessarily run on newer Mac OS X versions -- one place where Apple does not maintain backward compatibility is in low level debugger interfaces and the like), but it does not change anything about the fact that you have to follow the instructions in the previous paragraph to guarantee that a program will run on an older Mac OS X version. ---------------------------------------------------------------------- jwdietrich · 2012-03-25 22:26 I tested your application, and it worked on an Intel-based Mac with Mac OS 10.6. However, I am quite sure that Jonas Maebe is right and that even if it runs on my machine, it is not guaranteed that it runs with another one, and it is also not sure that the next revision of your application would run. As already posted in one of the other threads you opened, I would recommend to buy a used G4 Mac and to install OS 10.4 with the appropriate Xcode version there. Even the newest versions of Lazarus and Free Pascal run on PPC macs with Mac OS Tiger. Given the low prices for e.g. used Mac Minis G4 now, this may pay-off with the first application you sell. ---------------------------------------------------------------------- pasquale · 2012-03-26 05:45 QuoteI tested your application, and it worked on an Intel-based Mac with Mac OS 10.6. This is good news. So, I have to say Apple are right -- so far -- about backwards compatibility. I didn't use any option parameters addressing a lower version (I developed my app under Lion) and, in spite of that, it ran on your Snow Leopard Mac. Now I know that the statement "under no circumstances can you run an application under OS X 4.0, 5.0 and 6.0 if it was compiled with Xcode 4.3.1" is wrong. I can't see why my app, which works on your Mac OS 10.6, might  not work on somebody else's Mac OS 10.6. What differences could there be between the two Macs? ---------------------------------------------------------------------- jwdietrich · 2012-03-26 06:52 OK, but your question as a software developer should not be "does the application run under some circumstances?" (the complement of the statement "under no circumstances can you run an application under OS X 4.0, 5.0 and 6.0 if it was compiled with Xcode 4.3.1"), the question should be "does it run under all circumstances?". Although the operating system version is identical, there may be differences in the subversion (I used 10.6.8 ), in additional installed libraries and system-extensions, in the hardware and in global user preferences affecting the whole system. ---------------------------------------------------------------------- pasquale · 2012-03-26 14:53 Quote from: jwdietrich on March 25, 2012, 11:05:02 pmI would like to check your application with Mac OS X 10.4 and 10.5 if it could run on PPC based Macs. Please create a version for PPC processors (Project Options : Code generation : Target CPU family : powerpc) and leave a note where the binary can be loaded from. When I try to compile against the powerpc CPU, I get an error message concerning the PowerPDF package, which works just fine when I compile in the default mode. Any idea why this happens? See attached file. ---------------------------------------------------------------------- pasquale · 2012-03-26 15:02 Quote from: jwdietrich on March 26, 2012, 08:52:10 amOK, but your question as a software developer should not be "does the application run under some circumstances?" (the complement of the statement "under no circumstances can you run an application under OS X 4.0, 5.0 and 6.0 if it was compiled with Xcode 4.3.1"), the question should be "does it run under all circumstances?". Although the operating system version is identical, there may be differences in the subversion (I used 10.6.8 ), in additional installed libraries and system-extensions, in the hardware and in global user preferences affecting the whole system. 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. I would love to receive further feedback about any compatibility issues that my first Mac application may originate. I'm aware that fewer and fewer people in this Forum are using Tiger or Leopard, so I'm afraid the first negative feedback will come directly from my potential Italian customers who will try to install my app on their old Mac versions. Let's wait and see... ---------------------------------------------------------------------- marcov · 2012-03-26 16:02 Quote from: pasquale on March 26, 2012, 04:53:38 pmQuote from: jwdietrich on March 25, 2012, 11:05:02 pmI would like to check your application with Mac OS X 10.4 and 10.5 if it could run on PPC based Macs. Please create a version for PPC processors (Project Options : Code generation : Target CPU family : powerpc) and leave a note where the binary can be loaded from. When I try to compile against the powerpc CPU, I get an error message concerning the PowerPDF package, which works just fine when I compile in the default mode. Any idea why this happens? To me this looks like you have powerpc FPC installed, but not a LCL/lazarus compiled for the PPC target. ---------------------------------------------------------------------- pasquale · 2012-03-26 16:33 After reading this: QuoteAmongst Macs, OS X 10.7, aka Lion, again boosted its share; in February, the mid-2011 edition accounted for 38.9% of all Apple desktop operating systems in use. Snow Leopard, or OS X 10.6, retained its lead over Lion, however. The 2009 version powered 43.4% of all Mac desktops and notebooks.” I wonder if it still makes sense to worry about backwards compatibility issues. If the statistics above are true, it means that more than 80% of Mac users have either Snow Leopard or Lion. Considering that my first Mac application seems to work on Snow Leopard without setting any macosx_version_min parameters, probably I should just forget about OSX 10.4 and 10.5 and only use the Xcode 4.3.1 default settings. ---------------------------------------------------------------------- Jonas Maebe · 2012-03-26 18:38 Quote from: pasquale on March 26, 2012, 05:02:04 pmI 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.freepasca l.org/FPC_New_Features_Trunk#Support_for_specifying_and_querying_the_d eployment_version ), but until that point the linker defaults as explained above will apply). ---------------------------------------------------------------------- pasquale · 2012-03-26 19:08 QuoteYour 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? ---------------------------------------------------------------------- Jonas Maebe · 2012-03-26 19:26 Quote from: pasquale on March 26, 2012, 09:08:47 pmQuoteYour 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 · 2012-03-26 19:53 QuoteLinking 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. ---------------------------------------------------------------------- Jonas Maebe · 2012-03-26 20:00 Quote from: pasquale on March 26, 2012, 09:53:48 pmQuoteLinking 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 · 2012-03-26 20:14 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. ---------------------------------------------------------------------- jwdietrich · 2012-03-26 21:15 Quote from: pasquale on March 26, 2012, 09:53:48 pmBelieve 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. ---------------------------------------------------------------------- pasquale · 2012-03-27 05:39 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. ---------------------------------------------------------------------- leosok · 2012-04-10 13:46 With Osx 10.5.5 it crashed on start: Process:         Inventario [329] Path:            /Users/MacAdmin/Downloads/gestione_inventario_officin a_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 · 2012-04-10 16:40 Thank you. It confirmed what I had suspected. It is only compatible with Snow Leopard and Lion. ---------------------------------------------------------------------- Shebuka · 2012-04-11 11:10 btw Identifier must be: it.espositosoftware.Inventario, if not, apple can refuse your software. ---------------------------------------------------------------------- pasquale · 2012-04-11 21:54 Quote from: Shebuka on April 11, 2012, 01:10:03 pmbtw Identifier must be: it.espositosoftware.Inventario, if not, apple can refuse your software. Thanks for the tip.