Lazarus

Installation => macOS / Mac OS X => Topic started by: statjy on June 07, 2019, 11:32:32 am

Title: macOS Larazus exit code 1, error 3
Post by: statjy on June 07, 2019, 11:32:32 am
I am using Laraus on my mac for the first time. I follow the tutorial, add 2 buttons and compile. The message pop out with 'exit code 1, error 3'. I checked the error 3 is about the path to the directory so I saved the unit and project in a fold that I can access. But the error is still there. What should I do? Thanks in advance.

The error message is: "
Target:project1: exit code 1,error: 3
Error: linker: Undefined symbols for architecture i386:
Error: linker:   "start", referenced from:
ld: symbol(s) not found for architecture i386
An error occurred while linking
project1.lpr(23,0) Error: Error while linking
"
Title: Re: macOS Larazus exit code 1, error 3
Post by: jwdietrich on June 07, 2019, 08:39:24 pm
Can you provide a simple demo project, so that we can reproduce the error? And, please note, which versions of Lazarus, Free Pascal and macOS you use.
Title: Re: macOS Larazus exit code 1, error 3
Post by: Trenatos on June 08, 2019, 09:04:20 am
Should be targeting x86 and Cocoa.
Title: Re: macOS Larazus exit code 1, error 3
Post by: statjy on June 11, 2019, 12:41:29 pm
Can you provide a simple demo project, so that we can reproduce the error? And, please note, which versions of Lazarus, Free Pascal and macOS you use.

My Lazarus is 2.0.0
FPC 3.0.4
MacOS is 10.14.5

I am not sure how to give the demo project. I included the project I am using below
Code: Pascal  [Select][+][-]
  1. program project1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6.   {$IFDEF UNIX}{$IFDEF UseCThreads}
  7.   cthreads,
  8.   {$ENDIF}{$ENDIF}
  9.   Interfaces, // this includes the LCL widgetset
  10.   Forms, Unit1
  11.   { you can add units after this };
  12.  
  13. {$R *.res}
  14.  
  15. begin
  16.   RequireDerivedFormResource:=True;
  17.   Application.Scaled:=True;
  18.   Application.Initialize;
  19.   Application.CreateForm(TForm1, Form1);
  20.   Application.Run;
  21. end.
  22.  
Title: Re: macOS Larazus exit code 1, error 3
Post by: Alex Bonanno on June 26, 2019, 02:42:30 pm
I have the same problem simply rebuilding the IDE with standard packages.
I updated the IDE to version 2.0.2, FPC 3.0.4a.
I have MacOS Mojave 10.14.5 installed
I need help!
Thank you
Title: Re: macOS Larazus exit code 1, error 3
Post by: trev on June 27, 2019, 01:29:22 am
You are going to have to give us more information.

1) Do you have Xcode installed? Version?
2) Have you installed the optional Xcode command line tools?
3) Have you installed the SDK headers?
4) What commands are you using to "simply rebuild" the IDE?
5) What are the error messages?
Title: Re: macOS Larazus exit code 1, error 3
Post by: Alex Bonanno on June 27, 2019, 10:48:05 am
Thanks for your quick reply
1) Do you have Xcode installed? YES Version? Version 10.2.1 (10E1001)
2) Have you installed the optional Xcode command line tools? YES
3) Have you installed the SDK headers? NO, is important?
4) What commands are you using to "simply rebuild" the IDE? Menu Package/Install/Unistall packages, then add a package and go save and rebuild IDE.
5) What are the error messages?
Compile Project, Target: progressbar: Exit code 1, Errors: 3
Error: linker: Undefined symbols for architecture i386:
Error: linker:   "start", referenced from:
  "start", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture i386
An error occurred while linking
progressbar.pp(280,0) Error: Error while linking
progressebar is a lazarus example

thanks
Title: Re: macOS Larazus exit code 1, error 3
Post by: trev on June 27, 2019, 12:42:46 pm
3) Have you installed the SDK headers? NO, is important?

Yes - Since macOS Mojave you need to install the SDK headers as well. Open a Terminal and then type:

open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

which will start the pkg installer. Follow the prompts.
Title: Re: macOS Larazus exit code 1, error 3
Post by: p.leeflang on July 22, 2020, 07:20:41 pm
I still have problems with my macBook.
I tried all the above help
Title: Re: macOS Larazus exit code 1, error 3
Post by: julkas on July 22, 2020, 07:55:38 pm
Install brew.
Then - brew install lazarus.
Title: Re: macOS Larazus exit code 1, error 3
Post by: trev on July 23, 2020, 04:15:11 am
I still have problems with my macBook.
I tried all the above help

Have you followed these Step by step Installation instructions (https://wiki.freepascal.org/Installing_Lazarus_on_macOS) from the Wiki?

Please explain what "still have problems" means. Are there any error messages? If so, what do they say?
Title: Re: macOS Larazus exit code 1, error 3
Post by: p.leeflang on July 31, 2020, 03:28:28 am
I checked step 1 2 and 3.
I tried: Testing FPC installation. And it worked normally.
But now I realize I installed Lazarus OS 86-64
So I'm going to see if installing the version under: home/Lazarus Mac OS X i386 will give better results.
Title: Re: macOS Larazus exit code 1, error 3
Post by: trev on July 31, 2020, 03:50:52 am
Quote
ld: symbol(s) not found for architecture i386

1. You didn't say, but are you using Catalina on your notebook?
    - If so, you cannot compile 32 bit programs anymore as the relevant frameworks were mostly removed.

2. I suspect that if you go to Lazarus > Tools > Options, your compiler is set to ppc386 (32 bit)
   - If so, you should change it to ppcx64 (64 bit)

3. It is also possible that you were trying to compile the Cocoa widgetset for i386 which is not possible because Cocoa is 64 bit only.
   - If your system is still capable of producing 32 bit binaries, and you really want to create 32 bit binaries, then choose the Carbon (32 bit) widgetset instead.

If none of the above helps, you are going to have to help us to help you by supplying full details of your macOS version, FPC version, Lazarus version, and Lazarus settings (Lazarus > Tools > Options; Lazarus > Project > Project options, especially Compiler options > Config and Target).   
Title: Re: macOS Larazus exit code 1, error 3
Post by: p.leeflang on July 31, 2020, 05:36:05 am
Thanks this was a big help. ( the compiler was set to ppc386, changed it into ppcx64)
The earlier mistake is gone.
And Yes I have Catalina 10.15.5 on my Mac.
And Lazarus tels me:
Lazarus: 2.0.10
FPC version: 3.2.0
x86-64-darwin-cocoa

With a simple program, an application I get the mistake: "Error: resource compiler "fpcres" not found, switching to external mode"
Title: Re: macOS Larazus exit code 1, error 3
Post by: trev on July 31, 2020, 07:31:11 am
The installation of the Free Pascal binaries should have put the fpcres binary in /usr/local/bin

1) Is the fpcres binary there?
    - if not, then I would suggest reinstalling the FPC binaries.

2) The ownership and permissions on the /usr/local/bin directories should be:

Code: Text  [Select][+][-]
  1. drwxr-xr-x@  root  wheel  /usr
  2. drwxr-xr-x   root  wheel  /usr/local
  3. drwxr-xr-x@  root  wheel  /usr/local/bin

- if not, fix the ownership/permissions.

3) Your path environment variable should include /usr/local/bin/ - check from an Applications > Utilities > Terminal with the command:

Code: Text  [Select][+][-]
  1. $ echo $PATH

- if not, and assuming you're using Catalina's zsh shell, open an Applications > Utilities > Terminal and add it with the command:

Code: Text  [Select][+][-]
  1. cd && echo 'export PATH="/usr/local/bin:$PATH"' > .zsh

Title: Re: macOS Larazus exit code 1, error 3
Post by: p.leeflang on July 31, 2020, 02:42:37 pm
It is still not working:

The /usr/local/bin/fpcres are installed
drwxr-xr-x@  root  wheel  /usr   returns:    zsh: command not found: drwxr-xr-x@

I can't change the permissions for /usr or /usr/local and usr/local/bin
the computer tells me:The operation cannot be completed because you do not have the necessary permissions. (translation from Dutch)

I tried: Leef@mbp-van-peter-2 ~ % chflags nohidden ~/usr/local/bin
with result: chflags: /Users/Leef/usr/local/bin: No such file or directory

I tried chflags nohidden /usr
with result: chflags: /usr: Operation not permitted

I am not able to change the System Integrity Protection with the option restart the computer and then press <cmd> R because i use a bluetooth keyboard. Normal keyboard is not working.

cd && echo 'export PATH="/usr/local/bin:$PATH"' > .zsh        worked because
echo $path     returns:    /usr/local/bin /usr/bin /bin /usr/sbin /sbin /opt/X11/bin /Library/Apple/usr/bin
Title: Re: macOS Larazus exit code 1, error 3
Post by: p.leeflang on August 01, 2020, 02:18:41 am
I fixed the ownership and permissions on the /usr/local/bin and /usr/local directories. By changing the System Integrity Protection.
I was notable to change /usr   It is still only read and hidden.

But with those changes I sill get the error:
  Compile Project, Target: /Users/Leef/tmp/project1: Exit code 1, Errors: 1
  Error: resource compiler "fpcres" not found, switching to external mode
Title: Re: macOS Larazus exit code 1, error 3
Post by: trev on August 01, 2020, 02:24:53 am
It is still not working:

The /usr/local/bin/fpcres are installed
drwxr-xr-x@  root  wheel  /usr   returns:    zsh: command not found: drwxr-xr-x@

Those were not commands - they were showing you what the ownership/permissions should be on those directories if you did an "ls -d /usr", "ls -d /usr/local" and "ls -d /usr/local/bin".

Quote
I am not able to change the System Integrity Protection with the option restart the computer and then press <cmd> R because i use a bluetooth keyboard. Normal keyboard is not working.

This would only be required if the ownership/permissions were incorrect. Are they?

Quote
cd && echo 'export PATH="/usr/local/bin:$PATH"' > .zsh        worked because
echo $path     returns:    /usr/local/bin /usr/bin /bin /usr/sbin /sbin /opt/X11/bin /Library/Apple/usr/bin

What happens if you type in a Terminal fpcres<return> ?
Title: Re: macOS Larazus exit code 1, error 3
Post by: p.leeflang on August 01, 2020, 03:21:16 am
I believe I found it.
This I found: Make sure under Tools > Options that "Compiler Executable" is set to "/usr/local/bin/fpc" to get 64 bit applications.
Described in: https://wiki.freepascal.org/Installing_Lazarus_on_macOS


Compile package LCL 2.0.10: Succes!, Warnings: 34, Hints: 550

Compile Project, Target: /Users/Leef/tmp/project1: Succes!
Title: Re: macOS Larazus exit code 1, error 3
Post by: p.leeflang on August 01, 2020, 03:52:13 am
Thanks Trev, you where a big help.

But still it is funny.

With your suggestion:
2. I suspect that if you go to Lazarus > Tools > Options, your compiler is set to ppc386 (32 bit)
   - If so, you should change it to ppcx64 (64 bit)

I managed the first problem, but later this /usr/local/lib/fpc/3.2.0/ppcx64 was changed into: /usr/local/bin/fpc
Title: Re: macOS Larazus exit code 1, error 3
Post by: trev on August 01, 2020, 04:14:15 am
fpc or ppcx64 is fine - fpc is a wrapper which picks the right 32/64 bit compiler. I was just wanting to make sure you were using the 64 bit compiler.

As for it changing from ppcx64 to fpc - maybe when you reinstalled FPC.

The fact that your /usr/local/bin ownership/permissions were "unexpected" is more curious. Glad you managed to fix it and all is now well.
TinyPortal © 2005-2018