Lazarus

Programming => Operating Systems => macOS / Mac OS X => Topic started by: Phil on April 12, 2018, 04:00:35 pm

Title: macOS 32-bit app warning
Post by: Phil on April 12, 2018, 04:00:35 pm
macOS 10.13.4 now warns the first time you run a 32-bit app.

https://developer.apple.com/news/?id=04112018a (https://developer.apple.com/news/?id=04112018a)

If you've run the app previously, you won't get the warning. Apparently it appears only the first time you run a 32-bit app starting from today.

Since I had never run the Laz "lhelp" app, I tried it. Here's what the warning dialog looks like:

If you distribute a Carbon widgetset-based app that you created with Lazarus (the default), your users will get a warning like this the first time they run the app.
Title: Re: macOS 32-bit app warning
Post by: Hansaplast on April 12, 2018, 04:05:21 pm
I just noticed the same thing with my small Carbon apps ...
Thanks for the heads up!  :)
Title: Re: macOS 32-bit app warning
Post by: lainz on April 12, 2018, 04:23:08 pm
I can remember some 16 bit apps when I was using Windows 95, then several years later wanted to download some 16 bit apps, and to only notice these can't run anymore.

Well, there should be a way to "hack" maybe, but is not the way you want to distribute your applications.

I've seen videos where you can install from the first Windows to the latest one (skipping some incompatible ones) and run old software on it.

I don't think Apple let these things happen on his machines...
Title: Re: macOS 32-bit app warning
Post by: Phil on April 12, 2018, 04:28:55 pm
I just noticed the same thing with my small Carbon apps ...

Here's how to see the list of 32-bit apps on a Mac. I believe the instructions were posted here previously, but this article gives screenshots:

https://forums.appleinsider.com/discussion/204327

Note that you can click the 64-bit column header in the listing to group all the 32-bit apps ("No") together to see them easily.

Other than Lazarus, startlazarus, lhelp and Lazarus-compiled apps of my own, the only 32-bit apps I have are DVD Player and InkServer, like in the screenshot.

Note FPC compilers themselves as of 3.0.4 are now "fat" binaries with both 32-bit and 64-bit architectures. And running "fpc" now defaults to the 64-bit target as of 3.0.4.
Title: Re: macOS 32-bit app warning
Post by: Thaddy on April 12, 2018, 06:24:17 pm
Note 32 bit code is deprecated by Apple and pretty soon is no longer allowed, so use it only for maintenance, not for new code. Don't even try it. For all platforms, not only Intel, but also ARM. Google has about the same policy, but needs to lag a bit...
Title: Re: macOS 32-bit app warning
Post by: Phil on April 12, 2018, 11:54:51 pm
Note 32 bit code is deprecated by Apple and pretty soon is no longer allowed

For Macs, a minor step forward, perhaps clearing the deck of legacy bits in preparation for bigger changes in store for macOS:

https://www.fastcompany.com/40553680/the-fifth-age-of-macintosh-what-happens-if-apple-dumps-intel

Title: Re: macOS 32-bit app warning
Post by: dbannon on April 13, 2018, 07:12:01 am
Wow, interesting article Phil, we'll see a cross between a Mac and a Raspberry Pi ?

But seriously, ARM has come a long way hasn't it ?

And this thread does explain why I have been asked twice this morning about when my app will do 64bit on MacOS. Going to have to be real soon ......

Davo
Title: Re: macOS 32-bit app warning
Post by: Phil on April 13, 2018, 04:24:11 pm
But seriously, ARM has come a long way hasn't it ?

Yes, already a year ago people were noticing that the iPad Pro was edging into Intel i7 benchmark territory.

https://9to5mac.com/2017/06/14/ipad-pro-versus-macbook-pro-speed-tests/

And this thread does explain why I have been asked twice this morning about when my app will do 64bit on MacOS. Going to have to be real soon ......

You might be in a tough spot. I don't believe the Cocoa widgetset is production code ready. Qt5 might be (although I doubt if it's been tested very thoroughly on Mac), but Qt5 has two big issues: (1) deployment of Qt5 frameworks inside your app bundle and (2) license question if you're not open sourcing your entire app's code.

I have a couple apps I run on my Mac that use Qt and they look fine: Microsoft's Remote Desktop and the open-source QGIS. But I don't thing Qt is a viable option for Lazarus on Mac.
Title: Re: macOS 32-bit app warning
Post by: lainz on April 13, 2018, 05:11:08 pm
But seriously, ARM has come a long way hasn't it ?

Yes, already a year ago people were noticing that the iPad Pro was edging into Intel i7 benchmark territory.

https://9to5mac.com/2017/06/14/ipad-pro-versus-macbook-pro-speed-tests/

Just Amazing. In university I have a teacher that's using a tablet instead of notebook. Less weight and just as good for his needs.
Title: Re: macOS 32-bit app warning
Post by: Phil on April 13, 2018, 05:28:42 pm
In university I have a teacher that's using a tablet instead of notebook. Less weight and just as good for his needs.

I've heard people tell me that when their current computer dies, that they're not going to replace it, that their tablet is good enough for what they do. Part of that is probably the expense of a new computer that they no longer use very often. But what if Apple marketed an ARM-based MacBook running macOS that's priced somewhere between the iPad (starts at US$329, $299 education) and the MacBook (starts at $999)?

https://www.apple.com/ipad-9.7/
Title: Re: macOS 32-bit app warning
Post by: lainz on April 13, 2018, 05:55:48 pm
But what if Apple marketed an ARM-based MacBook running macOS that's priced somewhere between the iPad (starts at US$329, $299 education) and the MacBook (starts at $999)?

Sure, the iPad price a good price for a good tablet. In my country is almost the price of a "regular" smartphone (I say is not cheap - for me - but also not expensive).

But here iPad and all Apple stuff are regulated by the customs import taxes, that for electronic are almost half the price. So here we pay between 150% or 200% the price of the product in US.

Here it costs a bit more than $500, the same product listed as $329 in Apple website.

And yes, it will be great.
Title: Re: macOS 32-bit app warning
Post by: Phil on April 14, 2018, 05:11:03 pm
Sure, the iPad price a good price for a good tablet. In my country is almost the price of a "regular" smartphone (I say is not cheap - for me - but also not expensive).

Cartoonist's video review of the new iPad by "filming" the screen as she draws, etc:

https://www.youtube.com/embed/nfrAWqUPcFg?modestbranding=0&html5=1&rel=0&autoplay=0&wmode=opaque&loop=0&controls=1&autohide=0&showinfo=0&theme=dark&color=red&enablejsapi=1

Title: Re: macOS 32-bit app warning
Post by: lainz on April 14, 2018, 05:57:13 pm
Seems that you really like Apple a lot =)

I have not the privilege to run any of his devices, but people seems very comfortable with them, so maybe there are good reasons.

My boos says that in first place is macOS, then Linux, then Windows.

I personally like Windows, then Linux, and I can't say nothing about macOS yet, since running it on an emulator is not the full experience.
Title: Re: macOS 32-bit app warning
Post by: Phil on April 14, 2018, 06:07:23 pm
My boos says that in first place is macOS, then Linux, then Windows.

And Macs do tend to last a long time. I'm typing this on my late 2008 MacBook.
Title: Re: macOS 32-bit app warning
Post by: jwdietrich on April 14, 2018, 06:16:47 pm
My boos says that in first place is macOS, then Linux, then Windows.

And Macs do tend to last a long time. I'm typing this on my late 2008 MacBook.

And I am reading this on a 2007 Mac Pro. :)
Title: Re: macOS 32-bit app warning
Post by: lainz on April 14, 2018, 06:25:36 pm
Well, I have a Lenovo from 2010 and is still running, I just changed the old school HD with an SSD, nothing more.
Title: Re: macOS 32-bit app warning
Post by: Phil on April 14, 2018, 06:59:39 pm
Well, I have a Lenovo from 2010 and is still running, I just changed the old school HD with an SSD, nothing more.

SSD is probably the single best thing you can do to prolong a computer's usefulness. Fortunately, I bought mine with SSD, so the only "upgrade" I've had to do is replace the battery.
Title: Re: macOS 32-bit app warning
Post by: lainz on April 14, 2018, 07:10:20 pm
Yes, never had a problem also, I think the same happen with your machine.

But I had several problems - always - with 'custom' PC builds.
Title: Re: macOS 32-bit app warning
Post by: VTwin on April 15, 2018, 10:43:51 pm
macOS 10.13.4 now warns the first time you run a 32-bit app.

This is unfortunate. I am a long time Apple user, and have had numerous desktops and laptops over the years at work and home. Recently I'm the owner of my second iPhone, and an iPad for work. For context, the free software I develop on a Mac for Mac, Windows, and Linux is used by thousands of scientists, educators, and professionals around the world. So please forgive a small rant.

<rant>
Apple keeps ratcheting up the difficulties of small software developers, clamping down and shutting us out, while back in the day they championed us. Apple, of course, is in the hardware business, and closing down 32 bit support is in their interest. Microsoft has more reason to continue 32 bit support. Clearly 64 bit is the future, but at this point I seriously doubt that my software will benefit from 64 bit architecture. Support for iPad and iPhone development is another matter, while I'd love to support them, I don't anticipate diving into Swift and the App Store anytime soon. However, I don't make my living from coding.
</rant>

I kissed REALbasic (Xojo) goodbye for good a long time ago, and am a huge fan of Free Pascal/Lazarus. Looking at the Lazarus Roadmap, cocoa is coming along well, but I'm still hampered by the missing ScrollBar, Accelerator Keys, ImageList, ToolBar, DrawGrid, and PaintBox. Without these I can't compile. I'd step up with bounties, but I'm giving away my software for free. Contributing widget code is probably beyond me, so I'll try to help debug.

I look forward to progress in the Lazarus cocoa widget set, and will try to assist as I can. Many thanks to the developers for their work!

Cheers,
VTwin
Title: Re: macOS 32-bit app warning
Post by: VTwin on April 15, 2018, 10:50:44 pm
I don't suppose Apple could pay one person to support Lazarus development, or even support a bounty...  :(
Title: Re: macOS 32-bit app warning
Post by: Phil on April 15, 2018, 10:53:56 pm

Apple keeps ratcheting up the difficulties of small software developers, clamping down and shutting us out, while back in the day they championed us.

I would say it _simplifies_ things for small software developers, since now developers only have to worry about targeting a single architecture (for now, that is). And for users, once 32-bit is dropped, the footprint that macOS takes up on their file system will shrink dramatically (by about half for any executables and libraries which currently include both 32-bit and 64-bit slices).

If / when Apple introduces an ARM-based macOS, then developers will need to target that as well, so not having to worry about 32-bit Intel will be a blessing.

For Xcode developers, this is just a switch you set in Build Settings, not much more than that.
Title: Re: macOS 32-bit app warning
Post by: skalogryz on April 15, 2018, 11:54:52 pm
Looking at the Lazarus Roadmap, cocoa is coming along well, but I'm still hampered by the missing ScrollBar, Accelerator Keys, ImageList, ToolBar, DrawGrid, and PaintBox. Without these I can't compile.
Could you please provide a test app for each of those components?
Explicitly showing the missing functionality (in cocoa).
Title: Re: macOS 32-bit app warning
Post by: VTwin on April 16, 2018, 01:47:18 am
@Phil
Excellent point. I used to distribute FAT binaries, glad to be done with that. I'll be happy to move to 64 bit only.

@skalogryz
Thanks, I will work on that. Is that something I should post in lazarus bugtracker?

Cheers,
VTwin
Title: Re: macOS 32-bit app warning
Post by: VTwin on April 16, 2018, 01:50:28 am
BTW I remember the days of having to deal with DOS Extended/Expanded memory. Ugh!
Title: Re: macOS 32-bit app warning
Post by: skalogryz on April 16, 2018, 01:52:48 am
@skalogryz
Thanks, I will work on that. Is that something I should post in lazarus bugtracker?
Bugtracker is the best, but posting them here would work as well
Title: Re: macOS 32-bit app warning
Post by: dbannon on April 18, 2018, 01:09:24 am

@skalogryz, I greatly appreciate your interest in getting the 64 mac code happening !

I tried my app with Cocoa a few months ago using a recipe by Phil for getting the head verson of LCL. At the time, memory leaks and badly scaled components were an issue but it did compile after a bit of fiddling. I retained that fiddling in my project to keep the door open....

Am I right in saying I must use the head LCL (obviously) but can continue using 1.8 of Lazarus and matching FCL and FPC ?

