* * *

Author Topic: MorphOS and MorpOS Lazarus from Alb42  (Read 2741 times)

saashapont

  • New member
  • *
  • Posts: 39
MorphOS and MorpOS Lazarus from Alb42
« on: August 04, 2016, 09:54:08 am »
We talk about morphOS in amiga topic. And now new right topic for it :)

What we have now for cross compilation for example for mac:
1. Cross binutils
2. Cross compilation for MorpOS
3. Lazarus 1.7 from Alb42 Special "MorpOS edition"

I want to use this lazarus as main.
And there is same questions and problems with it
1. What are the right options to rebuild this lazarus after packages installation?
2. When i try compile for win32 i have error:

Free Pascal Compiler version 3.0.0 [2016/01/06] for i386
Copyright (c) 1993-2015 by Florian Klaempfl and others
(1002) Target OS: Win32 for i386
.......
(3104) Compiling lazfileutils.pas
(3104) Compiling lazutilsstrconsts.pas
(1010) Writing Resource String Table file: lazutilsstrconsts.rsj
/Volumes/MacHD2/Downloads/lazarus-lazarus-morphos/components/lazutils/lazfileutils.pas(175,3) Fatal: (2003) Syntax error, "BEGIN" expected but "identifier UNIX" found
Fatal: (1018) Compilation aborted
Error: /sw/bin/ppc386 returned an error exit code

Are there any easy way to fix that?
« Last Edit: August 04, 2016, 01:58:28 pm by saashapont »

molly

  • Hero Member
  • *****
  • Posts: 1610
Re: MorphOS and MorpOS Lazarus from Alb42
« Reply #1 on: August 04, 2016, 11:18:34 am »
(1010) Writing Resource String Table file: lazutilsstrconsts.rsj
/Volumes/MacHD2/Downloads/lazarus-lazarus-morphos/components/lazutils/lazfileutils.pas(175,3) Fatal: (2003) Syntax error, "BEGIN" expected but "identifier UNIX" found

Code: Pascal  [Select]
  1. implementation
  2.  
  3. // to get more detailed error messages consider the os
  4. uses
  5. {$IFDEF HASAMIGA}
  6.   Exec, dos;
  7. {$ELSE}
  8.   {$IFDEF Windows}
  9.     Windows {$IFnDEF WinCE}, ShlObj, ActiveX, WinDirs{$ENDIF};
  10.   {$ELSE}
  11.     {$IFDEF darwin}
  12.       MacOSAll,
  13.     {$ENDIF}
  14.   {$ENDIF}
  15.   Unix, BaseUnix;
  16. {$ENDIF}
  17.  

Quote
Are there any easy way to fix that?
Ah, come on. Now that everything works, this is the easy part  ;)

I promise you (provided that your setup is done ok) that this is the last tiny hurdle that you need to take. I really would like to suggest to take that one small hurdle by yourself.

As a hint: it is a very obvious oversight. Start at the top of the snippet and follow all ifdefs and ask yourself what is happening when you compile for Windows.

PS: without pasting any code what-so-ever nobody here is going to help you as you are using a unofficial-fork-with-official-unsupported-lazarus-branch.
« Last Edit: August 04, 2016, 11:41:16 am by molly »

saashapont

  • New member
  • *
  • Posts: 39
Re: MorphOS and MorpOS Lazarus from Alb42
« Reply #2 on: August 04, 2016, 11:52:21 am »
Thank you for quick answer!
PS: without pasting any code what-so-ever nobody here is going to help you as you are using a unofficial-fork-with-official-unsupported-lazarus-branch.

There are no code, i try compile empty project :)

I try analyze all ifdef, and compare with official lazarus& In official we have in this piece
// to get more detailed error messages consider the os
uses
{$IFDEF Windows}
  Windows {$IFnDEF WinCE}, ShlObj, ActiveX, WinDirs{$ENDIF};
{$ELSE}
  {$IFDEF darwin}
  MacOSAll,
  {$ENDIF}
  Unix, BaseUnix;
{$ENDIF}

he logic is right
if non amiga else windows if non windows else darwin and if non amiga^ non windows non darwin then unix

molly

  • Hero Member
  • *****
  • Posts: 1610
