Recent

Author Topic: macOS installation via MacPorts  (Read 3302 times)

Mark92630

  • New Member
  • *
  • Posts: 15
macOS installation via MacPorts
« on: November 27, 2020, 05:54:54 am »
After upgrading to macOS Catalina (which allows only 64-bit apps), upgrading MacPorts to its Catalina version, and uninstalling and reinstalling fpc and lazarus, I get the attached series of error messages when trying to start lazarus.

I moved the fpc.cfg file supplied during the MacPorts install to my $HOME directory, and set the environment variable, PPC_CONFIG_PATH to point there. Questions:

1. How do I specify the location of system.ppu in the fpc.cfg file?
2. Why can't Lazarus find my compiler?
3. Why can't FPC find the config file?
4. How do I "make sure that fpc.cfg contains the right directories"? If it doesn't, what syntax do I use to add them?

TIA,

Mark

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: macOS installation via MacPorts
« Reply #1 on: November 27, 2020, 08:31:48 am »
I would recommend you remove the MacPorts installation completely and follow these Wiki instructions which are known to work. There has been at least one previous post about a faulty MacPorts installation.

mischi

  • Full Member
  • ***
  • Posts: 170
Re: macOS installation via MacPorts
« Reply #2 on: November 27, 2020, 10:17:04 am »
I need some more time to view into this. It should be no problem to fix the macPorts installation. So far, problems showed only up in situations with mixed installations or leftovers. On a clean system installations using macports or fink work like a charm.

mischi

  • Full Member
  • ***
  • Posts: 170
Re: macOS installation via MacPorts
« Reply #3 on: November 27, 2020, 10:46:09 am »
One problem, i see from your error messages is that the OS is set to macos. This is definitely wrong, as macos stands for classic mac for powerpc and m68k before Mac OS X. For Mac OS X/macOS the OS_TARGET needs to be set to darwin. Depending on where this is set, a reinstall will not fix it.

Rather than wildly installing and uninstalling with one or the other method, I recommend the more systematic approach below:

1) Check on the command line that your compiler is properly installed with
Code: Pascal  [Select][+][-]
  1. which ppcx64
  2. ppcx64 -iSP -iSO
which should tell you
Code: Pascal  [Select][+][-]
  1. x86_64 darwin

2) check the presence of the compiler source code. Since your compiler seems to be in /opt/local/bin, I expect it in /opt/local/share/fpcsrc.

3) check the presence of the lazarus source code. Since your compiler seems to be in /opt/local/bin, I expect it in /opt/local/share/lazarus.

4) Check the lazarus settings in the menu: tools → settings
The setting for the compiler seems to be ok in your case, i.e. /opt/local/bin/ppcx64
Also check the path to the sources of fpc (/opt/local/share/fpcsrc) and of lazarus (/opt/local/share/lazarus)

5) Check the settings of your project. Because of the OS setting to macos I suspect your actual problem here. It is the menu project → project settings → compiler settings → configuration and target.

If the problem persists, further reduce your case by opening a new default project and try to fix that first. The error message about fpc.cfg may be misleading. Unless you changed something there on purpose, the trouble is a setting  somewhere else, which does not match fpc.cfg.

I hope this helps - Michael.
« Last Edit: November 27, 2020, 12:05:54 pm by mischi »

Mark92630

  • New Member
  • *
  • Posts: 15
Re: macOS installation via MacPorts
« Reply #4 on: November 28, 2020, 05:38:37 pm »
@mischi - There are definitely "leftovers" of previous installations. I had both MacPorts and non-MacPorts installations on this machine in earlier times. I tried to get rid of everything old, but I might have missed something.

Checks of your first three points are successful.

Check four is successful. Note: this is now Tools → Options ... and not tools → settings.

Check five: project settings are correct. Note: this is now Project → Project Options → Compiler Options → Config and Target. Also, this window offers me a [Test] button on the bottom. Clicking that yields complaints:

WARNING: include search path does not exist: /Users/markwallace/fpcobj/lib/x86_64-darwin
HINT: using config file /etc/fpc.cfg
ERROR: RTL unit not found: system.ppu
ERROR: RTL unit not found: objpas.ppu
ERROR: RTL unit not found: sysutils.ppu
ERROR: RTL unit not found: classes.ppu
ERROR: RTL unit not found: avl_tree.ppu
ERROR: RTL unit not found: zstream.ppu

==========

When I go to /Users/markwallace/fpcobj/lib/, the only sub-directory is i386-darwin.

I'm also getting this in the Messages window opened by Lazarus: "Fatal: Can't find unit system used by Program".

Immediately on opening a new Project (Simple Program), I get an error box similar to the one in my original post, containing the words "the system.ppu ... was not found." But this time, it does specify a target OS=darwin.

Thanks for helping,

Mark

mischi

  • Full Member
  • ***
  • Posts: 170
Re: macOS installation via MacPorts
« Reply #5 on: November 28, 2020, 07:31:35 pm »
"fpcobj" looks very suspicious to me. I would go back to the simplest case a Hello World testprogramm like this:

Code: Pascal  [Select][+][-]
  1. program test;
  2. begin
  3.   writeln('Hello World')
  4. end.

and try to compile this from the command line with:
Code: [Select]
fpc testprogramm.pas The first step simply is to reproduce the error. Then switch on logging to see, where it goes wrong:
Code: [Select]
fpc -vt testprogramm.pasThat will tell you a lot.

Michael.

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: macOS installation via MacPorts
« Reply #6 on: November 28, 2020, 10:22:27 pm »
WARNING: include search path does not exist: /Users/markwallace/fpcobj/lib/x86_64-darwin

Quote
When I go to /Users/markwallace/fpcobj/lib/, the only sub-directory is i386-darwin.

I'm also getting this in the Messages window opened by Lazarus: "Fatal: Can't find unit system used by Program".

Be aware that Catalina dropped support for 32 bit applications and frameworks. References to i386 suggest you last used Lazarus on a 32 bit capable version of macOS (Mojave was the last to support 32 bit).
« Last Edit: November 28, 2020, 10:26:28 pm by trev »

Mark92630

  • New Member
  • *
  • Posts: 15
Re: macOS installation via MacPorts
« Reply #7 on: November 28, 2020, 10:32:29 pm »
@mischi: With your commands, the following warnings don't get logged:

ld: warning: object file (/opt/local/libexec/fpc/lib/fpc/3.2.0/units/x86_64-darwin/rtl/sysinit.o) was built for newer macOS version (10.15) than being linked (10.9)
ld: warning: object file (/opt/local/libexec/fpc/lib/fpc/3.2.0/units/x86_64-darwin/rtl/system.o) was built for newer macOS version (10.15) than being linked (10.9)

Then, here are log files from the two attempts. I notice there are a lot of "not found"s in the second file. Don't know how to fix them, though.

TIA,

Mark

Mark92630

  • New Member
  • *
  • Posts: 15
Re: macOS installation via MacPorts
« Reply #8 on: November 28, 2020, 10:35:08 pm »
WARNING: include search path does not exist: /Users/markwallace/fpcobj/lib/x86_64-darwin

Quote
When I go to /Users/markwallace/fpcobj/lib/, the only sub-directory is i386-darwin.

I'm also getting this in the Messages window opened by Lazarus: "Fatal: Can't find unit system used by Program".

Be aware that Catalina dropped support for 32 bit applications and frameworks. References to i386 suggest you last used Lazarus on a 32 bit capable version of macOS (Mojave was the last to support 32 bit).

That is exactly the history of this situation. I was running on Mojave and my problems began only after I upgraded to Catalina. Now, what do I do about it?

TIA,

Mark

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: macOS installation via MacPorts
« Reply #9 on: November 28, 2020, 11:36:43 pm »
That is exactly the history of this situation. I was running on Mojave and my problems began only after I upgraded to Catalina. Now, what do I do about it?

My initial advice above still stands. Remove the MacPorts installation, check the Wiki article I linked for uninstalling, then follow the instructions in the Wiki article to install from the official Lazarus + FPC packages from Sourceforge.

Mark92630

  • New Member
  • *
  • Posts: 15
Re: macOS installation via MacPorts
« Reply #10 on: November 29, 2020, 04:07:14 am »
@trev - Fair enough. (I may try to get the MacPorts version working for another day or two.)

mischi

  • Full Member
  • ***
  • Posts: 170
Re: macOS installation via MacPorts
« Reply #11 on: November 29, 2020, 03:15:47 pm »
@mischi: With your commands, the following warnings don't get logged:

ld: warning: object file (/opt/local/libexec/fpc/lib/fpc/3.2.0/units/x86_64-darwin/rtl/sysinit.o) was built for newer macOS version (10.15) than being linked (10.9)
ld: warning: object file (/opt/local/libexec/fpc/lib/fpc/3.2.0/units/x86_64-darwin/rtl/system.o) was built for newer macOS version (10.15) than being linked (10.9)

Then, here are log files from the two attempts. I notice there are a lot of "not found"s in the second file. Don't know how to fix them, though.

TIA,

Mark

The warnings are nothing to worry about. The logs are fine, too. No need to fix anything, since at the end of each search with lots of "not found", the compiler finds an appropriate file. You may not have expected it, but it always looks like this and is totally fine. You have a perfectly working fpc 64bit compiler. The product should be a working command line program. Did you try it?

This is the line, which makes me worry, in particular for a completely new project:

WARNING: include search path does not exist: /Users/markwallace/fpcobj/lib/x86_64-darwin

To the best of my knowledge, this is not set in any default config file. It should be fixed by deleting any lazarus and fpc config file, but much care is needed not to miss the one with this setting. Therefore, i suggest to spend some more time in a more systematic search to find this culprit.

I see two routes how to fix this. The first is to directly search for the config file with this path with grep. The second is to produce a verbose log of building the project with lazarus and check the log file.

1)
I expect the path "/Users/markwallace/fpcobj/lib" has been set in some config files with "-Fu~/fpcobj/lib". To the best of my knowledge, fpcobj is not
used by fpc or lazarus by default. Just for my curiosity: Do you remember, whether you have set this path during any of your installations? Whatever. This is route number 1:

You could try to find the file with grep in your home directory.
Code: [Select]
grep -r fpcobj .*or any settings of unit directories for fpc
Code: [Select]
grep -r '-Fu' .*
You might also do the grep in more general directories, such as /etc, /opt/local/etc

Then delete the lines with fpcobj in these files with a text editor.

2)
Although, the problem is not found yet, at least it is clear, that it is caused somewhere up the tool chain, i suspect project options in lazarus. Therefore, another route is with a new project. Check the project options. To be sure explicitly set the OS target to Darwin, the CPU target to x86_64 and the widget set to cocoa. You might also increase the verbosity (I hope that this is the correct re-translation of my German menus) by setting -vt. In case the output becomes impossible to handle you might use the command line command
Code: [Select]
lazbuild YOUR_NEW_PROJECT.lpi and redirect the output to a log file. Again, the log file can be very long and the task is to find the name and path of the config file, where the path from above is set.

Michael.

Mark92630

  • New Member
  • *
  • Posts: 15
Re: macOS installation via MacPorts
« Reply #12 on: December 13, 2020, 01:08:14 am »
This worked (don't ask me why).

1. locate fpc.cfg

(Appears in my home directory and /opt/local/etc/)

2. cd /opt/local/etc/

3. ls -l fpc.cfg

It's a link to /opt/local/libexec/fpc/etc/fpc.cfg

4. cd $Home

5. sudo cp fpc.cfg /opt/local/libexec/fpc/etc/fpc.cfg

=====

Lazarus now starts without any complaints.

Mark

mischi

  • Full Member
  • ***
  • Posts: 170
Re: macOS installation via MacPorts
« Reply #13 on: December 18, 2020, 12:03:04 pm »
Good to see about your success. Could you please send me your fpc.cfg from your $HOME. I would like to check for possible problems of /opt/local/libexec/fpc/etc/fpc.cfg.

email:  tonne1.schindler@web.de

 

TinyPortal © 2005-2018