I reckon a short HowTo might get a few more people looking at the Cocoa code. Many of us just use the "out of the box" model and its great normally !

David

my project - https://github.com/tomboy-notes/tomboy-ng

Title: Re: macOS 32-bit app warning
Post by: Clover on April 19, 2018, 04:34:52 pm
I released 64-bit Lazarus ports of my game last week on my website and the Mac App Store for this very reason. Still early days, but so far so good - one user has reported an Open File dialog unexpectedly quit one time.

It's galling, I'd previously ported from Lazarus to FireMonkey to add Android and IOS editions. But App Studio still only supports 32-bit Mac despite 64-bit expected "sometime" in 2018. I was fortunate I could resurrect my Lazarus code for 64-bit Mac in the meantime.
Title: Re: macOS 32-bit app warning
Post by: dbannon on April 20, 2018, 02:07:50 am
My initial tests against 64Cocoa were not very sucessful. But I need to look at it a bit more to see whats really happening before logging reports. But here is a brief summary.

I pulled down SVN, build a 32bit Carbon IDE ('cos I found the 64Cocoa one flakey) and used it to build my 64bit Cocoa app. I noticed -

These problems can be demonstrated with simple one form apps. 1. is probably just a sensible change, 2. and 3. I feel I need to have a further play before formally reporting. Interestingly, only 2. seems to be a pure Cocoa issue. Maybe test on Linux .....   


 
Title: Re: macOS 32-bit app warning
Post by: Phil on April 20, 2018, 02:34:41 am
  • Harder One. I hide my main form on startup and on Carbon, when its active (but hidden) its MainMenu still occupies the Mac Main Menu space, across the top. However, with Cocoa, that main menu does not show up when form is hidden. So, for me, no control of the App.
  • Nasty One. Again, trunk, not just Cocoa. When you run it from within the IDE, an app's main menu is, again, not shown across the top and an icon for the app is not shown in the plank. This seems similar to above but is not, I think, because - Not just a Cocoa problem; You can grab a terminal and 'open' the compiled app and it does work normally; no Icon in the plank (unlike 2 above).

These problems can be demonstrated with simple one form apps. 1. is probably just a sensible change, 2. and 3. I feel I need to have a further play before formally reporting. Interestingly, only 2. seems to be a pure Cocoa issue. Maybe test on Linux .....

I can confirm (3) - running a Cocoa app under Cocoa IDE.

With (2), perhaps it's just lost the focus? When you click on the app on the Dock, does the app's menu appear?

Note on terminology: "menu bar" and "Dock", although "plank" is pretty funny. See System Preferences: General and Dock for terminology examples.
Title: Re: macOS 32-bit app warning
Post by: dbannon on April 20, 2018, 04:48:08 am
Hi Phil, I have not had time to investigate further, maybe latter today.

Said Phil :
With (2), perhaps it's just lost the focus? When you click on the app on the Dock, does the app's menu appear?
No, clicking the icon in the 'Dock" (see, I'm learning), does not appear to do anything.

Said Phil
  "...menu bar" and "Dock.."
Ah, really ?  On my Linux system, same sort of interface, its called (I believe) a "Plank". Have to watch that, could cause some confusion. Fortunatly, the Mac users of my app don't have high expectations but I'll revisit some of my docs, thanks !
Title: Re: macOS 32-bit app warning
Post by: Phil on April 20, 2018, 04:55:55 am
With (2), perhaps it's just lost the focus? When you click on the app on the Dock, does the app's menu appear?
No, clicking the icon in the 'Dock" (see, I'm learning), does not appear to do anything.

It is possible to see apps on Mac where just the menu bar appears - example: TextEdit. But these apps don't do it by hiding the window. Rather, the window is not yet open. See if that works for you. Hiding the window seems like an odd thing to do.

On second thought, that might be an LCL oddity: when you close the main window, the app closes. Mac apps don't normally behave like that. So perhaps hiding the window is your workaround for LCL peculiarities?
Title: Re: macOS 32-bit app warning
Post by: dbannon on April 20, 2018, 06:36:17 am
Yes Phil, I have done it like it is because of a (self imposed) constraint of being cross platform with minimal code unique to one platform.

The Linux and Windows version of the  app use the tray icon but I quickly discovered it did not really produce a Mac like experience and, on the Mac, leaked like a sieve ! So, I have a main menu that duplicates the tray icon popup menu and some ifdef-ing to handle the different platforms. It results in  pretty simple transition between Mac and the other two.

I don't quite see how a menu can be displayed before the Form its associated with is created ? Maybe thats just not the way LCL thinks ?   I suppose I could transfer "main-ness" to another, simple form that does show and move the Mac menus there but it would mean a different look and feel (and quite a lot of different code) between platforms.

Sad thing is, it does work quite well using Carbon ....

I do wonder if this specific problem will go away if and when the "don't show menu when debugging" is fixed. They are, to some degree, similar.  :-\

The Application itself is a replacement for the old Tomboy Notes, a Mono app that has lost much of its user base. For a long time it had a separate Mac stream, some common code but was evolving into a different beast and became abandon ware (the Mac part I mean).

So, in discussion, I quoted the "write once, build anywhere" slogan and the rest, as they say, is history.

David
Title: Re: macOS 32-bit app warning
Post by: Hansaplast on April 20, 2018, 11:58:03 am
I have been trying for a while now to develop my applications with Cocoa and just keep running into the same issues.
Also note that I've asked this question before, so feel free to ignore this message ...


In the past, when creating an application for Windows, Linux and MacOS (Carbon), I enjoyed the luxury of designing my application on one platform (typically MacOS) and then copy the sources to a Linux or Windows VM to simply recompile it.
This always worked very well - the user interface design matched beautifully on all 3 platforms. Sure there are some small differences like the shape of a button or the tabs on a TPageControl. But in the end, things were placed the same way (position/size), fonts were the same size, etc.