Re: MorphOS and MorpOS Lazarus from Alb42
« Reply #3 on: August 04, 2016, 12:23:56 pm »
There are no code, i try compile empty project
I was talking about the code that causes the error  ;D

Quote
I try analyze all ifdef, and compare with official lazarus& In official we have in this piece
You have done some homework. That's very good  8)

Quote
he logic is right
if non amiga else windows if non windows else darwin and if non amiga^ non windows non darwin then unix
Well, the logic behind the ifdefs is perfectly ok, it is the actual implementation part that has a (small) flaw. As said, a simple oversight from the developer by placing something at the wrong location  :-X

Why otherwise would the compiler complain ?

I know, it might be frustrating on your end but please have a closer look.

In case things really eludes you, then use a setup that works, copy paste the ifdefs into an empty project and instead of making the code add units to a uses clause, place things somewhere inside an empty procedure or function and let the compiler inform you about things with using warning messages.

Something like this:
Code: Pascal  [Select]
  1. program includings;
  2.  
  3. // compile this with a working fpc compiler, target must be Windows and inspect the output.
  4.  
  5. procedure TestUnits;
  6. begin
  7. {$IFDEF HASAMIGA}
  8.   {$WARNING Has Amiga was defined, including units Exec and Dos}
  9. {$ELSE}
  10.   {$WARNING Has Amiga was not defined, checking for windows}
  11.   {$IFDEF Windows}
  12.     {$WARNING Windows was defined, include unit windows and do some wince checking that we conveniently skip here}
  13.   {$ELSE}
  14.     {$WARNING Windows was not defined, so apparantly we compile for another target, lets check if its darwin}
  15.     {$IFDEF darwin}
  16.       {$WARNING Darwin was defined, including MacOSAll}
  17.     {$ENDIF}
  18.     {$WARNING Windows was not defined and darwin was also not defined, we are directly before the end of else ifdef windows construction}
  19.   {$ENDIF}
  20.   {$WARNING HasAmiga was not defined, include units Unix and BaseUnix}
  21. {$ENDIF}
  22. end;
  23.  
  24. begin
  25.   TestUnits;
  26. end.
  27.  

We have no mimicked the implementation in a small simple testexample which is now completely controlled by us and that shows the same behaviour as the original code.

Now, when compiling (for windows target) pay close atttention to the output in your messages window. Do you see anything wrong with that ? (remember that the target is windows).

saashapont

  • New member
  • *
  • Posts: 39
Re: MorphOS and MorpOS Lazarus from Alb42
« Reply #4 on: August 04, 2016, 12:37:21 pm »
Compile Project, Mode: Windows, OS: win32, Target: project1.exe: Success, Warnings: 3
unit1.pas(39,4) Warning: User defined: Has Amiga was not defined, checking for windows
unit1.pas(41,6) Warning: User defined: Windows was defined, include unit windows and do some wince checking that we conveniently skip here
unit1.pas(49,4) Warning: User defined: HasAmiga was not defined, include units Unix and BaseUnix

You want to say that
HasAmiga was not defined, include units Unix and BaseUnix
are superfluous?

molly

  • Hero Member
  • *****
  • Posts: 1610
Re: MorphOS and MorpOS Lazarus from Alb42
« Reply #5 on: August 04, 2016, 12:47:43 pm »
You want to say that
HasAmiga was not defined, include units Unix and BaseUnix
are superfluous?
Bingo !  :)

You might perhaps not have know that, but ask yourself what on earth would a program compiled for windows do with units Unix and BaseUnix (which are units intended to be used for ... well .. unix related targets).

Now, the hardest part is figuring out what was intended. But since you did your homework you already know what was intended (original lazarus source) and what was added to make things misbehave.

In the original code you can clearly see that
Code: Pascal  [Select]
  1. {$IFDEF Windows}
  2. blah blah
  3. {$ELSE}
  4.   {$IFDEF darwin}
  5.   blah,
  6.   {$ENDIF}
  7.   Unix, BaseUnix;  // <--- if the target is not windows _then_ include units Unix and baseUnix.
  8. {$ENDIF}
  9.  
Which in itself is a complete flawed design as there is only room for two targets (with a small side-step for darwin target).

