Lazarus

Installation => Mac OS X => Topic started by: JLucB on September 25, 2018, 09:04:41 am

Title: FreePascal on macOS 10.14 Mojave doesn't work
Post by: JLucB on September 25, 2018, 09:04:41 am
Freepascal don't work on macOS 10.14. While compiling I get this error :"ld: file not found: /usr/lib/crt1.o".
I know it usually means that command line tools are not install, but I do install them...
I've tried to re-install FreePascal, but the installer won't let me as it consider that command line tools aren't already installed...
Seems like both the compiler and the installer are looking for command line tools to be install in "/usr/lib" but with macOS 10.14 Mojave they are in "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib".

I've tried to create a link in /usr/lib with "sudo ln -f -s /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/crt1.o /usr/lib" but even with root privileges it won't let me... "ln: /usr/lib/crt1.o: Operation not permitted".

Doest any one know a workaround or does an updated version of FreePascal ready for macOS 10.14 will be available soon?

Many thanks in advance!!!
Title: Re: FreePascal on macOS 10.14 Mojave doesn't work
Post by: Bart on September 25, 2018, 10:29:39 am
Try -Flpath/to/lib when compiling.
If that works, put it in your fpc.cfg

W.r.t. to crt1.o: does this link (https://stackoverflow.com/questions/44141166/ld-file-not-found-usr-lib-crt1-o) help?

Bart
Title: Re: FreePascal on macOS 10.14 Mojave doesn't work
Post by: JLucB on September 25, 2018, 11:11:09 am
Try -Flpath/to/lib when compiling.
If that works, put it in your fpc.cfg
When compiling I just type in the terminal "fpc -B -gl myFile.pas", I'm not sure to understand your point.

W.r.t. to crt1.o: does this link (https://stackoverflow.com/questions/44141166/ld-file-not-found-usr-lib-crt1-o) help?
I've already install command line tools using "xcode-select --install"
Title: Re: FreePascal on macOS 10.14 Mojave doesn't work
Post by: Jonas Maebe on September 25, 2018, 11:30:14 am
If FPC is already installed, you should be able to compile by adding -XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk (either on the command line, or to your configuration file)

The installer check will need to be updated.
Title: Re: FreePascal on macOS 10.14 Mojave doesn't work
Post by: DonAlfredo on September 25, 2018, 11:42:46 am
Dunno if it might help, but try to add -WM10.14 to the commandline.
Title: Re: FreePascal on macOS 10.14 Mojave doesn't work
Post by: JLucB on September 25, 2018, 12:07:43 pm
If FPC is already installed, you should be able to compile by adding -XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk (either on the command line, or to your configuration file)

The installer check will need to be updated.

Thanks for the answer.
Adding "-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk", helps... but seems like I'm using "Free Pascal Compiler version 3.0.2 [2017/02/12] for i386" (and cannot install the newer compiler since the install cannot detect the new folder use for the command line tools...). Since macOS 10.14 is 64bits only I get this error : "The i386 architecture is deprecated for macOS (remove from the Xcode build setting: ARCHS)"
Title: Re: FreePascal on macOS 10.14 Mojave doesn't work
Post by: JLucB on September 25, 2018, 12:13:58 pm
Dunno if it might help, but try to add -WM10.14 to the commandline.

It works ! Thanks !

I can compile... but for the time being I cannot update the compiler... But at least I can compile and do my daily work, while waiting for the new FreePascal version compatible with macOS 10.14 to be released...

Thanks for your help!
Title: Re: FreePascal on macOS 10.14 Mojave doesn't work
Post by: Jonas Maebe on September 25, 2018, 12:58:41 pm
Adding "-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk", helps... but seems like I'm using "Free Pascal Compiler version 3.0.2 [2017/02/12] for i386" (and cannot install the newer compiler since the install cannot detect the new folder use for the command line tools...). Since macOS 10.14 is 64bits only I get this error : "The i386 architecture is deprecated for macOS (remove from the Xcode build setting: ARCHS)"

macOS 10.14 is still fully 32 and 64 bit. If it weren't, it would not be able to run FPC 3.0.2 binaries. Support for 32 bit binaries will only be removed in macOS 10.15.
Title: Re: FreePascal on macOS 10.14 Mojave doesn't work
Post by: Hansaplast on September 25, 2018, 01:57:16 pm
Woops, I just posted an issue (http://forum.lazarus.freepascal.org/index.php/topic,42657.0.html) with compiling the Lazarus IDE.


Probably more like a temporary fix, I re-installed the XCode command-line tools for macOS 10.13, which resolved the issue (for now). It's probably not a great fix, but at least I can work again.


UPDATE: This is probably a bad solution - all kinds of controls (mostly listboxes and grids) no longer respond to moving the scrollbar. I'm not 100% sure, but I suspect the "out of sync" warnings were not for nothing ...
Title: Re: FreePascal on macOS 10.14 Mojave doesn't work
Post by: Frank on September 27, 2018, 10:56:46 pm
Hi All,

I have been able to compile 32bit/carbon & 64bit/cocoa from SVN on Mojave.
This assumes you have upgraded to Xcode 10 / Mojave.

1/ download install Command_Line_Tools_macOS_10.13_for_Xcode_9.4.dmg
2/ copy & rename /Library/Developer/ComandLineTools to /Library/Developer/ComandLineTools-10.13
3/ download/install Command_Line_Tools_macOS_10.14_for_Xcode_10.dmg
4/ edit/add to /etc/fpc.cfg :

#ifdef cpui386
-XR/Library/Developer/CommandLineTools-10.13/SDKs/MacOSX.sdk/
-Fl/Library/Developer/CommandLineTools-10.13/usr/lib/clang/9.1.0
#endif
#ifdef cpux86_64
-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/
-Fl/Library/Developer/CommandLineTools/usr/lib/clang/10.0.0
#endif

note1: Thanks to all before me who posted their findings, one builds on the efforts of others.
note2: I have yet to get gdb operational yet with Mojave/Xcode 10 (it worked fine with Xcode 9.4).

Frank



 
Title: Re: FreePascal on macOS 10.14 Mojave doesn't work
Post by: Hansaplast on September 28, 2018, 10:05:58 am
Good to hear that!
For debugging my previously installed GDB kind-a still works, but I decided to start using LLDB.
There is a package (lazdebuggerfplldb.lpk - the one with the "f" in it) that enables that for you.
At the moment neither GDB nor LLDB is perfect, but LLDB does what I need it to do so far.


Are you running the IDE in Cocoa? If yes; is the Object Inspector working OK for you?
I'm having some serious problems with the Object Inspector - tried it on 2 Mac's and a clean VM (Parallels Lite - it's free in the Apple app store and can run Linux and Mac VM's). All show the same issues in Mojave but not in High Sierra (all tested with Cocoa).
See also bug reports 34335 (https://bugs.freepascal.org/view.php?id=34335) and 34336 (https://bugs.freepascal.org/view.php?id=34336).
Title: Re: FreePascal on macOS 10.14 Mojave doesn't work
Post by: Frank on September 28, 2018, 08:41:32 pm
@Hansaplast : Thanks ! I've installed "lazdebuggerfplldb.lpk" & am starting to use it. Mind you it took me by surprise, in my previous post I have been using a script to compile both 32bit carbon / 64bit cocoa & I found I had to delete both the svn folder AND my Lazarus config for 32bit/carbon to get Lazarus to re-compile itself !

My Cocoa IDE was several months old ( I've not been able to work on it until now...) & then it wasn't that bad (but not as good as the carbon/windows version). I've now updated my svn for Cocoa. I tried to compile my Cocoa Application & found it would not compile, it seems there has been alot of changes in the Cocoa interface in the last few months ( I made use of some more direct calls based on the cocoa widgetset). As I familiarize myself more with the cocoa IDE, if I see any (repeatable) bugs, I'll post to the BugTracker.

Frank
Title: Re: FreePascal on macOS 10.14 Mojave doesn't work
Post by: Frank on September 28, 2018, 11:12:57 pm
@Hansaplast : The object inspector in Mojave (svn 59174), is acting strangely...
                      Component selection is all over the place...
                      Haven't discovered root component yet thought...
Title: Re: FreePascal on macOS 10.14 Mojave doesn't work
Post by: Hansaplast on September 29, 2018, 11:35:35 am

I just updated to SVN r59179 (on Mojave, Lazarus 2.1.0 r59179 FPC 3.0.4 x86_64-darwin-cocoa (alpha)).
(with "-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" in fpc.cfg)
Object Inspector still unusable and placing controls is also all over the place.


Compiling the same SVN version under High Sierra (on a Virtual Machine, in Parallels Lite) results in a stable IDE and compiled applications work as expected.


I'll try again on a completely clean Mojave VM this weekend.
Title: Re: FreePascal on macOS 10.14 Mojave doesn't work
Post by: Hansaplast on September 30, 2018, 10:43:31 am
For some reason I cannot get FPC to install on a clean Mojave (with XCode and XCode commandline tools installed).
Any suggestions are most welcome.
Seems FPC (3.0.4) does not recognize XCode Commandline tools anymore.


Steps I followed (in a Virtual Machine):


1) Install clean Mojave (10.14 release, not a beta version)
2) Install XCode (works)
3) Install XCode Commandline Tools (xcode-select --install)
4) Created test app in XCode - compiled and ran just fine
5) Checked if "ld", "lldb" and "make" exist, they do (not sure what else to check for)
6) Download and install FPC (failed install, commandline tools not detected)
Title: Re: FreePascal on macOS 10.14 Mojave doesn't work
Post by: Hansaplast on September 30, 2018, 11:27:39 am
With Frank's instructions I did finally get FPC installed (install Commandline tools 10.13, rename /Library/Developer/ComandLineTools to /Library/Developer/ComandLineTools-10.13, instal;l commandline tools 10.14, install FPC, edit /etc/fpc.cfg)
Title: Re: FreePascal on macOS 10.14 Mojave doesn't work
Post by: slicke on September 30, 2018, 03:30:17 pm
I found a repo on github with old repos and got the SDK from
https://github.com/phracker/MacOSX-SDKs/tree/master/MacOSX10.13.sdk

