So I think I made some progress.
What I did was:
- take the delphi project on a Windows, compile it with embarcadero (delphi CE) and run it:
works as expected.
- take the delphi project on a Windows, convert it to a lazarus project, compile it and run it:
works as expected.
- take the delphi project project on a MacOS, convert it to a lazarus project, compile it and run it:
doesn't work.Message during compilation:
Compile Project, Target: /Users/josephbarbier/Desktop/compile-lifelihood/compilation/setUp/lib/x86_64-darwin/lifelihoodC2023: Success, Errors: 1, Warnings: 3, Hints: 15
lifelihoodC2023.lpr(5,2) Note: APPTYPE is not supported by the target OS
Unit1.pas(22,5) Note: Local variable "i" not used
Unit1.pas(63,15) Hint: Local variable "vc" of a managed type does not seem to be initialized
Unit1.pas(41,11) Note: Local variable "t" not used
Unit1.pas(41,13) Note: Local variable "m" not used
Unit1.pas(41,15) Note: Local variable "n" not used
Unit1.pas(41,23) Note: Local variable "nbponte" not used
Unit1.pas(41,40) Note: Local variable "ii" not used
Unit1.pas(42,5) Note: Local variable "stop" not used
Unit1.pas(43,5) Note: Local variable "tabaux" not used
Unit1.pas(44,5) Note: Local variable "somme" not used
Unit1.pas(44,11) Note: Local variable "maxi" not used
Unit1.pas(46,11) Note: Local variable "checkpart" not used
Unit1.pas(211,7) Note: Local variable "j" not used
Unit1.pas(7,9) Hint: Unit "Alea" not used in Unit1
Warning: ld: warning: -multiply_defined is obsolete
Error: -macosx_version_min has been renamed to -macos_version_min
Warning: ld: warning: ignoring duplicate libraries: '-lc'
Warning: ld: warning: no platform load command found in '/Users/josephbarbier/Desktop/compile-lifelihood/compilation/setUp/lib/x86_64-darwin/lifelihoodC2023.or', assuming: macOS
I don't know if warnings/error should be my focus at the moment since it actually compiles.
But when I try to execute it:
EAccessViolation: Access violation
, suggesting that the program tries to access invalid memory.
After some "print debugging" work, I was able to localise more or less what part of the code causes the error, but it's still unclear.
I put the project in public mode on my github repo with source code, data and executable if that helps (the easiest way to run the project is to use the .R file since the project uses lots of inputs):
https://github.com/JosephBARBIERDARNAL/compile-lifelihood/tree/mainThis part (
https://github.com/JosephBARBIERDARNAL/compile-lifelihood/tree/main?tab=readme-ov-file#april-30) README contains an explanation with details of what I understand of the problem (which files may be concerned etc).
It's very unclear to me what causes error and why it only happens with macOS, so any hints or search direction will help me.
Thanks!
Note:
- MacOS Sonoma 14.4.1
- Lazarus 3.2
- FPC 3.2.2