It is what i call the "If windows then do_windows_stuff else we_happily_assume_it_is_always_unix/linux_and_we_simply_do_not_care_about_the_rest" syndrome.

Is that enough information for you to fix the error ?

molly

  • Hero Member
  • *****
  • Posts: 1610
Re: MorphOS and MorpOS Lazarus from Alb42
« Reply #6 on: August 04, 2016, 01:05:35 pm »
Is that enough information for you to fix the error ?
To correct myself there: perhaps not all information in case you are not familiar with the hasamiga define.

HasAmiga means that the target is Amiga, AmigaOS, MorphOS or AROS.

And with telling you that none of these mentioned targets requires units Unix and baseunix (even stronger: you should not use them for these targets), you should be able to solve it.

Sorry for the inconvenience and/or confusion i might have caused by initially withholding this information.
« Last Edit: August 04, 2016, 01:07:53 pm by molly »

saashapont

  • New member
  • *
  • Posts: 39
Re: MorphOS and MorpOS Lazarus from Alb42
« Reply #7 on: August 04, 2016, 01:20:34 pm »
Thank you!!! I fix it! Now in this lazarus i have correct compilation for
Windows, mac, MORPHOS, Linux, Linux Arm, And for IOS without lcl!

And what can you say about:
1. What are the right options to rebuild this lazarus after packet installation?

molly

  • Hero Member
  • *****
  • Posts: 1610
Re: MorphOS and MorpOS Lazarus from Alb42
« Reply #8 on: August 04, 2016, 01:32:46 pm »
Thank you!!! I fix it! Now in this lazarus i have correct compilation for
Windows, mac, MORPHOS, Linux, Linux Arm, And for IOS without lcl!
Congratulations  :D

Please realize i was not doing this to pester you rather to have you (hopefully) learn something.

Quote
And what can you say about:
1. What are the right options to rebuild this lazarus after packet installation?
Uhm, yeah i noticed that question in your intial post, but i have to admit that it seems like my English skills are lacking there  :-[ That's why i conveniently tried to avoid the question.

Could you perhaps rephrase ?

Right now i have no idea what you meant by 'packages' and/or why you would want to rebuild lazarus. If all else fails (with me understanding), then please describe in small steps what you want to achieve or what you think is happening or is required.

saashapont

  • New member
  • *
  • Posts: 39
Re: MorphOS and MorpOS Lazarus from Alb42
« Reply #9 on: August 04, 2016, 02:03:49 pm »
I fix first message :)
I want to instal customdrawn and iphonelazext packages. And then i must rebuild lazarus.

And when i try to build lazarus i always have error...

molly

  • Hero Member
  • *****
  • Posts: 1610
Re: MorphOS and MorpOS Lazarus from Alb42
« Reply #10 on: August 04, 2016, 02:32:01 pm »
I fix first message :)
....
And when i try to build lazarus i always have error...
Are you talking about the following message that you 'fixed' ? :

Free Pascal Compiler version 3.0.0 [2016/01/06] for i386
Copyright (c) 1993-2015 by Florian Klaempfl and others
(1002) Target OS: Win32 for i386
.......
(3104) Compiling lazfileutils.pas
(3104) Compiling lazutilsstrconsts.pas
(1010) Writing Resource String Table file: lazutilsstrconsts.rsj
/Volumes/MacHD2/Downloads/lazarus-lazarus-morphos/components/lazutils/lazfileutils.pas(175,3) Fatal: (2003) Syntax error, "BEGIN" expected but "identifier UNIX" found
Fatal: (1018) Compilation aborted
Error: /sw/bin/ppc386 returned an error exit code

Are there any easy way to fix that?

Because that looks like exactly the same issue. Or to put it into other words: in that case you haven't correctly fixed the issues that we previously discussed. (e.g. you fixed it in such a way that it (only) works for windows target).

Please, show us your 'fixed' ifdef code (only the part that you fixed, not the complete unit).
« Last Edit: August 04, 2016, 02:41:42 pm by molly »

saashapont

  • New member
  • *
  • Posts: 39