Used SVN to just get 10.13
svn export https://github.com/phracker/MacOSX-SDKs/trunk/MacOSX10.13.sdk MacOSX10.13.sdk :)
Title: Re: FreePascal on macOS 10.14 Mojave doesn't work
Post by: Hansaplast on September 30, 2018, 03:43:20 pm
I found a repo on github with old repos and got the SDK from
https://github.com/phracker/MacOSX-SDKs/tree/master/MacOSX10.13.sdk (https://github.com/phracker/MacOSX-SDKs/tree/master/MacOSX10.13.sdk)


Nice find!
Did you try this in Mojave and did Object Inspector and selecting controls on a form work correctly?
(I'm just wondering if the commandline tools somehow is interfering)
Title: Re: FreePascal on macOS 10.14 Mojave doesn't work
Post by: Jonas Maebe on September 30, 2018, 07:36:17 pm
I have uploaded a new installer for FPC 3.0.4 (called FPC 3.0.4a) that will install on macOS 10.14. The compiler has not changed, only the installer and the default fpc.cfg file (and fpcmkcfg, the program that generated the fpc.cfg file).

Note that the generated fpc.cfg file is different depending on whether you install on macOS 10.14 or on a lower version, because it is not possible to make parts of the configuration file conditional on the macOS version. You will have to rerun the installer on macOS 10.14 if you update later to get the new configuration file (or manually specify the appropriate -XR/-Fl parameters).
Title: Re: FreePascal on macOS 10.14 Mojave doesn't work
Post by: Hansaplast on September 30, 2018, 10:57:14 pm
Thanks Jonas!  :)
Title: Re: FreePascal on macOS 10.14 Mojave doesn't work
Post by: luri on October 01, 2018, 01:57:04 am
just my summary in medium
https://medium.com/@luridarmawan/tips-mengatasi-problem-lazarus-di-mojave-688d42a20820

