Forum > General

Compile/Convert Delphi project to MacOS

(1/4) > >>

Joseph:
Hello :D,

(beginner's question) I have a compiled Delphi project that works as expected on a Windows. I'd like to use the source code to compile it for the Mac as well, but I'm at a sticking point.

The project basically contains 6 .pas files and 1 .dpr file.

I have installed Lazarus (following the tutorial here
https://wiki.lazarus.freepascal.org/Installing_Lazarus_on_macOS), then FPC.

I then converted the Delphi project into a Lazarus project using the tool provided in Lazarus. It worked as expected (some modifications in the files and appearance of a .lpr as well as .lpi etc).

I then try to compile the project. I've tried both "Compile" and "Clean up and Build", but both lead to the same errors after about 10/15 seconds of compilation:

- Error: -macosx_version_min has been renamed to -macos_version_min
- Error: linker: Undefined symbols for architecture x86_64:
- Error: linker: "WSRegisterBevel", referenced from:
- Error: ld: symbol(s) not found for architecture x86_64
- and finally: Error: Error while linking

There is definitely something related to the linker, but I can't find what the problem actually is and/or what should I do.

I should point out that I've managed to compile and run simple hello world type programs without any problems.

I use:
- MacOS Sonoma 14.4.1
- Lazarus 3.2
- FPC 3.2.2

Any hint or help would be highly appreciated  :D

TRon:

--- Quote from: Joseph on April 23, 2024, 09:49:15 am ---Hello :D,

--- End quote ---
Hi !


--- Quote ---Any hint or help would be highly appreciated  :D

--- End quote ---
See thread.

Joseph:
Thanks! It's probably the same issue I'm facing.

I'll continue the discussion there.

Martin_fr:
Those linking errors could be caused by missing "interfaces"...

Probably something that went wrong during conversion of the project.

I am not 100% sure how to fix this (in an existing project)...

But when you do: Menu > Project > View project source  // last entry in menu
you should see something like

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---program Project1; {$mode objfpc}{$H+} uses  {$IFDEF UNIX}  cthreads,  {$ENDIF}  {$IFDEF HASAMIGA}  athreads,  {$ENDIF}  Interfaces, // this includes the LCL widgetset  Forms, unit1  { you can add units after this }; {$R *.res} begin  RequireDerivedFormResource := True;  Application.Scaled := True;  Application.Initialize;  Application.CreateForm(TForm1, Form1);  Application.Run;end. 
And it must have "Interfaces" in the uses clause.


The other part is in the menu Project > "Project options"
Tab: Compiler > Config and Target

It should say "Current Widgetset ... " And then allow to select another. Make sure it is "cocoa" (I assume that is what you target? otherwise...)

If that option is not there, someone else will have to look into how to fix it...
If the option is not there, then the project that was created is a console app, that has no GUI. It can probably be changed somehow....

Joseph:
in Project Source I have:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---program lifelihoodC2023; {$MODE Delphi} {$APPTYPE CONSOLE} uses  SysUtils,  Classes,  Unit2 in 'Unit2.pas',  Alea in 'Alea.pas',  fmath in 'fmath.pas',  fspec in 'fspec.pas',  mathromb in 'mathromb.pas',  Unit1 in 'Unit1.pas'; begin     
Should I manually add Interfaces?

Current LCL widgetset: "cocoa"
--> seems right

Navigation

[0] Message Index

[#] Next page

Go to full version