Recent

Author Topic: (Newbie) error in compiling my first macOS sample program  (Read 865 times)

dng8888g

  • New Member
  • *
  • Posts: 10
(Newbie) error in compiling my first macOS sample program
« on: October 12, 2024, 10:48:45 am »
Just start it and there is a sample program (project1 with form1).  Compile and give me a lot of error message:

Quote
Error: -macosx_version_min has been renamed to -macos_version_min

This is key I assume out of many; as I write a simple program per this tutorial

https://youtu.be/7qv4zqyG9jw?si=ypG_FW5Dxn7valPa&t=569i.e. the following code:

Code: Pascal  [Select][+][-]
  1.  
  2. program project2;
  3.  
  4. var
  5.   myname : string;
  6.  
  7. begin
  8.  
  9.   Write('Enter your name: ');
  10.   Readln(myname);
  11.   Writeln('Hello, ', myname);
  12.   Readln;
  13.  
  14. end.
  15.  
  16.  

Quote
Compile Project, Target: /Users/xxxxxx/Documents/Github/yyyyyyyy/_lazarus_tp_test2/project2: Success, Errors: 1, Warnings: 1
Warning: ld: warning: -multiply_defined is obsolete
Error: -macosx_version_min has been renamed to -macos_version_min

The MacOS X to macOS is long time ago.  I suspect I might have an easier version and hence at least delete all under ./lazarus and retype the code.  Still error.  Not sure how to proceed. 

Is there some setting I need to change perhaps?

For the moment, I just delete all the ~/.lazarus and even the manual down Lazarus and download again via brew install Lazarus see whether any difference.
« Last Edit: October 12, 2024, 10:59:32 am by dng8888g »

carl_caulkett

  • Hero Member
  • *****
  • Posts: 649
Re: (Newbie) error in compiling my first macOS sample program
« Reply #1 on: October 12, 2024, 11:24:58 am »
Quote
Error: -macosx_version_min has been renamed to -macos_version_min

This particular error is quite harmless, even though it is intensely annoying 😉
I haven't found a way to avoid getting it...
"It builds... ship it!"

carl_caulkett

  • Hero Member
  • *****
  • Posts: 649
Re: (Newbie) error in compiling my first macOS sample program
« Reply #2 on: October 12, 2024, 11:26:04 am »
Just start it and there is a sample program (project1 with form1).  Compile and give me a lot of error message:

Quote
Error: -macosx_version_min has been renamed to -macos_version_min

This is key I assume out of many; as I write a simple program per this tutorial

https://youtu.be/7qv4zqyG9jw?si=ypG_FW5Dxn7valPa&t=569i.e. the following code:

Code: Pascal  [Select][+][-]
  1.  
  2. program project2;
  3.  
  4. var
  5.   myname : string;
  6.  
  7. begin
  8.  
  9.   Write('Enter your name: ');
  10.   Readln(myname);
  11.   Writeln('Hello, ', myname);
  12.   Readln;
  13.  
  14. end.
  15.  
  16.  

Quote
Compile Project, Target: /Users/xxxxxx/Documents/Github/yyyyyyyy/_lazarus_tp_test2/project2: Success, Errors: 1, Warnings: 1
Warning: ld: warning: -multiply_defined is obsolete
Error: -macosx_version_min has been renamed to -macos_version_min

The MacOS X to macOS is long time ago.  I suspect I might have an easier version and hence at least delete all under ./lazarus and retype the code.  Still error.  Not sure how to proceed. 

Is there some setting I need to change perhaps?

I was able to build and run your app...
Code: Bash  [Select][+][-]
  1. [Sat Oct 12 2024 10:07am (BST+0100)]
  2. ~/code/fpc/testdng8888g  ./project1
  3. Enter your name: Carl
  4. Hello, Carl
  5.  
  6.  
  7. [Sat Oct 12 2024 10:07am (BST+0100)]    took 6s
  8. ~/code/fpc/testdng8888g
  9.  

These are the total warnings and "errors"...
Code: Text  [Select][+][-]
  1. Hint: Start of reading config file /Users/carlcaulkett/.fpc.cfg
  2. Hint: Start of reading config file /etc/fpc.cfg
  3. Hint: End of reading config file /etc/fpc.cfg
  4. Hint: End of reading config file /Users/carlcaulkett/.fpc.cfg
  5. Verbose: Free Pascal Compiler version 3.2.2 [2021/05/16] for x86_64
  6. Debug: Copyright (c) 1993-2021 by Florian Klaempfl and others
  7. Verbose: Target OS: Darwin for x86_64
  8. Verbose: Compiling project1.lpr
  9. Verbose: Assembling project1
  10. Verbose: Linking /Users/carlcaulkett/Code/FPC/testdng8888g/project1
  11. Warning: ld: warning: -multiply_defined is obsolete
  12. Error: -macosx_version_min has been renamed to -macos_version_min
  13. Verbose: 13 lines compiled, 0.7 sec
  14. Verbose: 4 hint(s) issued
  15.  

As you can see, the so-called error is there, but it didn't stop the smooth running of the program.
If you are getting other errors, then there must be something else wrong with your particular set up.

Can you let us know the version of Lazarus and FPC that you are running?
"It builds... ship it!"

dbannon

  • Hero Member
  • *****
  • Posts: 3188
    • tomboy-ng, a rewrite of the classic Tomboy
Re: (Newbie) error in compiling my first macOS sample program
« Reply #3 on: October 12, 2024, 12:45:07 pm »
Just searching through the Lazarus source, the only mention of "macosx_version_min" is in a script used to pre-build the package. It gets passed to the linker. It would seem reasonably certain you are not using that script.