With current Cocoa development this is no longer the case.
Fonts are smaller, TPageControl is not even the same width, etc. (I've posted examples and corrections in other posts)
I understand that the goal of the developer(s) involved is to match a design of XCode as close as possible. With all respect to them, since they do a lot of great work for which I'm very grateful, but is this the route Lazarus is going to follow?
On top of that: Cocoa is not (yet) mature enough for use with the IDE (designtime), so I find myself having to work with Carbon (or a different platform like Windows) to find out that all my work has to be corrected to make it look comparable in Cocoa.


I guess what I'm asking is; to accomplish the ability to develop for 3 platforms (Windows, Linux and MacOS Cocoa);
- Should I add additional compiler directives to modify width, height, margins, font size etc. so my design works on all 3 platforms?
- Or will there be an alternative working method (match LCL or match XCode)?
- Or would it be better to make Cocoa look closer to the design no matter what platform we use (of course with the exception of buttons shapes or size, tabs shape for TPageControl)?


The current direction makes it a pain to modify all my existing apps to move to Cocoa, and development of cross platform applications in the future will be a pain as well.


Just to be clear; nothing but great respect for the developers!
They are doing a great job which as usual is greatly under-appreciated.


I'd just like to know what the right way to develop a UI for my applications will be.
Title: Re: macOS 32-bit app warning
Post by: mischi on April 20, 2018, 01:06:55 pm
I do not really know, whether this helps, but you might also try Qt4 or even Qt5 on macOS. Maybe, they need less modifications.

So far, I have done only a small hobby project for win, linux and macOS (carbon). Even then, i needed a small number of adjustments and created an extra unit with the platform specific values.
Title: Re: macOS 32-bit app warning
Post by: Hansaplast on April 20, 2018, 02:07:30 pm
Thanks Mischi,


I did explore Qt as well - not too thrilled with the need to install or include the Qt framework though.


I'm doing small hobby projects as well, that sometimes spin out of control  :D . I offer the apps for free on my website and before you know it they get downloaded tons of times. One of my apps has been downloaded more than 500,000 times  :o .
Title: Re: macOS 32-bit app warning
Post by: dbannon on April 21, 2018, 02:43:13 am
Quote
..... When you run it from within the IDE, an app's main menu is, not shown across the top and an icon for the app is not shown in the Dock. Only interaction with the running app is to close (or full screen) it. But you can grab a terminal and 'open' the same compiled binary and it does work normally, the problem is only when running from within the IDE.

OK, I have determined this problem is Mac only. It shows up on a Carbon IDE and (via Phil) a Cocoa IDE.

But more worryingly, I have gone back two weeks (57612) and then six weeks (57426) and its still there !   In that time there have been a lot of commits, including quite a lot addressing Cocoa. So, maybe the people doing those commits are using an older (ie 1.8 release) IDE but working on, perhaps the trunk LCL ?

Six weeks seems a long time for this problem to go unnoticed ?

Could one other Mac user please confirm ?  Its pretty easy as long as you already have a working Lazarus 1.8 and its won't mess with your existing install.

In a terminal, go somewhere suitable and -
Code: Pascal  [Select][+][-]
  1. mkdir laz-svn
  2. cd laz-svn
  3. svn checkout https://svn.freepascal.org/svn/lazarus/trunk .
  4. make CPU_TARGET=i386
  5. open lazarus.app --args "--pcp=~/.laz-svn"

Check the setting and click "start IDE"
Then click Options, scroll down to Debugger->General and paste
Code: Pascal  [Select][+][-]
  1. "--eval-command=set startup-with-shell off"
(inc the ") into the field "Debugger specific Options" and, IMPORTANT, press <enter> at the end of the line.  Save.

Paste a button (or anything) into the blank form thats been waiting for you to come back, click the green 'Run' icon and, when the running form is displayed, can you interact with it ?

Davo
Title: Re: macOS 32-bit app warning
Post by: Hansaplast on April 21, 2018, 10:34:44 am

I have these 2 Lazarus versions running (version info copied from the "About" window with right click):
I have to run the IDE in 32 bit Carbon since the IDE is not workable in 64 bit Cocoa (see also my previous post/question).


For 64 bit I must set the compiler to /usr/local/bin/fpc, for 32 bit /usr/local/bin/ppc386 - otherwise I get an error message.
So when building the IDE the compiler must be "ppc386", but when I build a 64bit application I must switch to fpc again (maybe an issue with my setup of course).
When I create a new application, and simply right away run it ...


Lazarus v1.8.2:
64 bit Cocoa: the icon appears in the dock and the menu is visible (but the menu is empty - there are no items!).
32 bit Carbon: the icon appears in the dock and the menu is visible (this time with the default items like services, quit, etc!).


Lazarus 1.9.0 SVN:
64 bit Cocoa: no dock icon, and no menu.
32 bit Carbon: no dock icon, and no menu, can't even get the main form to get focus.


Devs: please feel free to contact me if you'd like me to test something - I'd be more than happy to help and test wherever I can.
Since SVN is always under development, I have learned to not jump the gun right away and just be patient for a couple days when something doesn't work, or for example when I cannot compile the IDE.
Title: Re: macOS 32-bit app warning
Post by: Hansaplast on April 21, 2018, 10:46:18 am
In a terminal, go somewhere suitable and -
Code: Pascal  [Select][+][-]
  1. mkdir laz-svn
  2. cd laz-svn
  3. svn checkout https://svn.freepascal.org/svn/lazarus/trunk .
  4. make CPU_TARGET=i386
  5. open lazarus.app --args "--pcp=~/.laz-svn"

Check the setting and click "start IDE"
Then click Options, scroll down to Debugger->General and paste
Code: Pascal  [Select][+][-]
  1. "--eval-command=set startup-with-shell off"
(inc the ") into the field "Debugger specific Options" and, IMPORTANT, press <enter> at the end of the line.  Save.

Paste a button (or anything) into the blank form thats been waiting for you to come back, click the green 'Run' icon and, when the running form is displayed, can you interact with it ?


Followed these steps as well (Lazarus 1.9.0 r57663 FPC 3.0.4):


Carbon/32bit:
No dock icon and no menu. I cannot interact with the form or the button - the form/window never gets focus. However the system menu/icons can be clicked to close the window.


Cocoa/64bit:
No dock icon and again no menu. However I can interact with the form (form does get focus) and the button responds to clicking.
Title: Re: macOS 32-bit app warning
Post by: dbannon on April 21, 2018, 02:16:41 pm
Hmm, well, thats interesting Hans, really does look like this is a problem.

" I have learned to not jump the gun right away and just be patient for a couple days..."

Yep, agree. But in this case, I have been back a month and a half and the problem is still there. So, I guess no one on the Dev team is testing against Mac ?

I don't see any bug reports that sound like this issue but I'm not good at searching the bug list. I suspect you need more permissions than I have to use any sort of useful filters.

Anyway, I think this does need to be reported, any objections ?


Related matters
Hans, I don't need to change compiler when changing between Carbon and Cocoa. To go from carbon to cocoa, I change Target CPU family from default to x86_64  and then click the link that says "Select another LCL widgetset ..." and from there, I choose 'cocoa'.

(removed ref to a bug that exists in 1.8 but is fixed in Trunk !)
Title: Re: macOS 32-bit app warning
Post by: Phil on April 21, 2018, 02:21:16 pm
Hans, I don't need to change compiler when changing between Carbon and Cocoa. To go from carbon to cocoa, I change Target CPU family from default to x86_64  and then click the link that says "Select another LCL widgetset ..." and from there, I choose 'cocoa'.

Per Lazarus and all other IDEs: create two build modes, one named "Carbon", one named "Cocoa" and make any changes needed there, rather than fiddling with settings each time you need to switch between them. Obviously you could also have additional build modes if you need to change any settings for, say, a Windows build.
Title: Re: macOS 32-bit app warning
Post by: dbannon on April 21, 2018, 02:34:30 pm
Good idea Phil. Think I should use the Build Mode more often...

Phil, do you think the bug about an app not being usable in the IDE on Mac should be reported ? Three of us have now seen it .....

I have not had a lot of success in reporting bugs so my confidence is not high  :-\

Davo
Title: Re: macOS 32-bit app warning
Post by: Phil on April 21, 2018, 02:40:10 pm
Good idea Phil. Think I should use the Build Mode more often...

Take a look at lainz's app here:

https://github.com/Arandusoft/fpcpaymowidget

The .lpi file has 9 build modes (Release-win32, Release-win64, etc.). That's the way it's done.

Phil, do you think the bug about an app not being usable in the IDE on Mac should be reported ? Three of us have now seen it .....

I have not had a lot of success in reporting bugs so my confidence is not high  :-\

Reporting doesn't necessarily mean it will be fixed, but NOT reporting it almost certainly means it WON'T be fixed.
Title: Re: macOS 32-bit app warning
Post by: dbannon on April 22, 2018, 03:00:48 am
OK, I have logged this (no focus when run in IDE) issue #0033627

Davo
Title: Re: macOS 32-bit app warning
Post by: Hansaplast on April 22, 2018, 02:23:30 pm
Thanks for the build mode tip - I never had a purpose for it (or so I though), I was wrong  :D  ....
Learn something new every day ...


Do any of the Mac users care to chime in on the question if a design on all platforms should look at least kind-a similar?
ie. design under Carbon, Windows or Linux and compile under Cocoa with a reasonable match position and size wise - with the exception of a few oddities like TButton limitations under Cocoa and the different tabs on a TPageControl.


Or is there an easier "trick" to compensate in code (although I doubt that would be a good programming practice especially when things change in the future)?
Title: Re: macOS 32-bit app warning
Post by: LazProgger on April 22, 2018, 07:45:23 pm
I think, the cocoa widgetset should be designed to look similar in sizes and proportions so that you can reuse your Windows or Linux code without modifications - and like it is for carbon today. Other implementations would make no sense.
Title: Re: macOS 32-bit app warning
Post by: dbannon on April 23, 2018, 08:54:51 am
Bug Reports

Just tp be clear, (I was not initially) - I have logged two bug reports for Trunk, one against Carbon and one against Cocoa but I am convinced its the same underlying problem.

Carbon - an application does not interact if run from the IDE #0033627
Cocoa - an application run from the IDE does not put its Menu in place nor show an icon in the dock. #0033634

I have narrowed this all down to svn r56760, that seems to stop all running from within IDE, partially fixed (ie the way we see it now) in r56771. This was mid December. And the stuff being committed does not seem at all likely to cause what we are experiencing. To me. Good thing I don't have commit access  ;)

Seems a long time for no one else to have picked it up ....

Davo
Title: Re: macOS 32-bit app warning
Post by: Josh on April 23, 2018, 09:40:54 am
Just a thought, have you created the application bundle when targeting mac?
Option is under project option.
All Mac GUI should be run from the bundle; not the compiled binary.
the bundle has a link back to the compiled binary which will not be in the bundle, when you want to use this bundle to distribute or create a dmg etc; you will need to replace the link in the bundle with the binary.
if you click the bundle and explore the package; you will see it has folders and files in it, you can for example add libraries, fonts in the bundle and the plist.info file can hold information like app version, package icon etc etc.


Title: Re: macOS 32-bit app warning
Post by: Hansaplast on April 23, 2018, 11:03:51 am

I think, the cocoa widgetset should be designed to look similar in sizes and proportions so that you can reuse your Windows or Linux code without modifications - and like it is for carbon today. Other implementations would make no sense.
Totally agree ... or at least: this is how I'd like to see it as well.
However the devs appear to be aiming to match XCode - for example font size = 8 in XCode is much smaller than in Carbon/Windows/Linux.
Right now, in Cocoa's current state, I have to do this to make the font size match:


Code: Pascal  [Select][+][-]
  1.   procedure fixCocoaLabels;
  2.     var FontCorrection:Double;
  3.         Counter:integer;
  4.     begin
  5.       FontCorrection := 11/8;
  6.       for Counter:=0 to self.ComponentCount-1 do
  7.         if self.Components[counter] is TLabel then
  8.           TLabel(self.Components[counter]).Font.Size:=trunc(FontCorrection*tmpLabel.Font.Size);
  9.     end;      


Obviously this is not the way to do this ... it makes it for a poor way to design a UI, since you can't see it at design time if the IDE ever runs reliable under Cocoa. But even worse of course when the size rules change at a later time.
Before spending hours on designing things the wrong way ... what does the Lazarus Dev team think of this?
I can't seem to get a clear statement ...
Title: Re: macOS 32-bit app warning
Post by: skalogryz on April 23, 2018, 02:53:38 pm
However the devs appear to be aiming to match XCode - for example font size = 8 in XCode is much smaller than in Carbon/Windows/Linux.
If you're using the trunk, you should be able to do it in the following manner:
Code: Pascal  [Select][+][-]
  1. uses  ...
  2.   {$ifdef LCLCocoa}
  3.   , CocoaInt
  4.   {$endif};
  5.  
  6. initialization
  7.   {$ifdef LCLCocoa},
  8.   CocoaBasePPI := 72;
  9.   {$endif}
  10.  
It will not help with designed controls, but changing font in run-time will match Xcode.

Starting with 1.8 release, the Cocoa (and Carbon) PPI is 96, rather than 72.
Thus LCL selected fonts of the a particular size (in points) would not match the same font and the same size selected in Xcode or TextView.

I was trying to resolve the issue on case-by-case basis, however cross-platform needs took over. And 96 ppi rule remains.
The code above however allows to switch Cocoa back from 96 to 72 for run-time.
Title: Re: macOS 32-bit app warning
Post by: ChrisR on April 23, 2018, 04:27:39 pm
dbannon, regarding issue 33634, I think this is a replication of 32888. Does changing the lpi file as noted in that issue fix your problem?
Title: Re: macOS 32-bit app warning
Post by: Hansaplast on April 23, 2018, 11:55:38 pm
It will not help with designed controls, but changing font in run-time will match Xcode.

Starting with 1.8 release, the Cocoa (and Carbon) PPI is 96, rather than 72.
Thus LCL selected fonts of the a particular size (in points) would not match the same font and the same size selected in Xcode or TextView.

I was trying to resolve the issue on case-by-case basis, however cross-platform needs took over. And 96 ppi rule remains.
The code above however allows to switch Cocoa back from 96 to 72 for run-time.


Thanks skalogryz - I'll give that a try.
And thanks for the PPI explanation.  :)

Title: Re: macOS 32-bit app warning
Post by: Hansaplast on April 24, 2018, 12:03:45 am

@ skalogryz ;
Where do I put this part of the code?


Code: Pascal  [Select][+][-]
  1. initialization
  2.   {$ifdef LCLCocoa}
  3.   CocoaBasePPI := 72;
  4.   {$endif}
  5.  


I have tried several places (the "uses" seems to work fine) but keep getting the error: Identifier not found "CocoaBasePPI"
Title: Re: macOS 32-bit app warning
Post by: Phil on April 24, 2018, 12:08:16 am
Where do I put this part of the code?

It's in the CocoaInt unit, so be sure to include it in your uses.

Make sure you're using the latest trunk source. cocoaint.pas was modified on April 19.
Title: Re: macOS 32-bit app warning
Post by: dbannon on April 24, 2018, 03:20:54 am
dbannon, regarding issue 33634, I think this is a replication of 32888. Does changing the lpi file as noted in that issue fix your problem?

Yes Chris, you got it in one! I have answered you in the bug tracker but for benefit of people reading this thread -

The problems running Carbon or Cocoa applications from within Lazarus is a know issue, #0032888. There is even an ugly workaround (most workarounds are ugly !). You can manually edit a small section of your project's LPI file, it does not seem to affect earlier releases.

Davo
Title: Re: macOS 32-bit app warning
Post by: Hansaplast on April 24, 2018, 09:40:19 am
It's in the CocoaInt unit, so be sure to include it in your uses.
Make sure you're using the latest trunk source. cocoaint.pas was modified on April 19.


Awesome that did the trick.  :D
Title: Re: macOS 32-bit app warning
Post by: LazProgger on April 24, 2018, 10:59:04 am
However the devs appear to be aiming to match XCode - for example font size = 8 in XCode is much smaller than in Carbon/Windows/Linux.

But what is the reason for matching XCode?

I think, most Lazarus users on macOS are cross-platform developers coming from Windows or Linux and want to make their programs run also on a Mac. Someone who is only developing for Mac and known to XCode and the Mac world, would probably rather use XCode directly and not Lazarus.

So, in my opinion, Lazarus should better fit those cross platform developers to make their lifes easier, because this is something XCode cannot do and is Lazarus unique selling point, even for users coming from the Mac and wanting their code also porting to Windows or Linux. Those people would probably not thing "Oh I want to use the same font size like in XCode" but "Oh cool I can reuse my code for all platforms without any modifications!".
Title: Re: macOS 32-bit app warning
Post by: dbannon on April 24, 2018, 11:07:53 am
Quote
I think, most Lazarus users on macOS are cross-plattform developers coming from Windows or Linux and want to make their programs run also on a Mac.

Yes, I agree. Lazarus - Write Once - Compile Anywhere, Lazarus's slogan and feature. Its the one thing (IMHO) that Lazarus is far better at than any alternative. Its silly trying to compete directly with (eg) XCode, better to play to our strengths and ensure absolutely minimum changes between platforms.

Davo
Title: Re: macOS 32-bit app warning
Post by: LazProgger on April 24, 2018, 11:12:22 am

Lazarus - Write Once - Compile Anywhere, Lazarus's slogan and feature. Its the one thing (IMHO) that Lazarus is far better at than any alternative. Its silly trying to compete directly with (eg) XCode, better to play to our strengths and ensure absolutely minimum changes between platforms.

Davo

I absolutely agree. That is Lazarus' gap in the market and that should be what we should have in mind wherever possible.
Title: Re: macOS 32-bit app warning
Post by: Hansaplast on April 24, 2018, 11:23:08 am
Quote
I think, most Lazarus users on macOS are cross-plattform developers coming from Windows or Linux and want to make their programs run also on a Mac.

Yes, I agree. Lazarus - Write Once - Compile Anywhere, Lazarus's slogan and feature. Its the one thing (IMHO) that Lazarus is far better at than any alternative. Its silly trying to compete directly with (eg) XCode, better to play to our strengths and ensure absolutely minimum changes between platforms.

Davo


Completely agree ...
I have used Lazarus for several years now, comming from Delphi, and it's strength is that I develop an application on one platform (typically Mac by the way) and recompile it on Linux and Windows without too much effort. For me this has been one of it's strengths and I have not found that there is no alternative that can match this (IMHO - unless you count Xojo, but that's just not my cup of tea).
So I don't even care if it matches XCode or not (I don't even like XCode) - it's not even relevant.
As long as I can design my application on one platform and deploy it on another without having to tinker with the UI too much.
I think completion of the Cocoa widgetset will be a great win - but I realize it takes a lot of work (much gratitude and respect for all the devs).
Title: Re: macOS 32-bit app warning
Post by: LazProgger on April 24, 2018, 11:40:22 am
I hope some of the developers involved in the cocoa implementation are reading this...
Title: Re: macOS 32-bit app warning
Post by: ChrisR on April 24, 2018, 02:46:15 pm
LazProgger and dbannon, I understand your viewpoint, but respectfully disagree. There are much more popular tools that provide a OS-independent widgetset. For example, Java, Electron and QT are all mature tools that can be deployed to different operating systems. However, in striving for platform independence they tend to look out of place on all systems. What is impressive about the LCL is that it targets the native widgetset, so the resulting applications look professional and are easy to deploy (having few library dependencies).

This necessarily places some constraints on design, which are documented, e.g.
  http://wiki.lazarus.freepascal.org/Cocoa_Internals/Buttons

The LCL does provide a few widgets that use the Themes drawing (e.g. SpeedButton) - and these will tend to be more platform independent (e.g. they do not use a native base Cocoa class). You can choose these to get a bit more platform independence, but these artificial widgets also tend to need a lot of maintenance, and may look out of place with future OS updates (for example, the MacOS dark mode has revealed some weaknesses with relying on these non-native components).

I personally believe that Lazarus fills a small but important niche providing professional quality, native compiled, native widgetset, low dependency applications. I think the proper solution will be in documenting the way to use anchors to align widgets across platforms. A few tutorials would go a long way here. This is a great start:
 http://wiki.freepascal.org/Anchor_Sides
 http://wiki.freepascal.org/Autosize_/_Layout

As an aside, I think the 1.9 SVN has made terrific strides - Ondrej's DPI-aware TImageList provides a cross-platform method to support high-dpi screens, and Dmitiry's progress on Cocoa has been staggering (building on Felipe's seminal work). There are a few rough edges, but the vast majority of the LCL works. With community help, I think we can push Cocoa out of alpha-state and the next big (2.0?) Lazarus release will be a quantum jump forward.

I also think Hansaplast provided a nice example of how a few minor tweaks could enhance the appearance. Once the foundation of the Cocoa widgetset is finished the community can work on the details. I think it is fantastic that we are now able to focus on these details, it demonstrates the main Cocoa IDE is really coming together.
  http://forum.lazarus.freepascal.org/index.php/topic,39396.90.html
Title: Re: macOS 32-bit app warning
Post by: dbannon on April 25, 2018, 03:15:36 am
Chris, problem is, the concept of Cross Platform is hard ! Programmers want to write once, users want a familiar looking interface, so a compromise needs to be found. A project with lots of resources can 'afford' to maintain individual platform dependent aspects. But I am working on a project to replace Tomboy Notes. Tomboy is struggling because it cannot find those those disparate resource. I choose Lazarus to replace it because of the "Write Once, Compile Everywhere" promise.

I worry about the (eg) font size problems and now I have to deal with the looming "Cocoa or nothing" threat.  :-\

I suspect the majority of our Cross Platform users have a similar model. But, like you, I would not accept a badly compromised look and feel. Sigh ...

12 months ago I thought Cocoa was something you mixed with hot milk. Now, like Chris, I am excited about the progress that Cocoa has made. Pretty amazing and I thank, very loudly, the people concerned !

Davo
Title: Re: macOS 32-bit app warning
Post by: Hansaplast on April 27, 2018, 12:07:03 pm
I agree with Davo.


I'm OK with limitations, like the standard TButton - this helps give the look and feel of Cocoa.
As for the application design, well either I compromise or (if needed) code Cocoa specific (which I'd like to avoid).
Button size is actually not a big deal, one can always divert to TBitButton or create one's own button.


The font size; yeah that's a problem, but I understand this is a PPI issue, which is being worked on. I hope I understood that right.


On that note though; the TMainMenu doesn't work in Cocoa either (running SVN).
I recall from Carbon that one would need to add some code to make a Mac menu - maybe this is something missing with Cocoa as well. Which may be a nice thing to add as a default for Cocoa and/or Carbon. (even though I'm not too concerned with Carbon since it's dying anyway)


I guess the point is:
By default design on any platform (Win/Linux/Mac) and compile it on any other platform (Win/Linux/Mac) without much effort on the UI design. Unless of course one really wants to do something specific for a platform.
Right now (with Cocoa) this simply does not work (yet).
Title: Re: macOS 32-bit app warning
Post by: dbannon on April 27, 2018, 01:22:11 pm
Hans, with TMain menu, if you are using an older project in the new SVN, there is another couple of things you need to "transplant" back in the lpi file. In addition to the ones identified in Chris's bug report.

Compare a newly made (from SVN) lpi and your older one, look for lines like "DPIAware" and "Scaled Value", sorry, away from home with now but you will easily spot it when comparing old and new ....

Personally, don't see how such things affect main menu but they do.

But I am seeing a lot of memory leaks and rather coincidently, heaptrc is still crippled on Mac. Sigh ...

Davo
Title: Re: macOS 32-bit app warning
Post by: dbannon on April 28, 2018, 08:01:48 am
The memory leak I mentioned is associated with TPageControl.
Logged as issue #0033659

Davo
Title: Re: macOS 32-bit app warning
Post by: Hansaplast on April 30, 2018, 11:58:08 am
Hans, with TMain menu,...


Thanks Davo - the issue seems to be resolved. TMainMenu is now (in Lazarus 1.9.0 r57735M SVN) working again in Cocoa.
Just a minor issue is that some of the default items do not appear ("Services", "Hide Others" and "Show All").
Probably better to post this in bugtracker?


Cocoa also does not seem to display icons (images) one would puts in front of a menu item, and hovering over a menu item that opens a submenu triggers onclick() (not sure if this is expected behaviour since Carbon does almost the same thing).
Title: Re: macOS 32-bit app warning
Post by: dbannon on May 01, 2018, 02:13:31 am
Yes Hans, I can confirm that missing block in the the project's menu. Has been like that for some time, as long as I have been playing with Cocoa perhaps ?  It does not worry me as those options are not really relevant to my app but as we know, Mac users have certain expectations ...

So, it is a bug but probably just a minor one. { Mind you, they called the ones we thought very important "minor". Not sure what would be needed to be greater than "minor" ? ;)  }

Anyway. yep. it would help to make Lazarus on Mac just that bit more polished.

I have my app running pretty well now under Cocoa, minor memory leak in TPageControl but it looks and feels pretty good. We sure have seen a huge improvement in the last couple of months !

Davo
Title: Re: macOS 32-bit app warning
Post by: Gilles on May 02, 2018, 02:09:23 pm
Hello

by the way…

is there any project-example, built to run with xcode, and to target 64bit High Sierra ?

(a basic project, to put a "hello word"… I don't success in begining a new project in Pascal with xcode 9.1
Title: Re: macOS 32-bit app warning
Post by: Phil on May 02, 2018, 02:22:55 pm
is there any project-example, built to run with xcode, and to target 64bit High Sierra ?

See the ProjectXC article here:

https://macpgmr.github.io
Title: Re: macOS 32-bit app warning
Post by: Gilles on May 02, 2018, 02:40:18 pm
aahhh merci merci merci  :D

and is there any way to add colors for key-words (like "begin" "end" and so on ) ?
Title: Re: macOS 32-bit app warning
Post by: Phil on May 02, 2018, 02:54:59 pm
aahhh merci merci merci  :D

and is there any way to add colors for key-words (like "begin" "end" and so on ) ?

Yes, see article.
Title: Re: macOS 32-bit app warning
Post by: Gilles on May 05, 2018, 04:13:40 pm
Cool and merci again

the tool didn't work
but by doing it, following what it was supposed to do, the result was  perfect

(by the way : I miss CodeWarrior, where you could have several colored lists of key-words and not just only one…)
Title: Re: macOS 32-bit app warning
Post by: jwdietrich on May 05, 2018, 05:06:57 pm
(by the way : I miss CodeWarrior, where you could have several colored lists of key-words and not just only one…)

Do you know that you can change and even define color schemes in Lazarus? See http://wiki.lazarus.freepascal.org/UserSuppliedSchemeSettings (http://wiki.lazarus.freepascal.org/UserSuppliedSchemeSettings).
Title: Re: macOS 32-bit app warning
Post by: Gilles on May 06, 2018, 09:17:35 am
In CodeWarrior, I had defined a color for all Mac Routines, another for Pascal key-words, one for numbers, and so on
I found only one key-words list in XCode and it is used for Pascal key-words (et c'est déjà pas mal ;) )
I don't know Lazarus… more than one list of key-words in Lazarus ?
Title: Re: macOS 32-bit app warning
Post by: VTwin on May 15, 2018, 07:38:21 pm
@skalogryz
Thanks, I will work on that. Is that something I should post in lazarus bugtracker?
Bugtracker is the best, but posting them here would work as well

I have been too busy to do much on this, but have tried a few controls now. I was pleasantly surprised to find that TScrollBar, TPaintbox, and TDrawGrid are in pretty good shape. I'll try to do further testing on them.

TImageList does not work in Cocoa though, so I have attached a simple project to demonstrate. I'll post it in BugTracker as well.

Cheers,
VTwin


EDIT: Responding to some of the thread here, I develop on Mac, and then deploy on Win and Lin as well. I have no desire to spend the time learning XCode and Swift and limit my audience. With literally 1000s of happy customers, the Lazarus approach has served me well. I spent a decade or so in REALbasic (aka Xojo), simply because it cross-compiled, but it was slow among many other limitations. So glad to to have made the switch.
Title: Re: macOS 32-bit app warning
Post by: MISV on May 19, 2018, 01:04:12 pm
Is there anything that needs testing? I use Lazarus/Carbon for porting my Windows apps, so the warnings is a bit of a problem for me. But I guess one can only blame oneself for not learning the underlying Mac libraries and API, so one could help more directly on the Cocoa implementation. I am grateful for those who are working on the Cocoa implementation + those who have issued bounties. (Thank you)

I think priority should be to get all controls essentially working - if a control look a bit different in height/width etc. that can for now be corrected with some runtime code fixing sizes etc. (I personally already do that now since I also maintain Delphi/VCL compability)
Title: Re: macOS 32-bit app warning
Post by: Thaddy on May 19, 2018, 01:47:24 pm
Apple is phasing out/ has phased out 32 bit. When targeting MAC you *must* use 64 bit. If not now, within weeks... not years... Although some support will be provided until 2020.

Apple's warning dates from 2016....
If you are trying to port code that relies on 32 bit that is a big mistake and you just are caught out.....

I have no pity with the dumb.
Title: Re: macOS 32-bit app warning
Post by: dbannon on May 19, 2018, 02:42:00 pm
Quote
If you are trying to port code that relies on 32 bit that is a big mistake and you just are caught out.....
Ideally, to port your 'Lazarus' code from 32bit to 64bit you need to change CPU Target, the widget set (Carbon->Cocoa) and the compiler. Three settings and build.

Its likely however, you will find some things that work a little differently but more importantly, you find some things that don't work as they should yet. Someone taking this approach is not dumb, they simply had no choice. Six months ago Cocoa was unusable, today, its amazingly close !

Right now MISV, I know of two things not working, Memory leaks in PageControl and  Printing. Bet there is more of course but thats hardly surprising.

In the category of things that are a different, requiring some coding around, only one. In Carbon, I could hid my main window and users could still see its menus, sadly for me, in Cocoa the menus are disabled when their main window is hidden. I don't know which is correct behavior so cannot  report it as a bug. My problem to fix my code.
 
So, start testing your app, make a mode thats for Cocoa and test away.

We have seen massive progress with Cocoa rcently, its very nearly usable and the folks responsible are doing a fantastic job, thanks !

Davo
Title: Re: macOS 32-bit app warning
Post by: MISV on May 21, 2018, 01:12:20 pm
Apple is phasing out/ has phased out 32 bit. When targeting MAC you *must* use 64 bit. If not now, within weeks... not years... Although some support will be provided until 2020.

Apple's warning dates from 2016....
If you are trying to port code that relies on 32 bit that is a big mistake and you just are caught out.....

I have no pity with the dumb.

For me my codebase (huge project) compiles across:

It is fine if you are not using Lazarus or Cocoa - but I want to use Lazarus and Cocoa... So not really much choice than keep on targeting 32bit on Mac until 64bit Cooca was ready. A least if you have limited resources and want to use Lazarus / Cocoa. However, as I stated, one could have tried to help more, so only oneself to blame for it not being ready :)




TinyPortal © 2005-2018