Sorry, in Indonesian, not in english.

*running with: fpc 3.0.4, Lazarus 1.8.4 and Lazarus 2.1.0 (trunk)
Title: Re: FreePascal on macOS 10.14 Mojave doesn't work
Post by: Igor Kokarev on October 22, 2018, 06:57:21 pm
Hi,

Does Lazarus 2.0 RC1 work correctly on macOS Mojave? What I should know before update macOS from High Sierra?
Title: Re: FreePascal on macOS 10.14 Mojave doesn't work
Post by: luri on October 23, 2018, 12:07:20 am
Lazarus 2.1.0 (trunk) running well on MacOS Mojave
Title: Re: FreePascal on macOS 10.14 Mojave doesn't work
Post by: Hansaplast on October 23, 2018, 11:31:29 am
Lazarus 2.1.0 (trunk) running well on MacOS Mojave



How did you install FPC/Lazarus?
I'm running trunk (Lazarus 2.1.0 r59314 FPC 3.0.4 x86_64-darwin-cocoa) as well but have significant refresh/redraw issues (in the IDE and in applications that I compile). Even when installing on a completely clean Mojave machine, I get these issues.
Not sure what I'm overlooking, I installed XCode command lines for 10.13 and 10.14, and modified fpc.cfg as described here.
Title: Re: FreePascal on macOS 10.14 Mojave doesn't work
Post by: Igor Kokarev on October 23, 2018, 01:44:20 pm
Regrettably I couldn't get to work Lazarus 2.0 RC1 + fpc 3.0.4 on macOS
 Mojave.

Initially I had an error "ld: file not found: /usr/lib/crt1.o" when I try to compile any project. This error was described in first post of this topic.

After adding "-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" as it was recommend as a solution, I see "error while linking" messsage.

I have latest Xcode and I performed "xcode-select --install".

I didn't want to install old Xcode if there is another solution.

Please help,
Title: Re: FreePascal on macOS 10.14 Mojave doesn't work
Post by: Hansaplast on October 23, 2018, 02:05:46 pm

I did get Lazarus to run under Mojave, by following the steps outlined in the thread.
Install Commandline tools 10.13 (this installs the missing /usr/lib/crt1.o), rename folder, install Commandline tools 10.14, modify fpc.cfg.
However, there are major repaint issues - for example scrolling through properties in the object inspector, or jumping around in the source code. Applications compiled with this setup have the same issues. Some controls are drawn, others appear after resizing the window or moving the mouse over it, some never appear. You could of course run the IDE in Carbon, or run macOS 10.13 in a virtual machine, but neither is "great".


I'm no expert but I suspect it may have to do with the framework we're linking against.
Compiling the same app under macOS 10.13 and then running it under 10.14 work does not show these issues.
Title: Re: FreePascal on macOS 10.14 Mojave doesn't work
Post by: Gizmo on October 24, 2018, 12:44:35 am
I want to give a big credit to Jonas!

Quote
Jonas..I have uploaded a new installer for FPC 3.0.4 (called FPC 3.0.4a) that will install on macOS 10.14. The compiler has not changed, only the installer and the default fpc.cfg file (and fpcmkcfg, the program that generated the fpc.cfg file).

I have spent all day today, after upgrading from Sierra to Mojave, trying to get Lazarus 1.8.4 to work as it did before in Sierra. I uninstalled and re-installed Lazarus countless times, changed all manner of settings. I was about to wipe my Mac when I found this thread. And most significantly, Jonas mention of FPC 3.0.4a which I discovered is here if anyone is trying to find it (ftp://ftp.hu.freepascal.org/pub/fpc/dist/3.0.4/i386-macosx/fpc-3.0.4a.intel-macosx.dmg).

So what did I do (for the benefit of others trying to get Lazarus 1.8.4 and FPC 3.0.4 on the new Mojave OSX):

1) Dragged Lazarus to trash from the Applications folder in Finder.
2) Deleted the /Users/Username/.lazarus folder (rm -R /Users/YourUsername/.lazarus at terminal)
3) Deleted FPC (rm -R /usr/local/lib/fpc/ at terminal)
4) Deleted other fpc entries such as /usr/local/share/src/fpc-3.0.4 and /usr/local/share/src/fpc-3.0.2 (e.g. rm -R /usr/local/share/src/fpc-3.0.4)...try using 'locate fpc' for other areas.
5) Ensured Xcode was installed (I am using Xcode 10, for info, as of 23rd Oct 2018) from the App Store
6) Executed the following at terminal: sudo xcode-select --install
5) Downloaded FPC 3.0.4e from the link above that Jonas has provided and installed it
6) Re-downloaded Lazarus 1.8.4 as available from the main site (http://www.lazarus-ide.org/index.php?page=downloads)

Success! All existing and old projects now compile and build and launch. :-)

Thanks Jonas. Superstar.
Title: Re: FreePascal on macOS 10.14 Mojave doesn't work
Post by: jordanspace on March 21, 2019, 01:46:22 pm
I'm using Gnu Pascal from the Mac OS X command-line. You can edit files with your favorite Mac text editor (such as TextWrangler).

You can google for "Gnu Pascal Download". It will run under Mac OS X without doing something weird that makes you run Windows under Mac.

And you can google for "Text Wrangler Download"

Both Gnu Pascal and Text Wrangler are totally free.

Pascal isn't a bad first language to learn. That's what it was designed for was to teach student's how to program. But, yeah, for serious programming of a Mac, Objective-C is the best.
Title: Re: FreePascal on macOS 10.14 Mojave doesn't work
Post by: VTwin on June 08, 2019, 11:20:32 pm
Pascal isn't a bad first language to learn. That's what it was designed for was to teach student's how to program. But, yeah, for serious programming of a Mac, Objective-C is the best.

Old post, I know, but "serious" deserves some context. First, programmers trying to make a living with Mac skills will need to learn Swift as well. Second, developers who need to target Mac, Windows and Linux need to consider time required to maintain multiple code bases. I put myself in the "serious" category, but maintaining three code bases is not an option.

Recall, also, that Apple originally developed in Pascal, not a bad language for "serious" work.
Title: Re: FreePascal on macOS 10.14 Mojave doesn't work
Post by: julkas on June 10, 2019, 02:51:35 pm
Freepascal don't work on macOS 10.14.
I am using Travis for testing Free Pascal code on Mac OS X.
Code: Text  [Select]
  1. Operating System Details
  2. ProductName:    Mac OS X
  3. ProductVersion: 10.14.4
  4. BuildVersion:   18E226
  5.  
Code: Text  [Select]
  1. Free Pascal Compiler version 3.0.4 [2018/10/02] for x86_64
  2. Copyright (c) 1993-2017 by Florian Klaempfl and others
  3. Target OS: Darwin for x86_64
  4.  
Travis configuration file and logs are here https://travis-ci.org/JulStrat/ftreap/jobs/543699513.

Regards.
Title: Re: FreePascal on macOS 10.14 Mojave doesn't work
Post by: cpbns on June 17, 2019, 10:42:41 am
Let me add another problem for mac os 10.14 installations: i upgraded an old Lazarus-version to 2.0.2 by using dmg-files from the Lazarus-web-site. At first everything looked fine during startup. I followed all the installation hints on the wiki. When i start compile i get a lot of compile hints for units LCLBase 2.0.2 and LazUtils 1.0 refering to "Duplicate unit". At the end compilation stopped with error "identifier not found TpointerPointerArray".
The problem is: In both units there are identical definitions used, but LazUnits 1.0 can't be removed using the package manager.
Any idea how to solve this problem? 
Title: Re: FreePascal on macOS 10.14 Mojave doesn't work
Post by: cpbns on June 17, 2019, 11:35:49 am
Solved: my question concerning installation error duplicate units ist solved. I deleted from older versions in usr/local/share all directories and reinstalled all dmg-files. everything is fine now.