Lazarus

Installation => macOS / Mac OS X => Topic started by: Jon Trepte on October 10, 2021, 08:34:10 am

Title: First Pascal Application
Post by: Jon Trepte on October 10, 2021, 08:34:10 am
I'm a complete newbie to Lazarus but proficient in Delphi 6. I've installed the IDE and FPC. I create a new Application but get an error. See attachment.
Something seems not to have been setup properly.
Please help as this looks fantastic
Jon
Title: Re: First Pascal Application
Post by: Awkward on October 10, 2021, 08:59:31 am
Looks like you uses different version of compiled units from FPC and Lazarus. Better to install full Lazarus distrib which comes with proper FPC version. OR you will need to recompile units ("Build All" is our all)
next, in future, you can use fpcupdeluxe tool https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases (https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases) to install fpc/lazarus version you need
Title: Re: First Pascal Application
Post by: Thaddy on October 10, 2021, 09:03:25 am
FYI the same happens in Delphi when you try to compile and link against DCU's that are compiled in a different Delphi version. Both DCU's and FPC's PPU's are version dependent, not major version but even minor version.
I also would recommend fpcupdeluxe or a full Lazarus distro.
In the case of Linux many distro's contain a fairly recent Lazarus and FPC.
Title: Re: First Pascal Application
Post by: Jon Trepte on October 10, 2021, 10:34:27 am
Many thanks for your replies. I did install Lazarus-2.2.0RC1-x86_64-macosx and  fpc-3.2.0.intel-macosx as they looked the latest.
Are these the recommended files. If not what should I be using?
Thanks again.
Title: Re: First Pascal Application
Post by: Thaddy on October 10, 2021, 10:43:37 am
I would advise against using RC - release candidate - versions unless you are an advanced user.
If you install with fpcupdeluxe, simply select "stable.git" for both lazarus and Fpc.
Top the line is trunk, but trunk versions need very regular updates (at least weekly, I do it more daily but I am a pensionado idiot) and are not supported for that reason.
The current stable version of Fpc is 3.2.2 although that may differ a version for MacOs.

EDIT: and indeed it does:
The Lazarus version is indeed an RC.
https://sourceforge.net/projects/lazarus/files/Lazarus%20macOS%20x86-64/Lazarus%202.0.12/
Title: Re: First Pascal Application
Post by: Jon Trepte on October 10, 2021, 10:49:10 am
I will revert to 2.2.12 and try again. I just hit the latest version link but I didn't realise that RC stood for release candidate.
Thanks
Title: Re: First Pascal Application
Post by: Thaddy on October 10, 2021, 10:50:35 am
I editted my post. For MacOs the advertised selection is indeed a RC... See link.
Title: Re: First Pascal Application
Post by: Jon Trepte on October 10, 2021, 11:03:32 am
OK I've now downgraded to 2.0.12 and I now get the attached error message when starting Lazarus.
Title: Re: First Pascal Application
Post by: Handoko on October 10, 2021, 11:11:06 am
It seems you need to do a clean install of your Lazarus. There were discussions how to do it on Linux. Not sure about MacOs, but they should be similar.
Title: Re: First Pascal Application
Post by: Jon Trepte on October 10, 2021, 11:37:52 am
I now get the following error
Title: Re: First Pascal Application
Post by: dbannon on October 10, 2021, 12:32:35 pm
Jon, sorry, looks like the people who really know their stuff have all signed off.

Look, installing Lazarus is a pretty easy process, right now you are suffering for running too many different install attempts. Like Handoko said, you need to remove the distractions !

Each of your attempts have probably left bit and pieces everywhere, I strongly suggest you make an effort to try and find those bits and remove them all and then, only when you are sure all the distractions are gone try one of the install methods again. Just one. Any one will work fine.

https://wiki.freepascal.org/Installing_Lazarus_on_macOS

-- Discussion Mode, don't read if your head is spinning  --
Personally, I have a FPC322 (322 is a good idea on the Mac) install and I build Lazarus from source. Lots of people seem to think thats hard but building apps is what FPC/Lazarus is all about !   Its one command line and running that command tests it all for you. Anyway, choose your model and stick with it !  2.0.12 should be fine but Fixes 2.2 will have a few extra tweaks for the Mac.

Again. personally, I prefer an install where I know where everything actually is.

Good luck !

Davo

Title: Re: First Pascal Application
Post by: Thaddy on October 10, 2021, 12:36:50 pm
Davo, MacOs has still issues that are not resolved.
Title: Re: First Pascal Application
Post by: Jon Trepte on October 10, 2021, 12:57:04 pm
Thanks dbannon
 I looked in the web for instructions but all were confusing referring to folders in /etc/Application Support which did not exist.
I will try again but thanks again for spending your time.
If you have a link to do this I would be very grateful. :(
Jon
Title: Re: First Pascal Application
Post by: Handoko on October 10, 2021, 01:16:15 pm
This is how to do a full Lazarus re-installation on Linux:
https://forum.lazarus.freepascal.org/index.php/topic,35743.msg236869.html#msg236869

For your information you first need to enable show hidden file on your system:
https://www.ionos.com/digitalguide/server/configuration/showing-hidden-files-on-a-mac/
Title: Re: First Pascal Application
Post by: Jon Trepte on October 10, 2021, 01:20:01 pm
thank you Handoko
Title: Re: First Pascal Application
Post by: dbannon on October 11, 2021, 01:58:04 am
Thaddy, yes, there are still some issues on the Mac, but just about all software has issues of some sort. A functional install of FPC/Lazarus is relatively easy and many people are using it right now.

I only use my (poor old) Mac to do prerelease testing, all development is done on Linux but thats just because the Mac UI drives me mad! 

Jon, my MacOS install is probably not typical and may well be bad advice. I am a long term Unix user. (Although Thaddy once called me a Windows user and has still not apologized  :) ) I rewrote the Wiki page I referred you to earlier some years ago and had hoped it has been extensively rewritten since then, sadly I recognise much of the wording ....