Re: MorphOS and MorpOS Lazarus from Alb42
« Reply #11 on: August 04, 2016, 02:44:13 pm »
When i try rebuild lazarus, i set this settings: Compiler /sw/bin/fpc
LCL type Carbon, Target Darwin
The project open is for darwin too
And when i try to build lazarus i have errors
carbonproc.pp(535,13) Error: Identifier not found "ATSUFindFontFromName"
carbonproc.pp(696,11) Error: Identifier not found "HIViewSetVisible"
carbonproc.pp(755,36) Error: Identifier not found "GetControlEventTarget"
carbonproc.pp(1393,28) Warning: Local variable "sz" does not seem to be initialized


The code that fix last error is
Code: Pascal  [Select]
  1. {$IFDEF HASAMIGA}
  2.   Exec, dos;
  3. {$ELSE}
  4.   {$IFDEF Windows}
  5.     Windows {$IFnDEF WinCE}, ShlObj, ActiveX, WinDirs{$ENDIF};
  6.   {$ELSE}
  7.     {$IFDEF darwin}
  8.       MacOSAll,
  9.     {$ENDIF}
  10.  
  11.   Unix, BaseUnix;
  12. {$ENDIF}
  13. {$ENDIF}
  14.  
  15. {$I lazfileutils.inc}
  16. {$IFDEF HASAMIGA}
  17.   {$I aroslazfileutils.inc}
  18. {$ELSE}
  19. {$IFDEF windows}
  20.   {$I winlazfileutils.inc}
  21. {$ELSE}
  22.   {$I unixlazfileutils.inc}
  23. {$ENDIF}
  24. {$ENDIF}      

molly

  • Hero Member
  • *****
  • Posts: 1610
Re: MorphOS and MorpOS Lazarus from Alb42
« Reply #12 on: August 04, 2016, 03:05:08 pm »
Ah ok.. in that case i misunderstood that you 'fixed' your first message to include the _new_ errors  :-[.

In that case in was not necessary to show your 'fixed' ifdef solution (afaik it is perfectly ok btw :))

When i try rebuild lazarus, i set this settings: Compiler /sw/bin/fpc
LCL type Carbon, Target Darwin
The project open is for darwin too
And when i try to build lazarus i have errors
carbonproc.pp(535,13) Error: Identifier not found "ATSUFindFontFromName"
carbonproc.pp(696,11) Error: Identifier not found "HIViewSetVisible"
carbonproc.pp(755,36) Error: Identifier not found "GetControlEventTarget"
carbonproc.pp(1393,28) Warning: Local variable "sz" does not seem to be initialized
Sorry, i have to call defeat here  :'(

These functions are listed inside ALB42's lazarus branch (e.g. they are present) but, do realize that ALB42's MorphOS branch is more than 6 months old.

Officially ALB42s branch only supports one single target being MorphOS (or AROS in case you installed the AROS branch). Of course that also means that the host OS has to be supported, and this is only verified for host OS' being Linux and/or Windows (and by you doing this we now also know it works for macOS, so thank you very much for that). Everything else you get running/working is to be considered pure luck.

This issue would really require someone with (enough) MacOS knowledge and who's able to help you out there.

mischi

  • Jr. Member
  • **
  • Posts: 62
Re: MorphOS and MorpOS Lazarus from Alb42
« Reply #13 on: August 05, 2016, 12:35:56 am »
When i try rebuild lazarus, i set this settings: Compiler /sw/bin/fpc
LCL type Carbon, Target Darwin
The project open is for darwin too
And when i try to build lazarus i have errors
carbonproc.pp(535,13) Error: Identifier not found "ATSUFindFontFromName"
carbonproc.pp(696,11) Error: Identifier not found "HIViewSetVisible"
carbonproc.pp(755,36) Error: Identifier not found "GetControlEventTarget"
carbonproc.pp(1393,28) Warning: Local variable "sz" does not seem to be initialized
Reminds me of 64bit vs 32bit problem.

saashapont

  • New member
  • *
  • Posts: 39
Re: MorphOS and MorpOS Lazarus from Alb42
« Reply #14 on: August 05, 2016, 09:29:40 am »
Yes it was when i use 64 bit compiler

Now i set all permission for all files in lazarus filter and choose 32 bit compiler
And it is work!!!! Thank you!!!!

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus