Recent

Author Topic: macOS Larazus exit code 1, error 3  (Read 4137 times)

statjy

  • Newbie
  • Posts: 2
macOS Larazus exit code 1, error 3
« 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
"

jwdietrich

  • Hero Member
  • *****
  • Posts: 1154
    • formatio reticularis
Re: macOS Larazus exit code 1, error 3
« Reply #1 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.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.0.10 | FPC 3.2.0 | PPC, Intel, ARM | macOS, Windows, Linux

Trenatos

  • Hero Member
  • *****
  • Posts: 524
    • MarcusFernstrom.com
Re: macOS Larazus exit code 1, error 3
« Reply #2 on: June 08, 2019, 09:04:20 am »
Should be targeting x86 and Cocoa.

statjy

  • Newbie
  • Posts: 2
Re: macOS Larazus exit code 1, error 3
« Reply #3 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.  

Alex Bonanno

  • Newbie
  • Posts: 2
Re: macOS Larazus exit code 1, error 3
« Reply #4 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

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1068
  • Former Delphi 1-7, 10.2 User
Re: macOS Larazus exit code 1, error 3
« Reply #5 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?
« Last Edit: June 27, 2019, 01:58:26 am by trev »
o Lazarus v2.1.0 r63871, FPC v3.3.1 r47164, macOS 10.14.6, Xcode 11.3.1
o Lazarus v2.1.0 r64160, FPC v3.3.1 Nov 27 21:16:31, macOS 11.0.1 (aarch64), Xcode 12.2
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.1 amd64 (VMware VM)
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 20.04 (PD VM)

Alex Bonanno

  • Newbie
  • Posts: 2
Re: macOS Larazus exit code 1, error 3
« Reply #6 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

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1068
  • Former Delphi 1-7, 10.2 User
Re: macOS Larazus exit code 1, error 3
« Reply #7 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.
o Lazarus v2.1.0 r63871, FPC v3.3.1 r47164, macOS 10.14.6, Xcode 11.3.1
o Lazarus v2.1.0 r64160, FPC v3.3.1 Nov 27 21:16:31, macOS 11.0.1 (aarch64), Xcode 12.2
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.1 amd64 (VMware VM)
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 20.04 (PD VM)

p.leeflang

  • New member
  • *
  • Posts: 9
Re: macOS Larazus exit code 1, error 3
« Reply #8 on: July 22, 2020, 07:20:41 pm »
I still have problems with my macBook.
I tried all the above help
« Last Edit: July 22, 2020, 07:23:05 pm by p.leeflang »

julkas

  • Guest
Re: macOS Larazus exit code 1, error 3
« Reply #9 on: July 22, 2020, 07:55:38 pm »
Install brew.
Then - brew install lazarus.

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1068
  • Former Delphi 1-7, 10.2 User
Re: macOS Larazus exit code 1, error 3
« Reply #10 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 from the Wiki?

Please explain what "still have problems" means. Are there any error messages? If so, what do they say?
o Lazarus v2.1.0 r63871, FPC v3.3.1 r47164, macOS 10.14.6, Xcode 11.3.1
o Lazarus v2.1.0 r64160, FPC v3.3.1 Nov 27 21:16:31, macOS 11.0.1 (aarch64), Xcode 12.2
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.1 amd64 (VMware VM)
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 20.04 (PD VM)

p.leeflang

  • New member
  • *
  • Posts: 9
Re: macOS Larazus exit code 1, error 3
« Reply #11 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.

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1068
  • Former Delphi 1-7, 10.2 User
Re: macOS Larazus exit code 1, error 3
« Reply #12 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).   
o Lazarus v2.1.0 r63871, FPC v3.3.1 r47164, macOS 10.14.6, Xcode 11.3.1
o Lazarus v2.1.0 r64160, FPC v3.3.1 Nov 27 21:16:31, macOS 11.0.1 (aarch64), Xcode 12.2
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.1 amd64 (VMware VM)
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 20.04 (PD VM)

p.leeflang

  • New member
  • *
  • Posts: 9
Re: macOS Larazus exit code 1, error 3
« Reply #13 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"

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1068
  • Former Delphi 1-7, 10.2 User
Re: macOS Larazus exit code 1, error 3
« Reply #14 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

o Lazarus v2.1.0 r63871, FPC v3.3.1 r47164, macOS 10.14.6, Xcode 11.3.1
o Lazarus v2.1.0 r64160, FPC v3.3.1 Nov 27 21:16:31, macOS 11.0.1 (aarch64), Xcode 12.2
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.1 amd64 (VMware VM)
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 20.04 (PD VM)

 

TinyPortal © 2005-2018