trev would be a lot more help here but it does not seem he is around.

Further to Handoko's advice for finding errant Lazarus file, when Lazarus starts up the first time, it creates a set of config files in (default)  $HOME/.lazarus. If you re-install a different way it will probably look there and assume the files there apply, nominally, version number is the same.  So, part of your clean out exercise is to remove, completely, .lazarus from your home directory. It gets rebuilt automatically.

In my humble opinion, the best way to install FPC/Lazarus (on any platform) is to use the supplied binary install packages for FPC and FPC-SRC from sourceforge, links in the wiki page.  Get that working, test it and then download the Lazarus source and compile it. FPC is a compiler, its a good one, compiling is what its good at !

That way you can put your Lazarus install in user space, where you want it and you have a full understanding of where it is and which version you are using. It does not need to be on your path, you cd to the install directory and start from there.

Details -
1. You do not need to use git or svn to down load Lazaus source. Anyone other than Lazarus developer should (IMHO) just download a zip file. Move an existing install out of the way, unzip the new one, change into the dir, type "make all LCL_PLATFORM=cocoa CPU_TARGET=x86_64 bigide". If its trunk or Fixes, repeat every few months.

2. I always use the --PCP=somewhere option to lazarus (or better, create a lazarus.cfg in your lazarus directory with that same info). Again, just so I am sure which files are being used.

3. To start a source installed Lazarus, cd into the install dir and start from there. Or create a bash script, I keep mine in ~/bin, like this (in my case 'trunk' is my Lazarus install dir below $HOME/bin/Lazarus, you will probably have different names) -

Code: Bash  [Select][+][-]
  1. #!/bin/bash
  2. LAZDIR="trunk"
  3. cd "$HOME/bin/Lazarus/$LAZDIR"
  4. open "$HOME/bin/Lazarus/$LAZDIR"/lazarus.app --args "--pcp=$HOME/.$LAZDIR"

4. You really should not be taking advice about MacOS from an old Unix hack.

Davo


Title: Re: First Pascal Application
Post by: trev on October 11, 2021, 02:52:00 am
I'm missing for a day and...  :o

The Mac Portal (https://wiki.lazarus.freepascal.org/Portal:Mac) on the Wiki has lots of useful information including:

* Installing Lazarus on macOS (https://wiki.lazarus.freepascal.org/Installing_Lazarus_on_macOS)

* Uninstalling Lazarus on macOS (https://wiki.lazarus.freepascal.org/Uninstalling_Lazarus_on_macOS)

If you're still having issues, please follow the uninstallation instructions and start afresh.
Title: Re: First Pascal Application
Post by: Gustavo 'Gus' Carreno on October 11, 2021, 02:57:18 am
Hey Trev,

<completely_off_topic_and_dripping_sarcasm>
I'm missing for a day and...  :o

What do you mean you need some personal time!?!?!?
Isn't the 30m power nap you take each nite enough for that!?!?
<insert_whip_cracking_gif/>

</completely_off_topic_and_dripping_sarcasm>

Cheers,
Gus
Title: Re: First Pascal Application
Post by: Thaddy on October 11, 2021, 08:23:41 am
Isn't the 30m power nap you take each nite enough for that!?!?
Huh? That is IONS.

Isn't 30 µs enough for a power nap...? (I am being generous here)
Title: Re: First Pascal Application
Post by: Jon Trepte on October 11, 2021, 11:29:58 am
First let me thank all how have taken the time to assist me. Especially Thaddy and Handoko. I'm a bit closer now in that I can get thing to compile but I still have one problem left. When I run an empty project I get the following.

Compile Project, CPU: i386, Target: /Users/jontrepte/tmp/project1: Exit code 1,
Errors: 1
Linking /Users/jontrepte/tmp/project1
ld: framework not found Cocoa
An error occurred while linking
Error: Error while linking

Any ideas? Maybe something to do with Xcode

Running Xcode 13
fps 3.3.3
Lazarus 2.0.12
Title: Re: First Pascal Application
Post by: mischi on October 11, 2021, 12:20:39 pm
The problem is that your default cpu target is i386 and there is no Cocoa library/framework for 32bit. This should be fixed by explicitly setting the cpu target to x86-64. Do you need more details?

MiSchi.
Title: Re: First Pascal Application
Post by: Jon Trepte on October 11, 2021, 01:14:02 pm
Thanks mischi
I re installed the system using
fpc-3.2.0.intel-macosx.dmg
fpc-src-3.2.0-2-laz.pkg
Lazarus-2.0.12-x86_64-macosx.pkg
and all is working OK
Many thanks to all who helped me and I look forward to using the environment.
Kindes regards
Jon
Title: Re: First Pascal Application
Post by: Gustavo 'Gus' Carreno on October 11, 2021, 01:50:26 pm
Hey Thaddy,

Isn't 30 µs enough for a power nap...? (I am being generous here)

ROTFL!!!

Cheers,
Gus
TinyPortal © 2005-2018