So, the question is, where is that term coming from ?

Ah, here it is -
Code: [Select]
fpc-3.2.4/compiler/systems/t_darwin.pas:          LinkRes.Add('-macosx_version_min');
You could could try downloading the FPC source (I'd suggest the 3.2.4 branch), edit that file and compile it with your existing FPC322.

Otherwise, your only hope is that one of the FPC developers buys a Mac and is equally annoyed. One issue might be that we don't know just when Apple changed that identifier, we could end up stopping it working altogether on an older Mac.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

dng8888g

  • New Member
  • *
  • Posts: 10
Re: (Newbie) error in compiling my first macOS sample program
« Reply #4 on: October 12, 2024, 01:29:32 pm »
Just start it and there is a sample program (project1 with form1).  Compile and give me a lot of error message:

Quote
Error: -macosx_version_min has been renamed to -macos_version_min

This is key I assume out of many; as I write a simple program per this tutorial

https://youtu.be/7qv4zqyG9jw?si=ypG_FW5Dxn7valPa&t=569i.e. the following code:

Code: Pascal  [Select][+][-]
  1.  
  2. program project2;
  3.  
  4. var
  5.   myname : string;
  6.  
  7. begin
  8.  
  9.   Write('Enter your name: ');
  10.   Readln(myname);
  11.   Writeln('Hello, ', myname);
  12.   Readln;
  13.  
  14. end.
  15.  
  16.  

Quote
Compile Project, Target: /Users/xxxxxx/Documents/Github/yyyyyyyy/_lazarus_tp_test2/project2: Success, Errors: 1, Warnings: 1
Warning: ld: warning: -multiply_defined is obsolete
Error: -macosx_version_min has been renamed to -macos_version_min

The MacOS X to macOS is long time ago.  I suspect I might have an easier version and hence at least delete all under ./lazarus and retype the code.  Still error.  Not sure how to proceed. 

Is there some setting I need to change perhaps?

I was able to build and run your app...
Code: Bash  [Select][+][-]
  1. [Sat Oct 12 2024 10:07am (BST+0100)]
  2. ~/code/fpc/testdng8888g  ./project1
  3. Enter your name: Carl
  4. Hello, Carl
  5.  
  6.  
  7. [Sat Oct 12 2024 10:07am (BST+0100)]    took 6s
  8. ~/code/fpc/testdng8888g
  9.  

These are the total warnings and "errors"...
Code: Text  [Select][+][-]
  1. Hint: Start of reading config file /Users/carlcaulkett/.fpc.cfg
  2. Hint: Start of reading config file /etc/fpc.cfg
  3. Hint: End of reading config file /etc/fpc.cfg
  4. Hint: End of reading config file /Users/carlcaulkett/.fpc.cfg
  5. Verbose: Free Pascal Compiler version 3.2.2 [2021/05/16] for x86_64
  6. Debug: Copyright (c) 1993-2021 by Florian Klaempfl and others
  7. Verbose: Target OS: Darwin for x86_64
  8. Verbose: Compiling project1.lpr
  9. Verbose: Assembling project1
  10. Verbose: Linking /Users/carlcaulkett/Code/FPC/testdng8888g/project1
  11. Warning: ld: warning: -multiply_defined is obsolete
  12. Error: -macosx_version_min has been renamed to -macos_version_min
  13. Verbose: 13 lines compiled, 0.7 sec
  14. Verbose: 4 hint(s) issued
  15.  

As you can see, the so-called error is there, but it didn't stop the smooth running of the program.
If you are getting other errors, then there must be something else wrong with your particular set up.

Can you let us know the version of Lazarus and FPC that you are running?

A bit of a surprise.  You are right.  I can go to the command mode and it run as ./project2!

I do it on windows 11 and it seems to work.  Might be this is how macOS work?

Or might be there is some options I missed that prompt the command windows somehow.


dng8888g

  • New Member
  • *
  • Posts: 10
Re: (Newbie) error in compiling my first macOS sample program
« Reply #5 on: October 12, 2024, 03:54:34 pm »
I check on the example project hello world with a memo.  Strange if you run it on the ~/.lazarus it will display the form.  But if you run it outside even if I gave lazarus full disk access, nothing happen.  Just a plain form without the button.

I think might be Mac is not a good idea to run this.  Something is not really right. 

dbannon

  • Hero Member
  • *****
  • Posts: 3188
    • tomboy-ng, a rewrite of the classic Tomboy
Re: (Newbie) error in compiling my first macOS sample program
« Reply #6 on: October 13, 2024, 01:19:02 am »
Did you make and use an "Application Bundle" ?

When launching a GUI app on Mac it must be started using the Application Bundle or much of the interactive parts are disabled.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

dng8888g

  • New Member
  • *
  • Posts: 10
Re: (Newbie) error in compiling my first macOS sample program
« Reply #7 on: October 15, 2024, 01:54:27 pm »
Wow.  That meant the demo in the YouTube would not work as such for macOS.

I read a bit about the application bundle.  Whilst useful for macOS application, but as my objective currently is to see how to deal with Turbo Pascal Gamework, I would concentrate on that first.  Would come back if I can migrate at least the turbo Bridge (as then I would need to run it on macOS as an application).  Not promising as it use register set ... Let us see.

My new thread is here: https://forum.lazarus.freepascal.org/index.php/topic,68923.0.html

And thanks all for your help.
« Last Edit: October 15, 2024, 03:40:21 pm by dng8888g »

 

TinyPortal © 2005-2018