compile pascal source on Linux by FPC ? lazarus / 66-Unix ---------------------------------------------------------------------- tissatussa · 2022-08-28 13:05 hi, to compile a chess engine (Booot v6.5) i downloaded a set .pas files (with .dpr and .dproj file) but i'm not able to compile it on Linux (Xubuntu 22.04) .. i have FPC v3.2.2 installed and even Lazarus, but i'm stuck .. in terminal i tried : Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i $ fpc ./booot6.dprFree Pascal Compiler version 3.2.2+dfsg-9ubuntu1 [2022/04/11] for x86_64Copyright (c) 1993-2021 by Florian Klaempfl and othersTarget OS: Linux for x86-64Compiling ./booot6.dprCompiling uBitBoards.pasCompiling uMagic.pasuMagic.pas(91,6) Error: Identifier not found "Result"uMagic.pas(113,5) Error: Identifier not found "Result"uMagic.pas(135,5) Error: Identifier not found "Result"uMagic.pas(147,5) Error: Identifier not found "Result"uMagic.pas(157,5) Error: Identifier not found "Result"uMagic.pas(171,4) Error: Identifier not found "result"uMagic.pas(177,5) Error: Identifier not found "result"uMagic.pas(182,5) Error: Identifier not found "result"uMagic.pas(212,4) Error: Identifier not found "Result"uMagic.pas(347,11) Error: Identifier not found "Result"uMagic.pas(362,4) Error: Identifier not found "Result"uMagic.pas(421) Fatal: There were 11 errors compiling module, stoppingFatal: Compilation abortedError: /usr/bin/ppcx64 returned an error exitcode the package does not have any README file .. do i need to add some parameters / options ? i'm not a beginner at Linux, but i never did any Pascal. i guess compiling my source should be pretty simple .. can anybody help me out ? ---------------------------------------------------------------------- Fred vS · 2022-08-28 13:10 Hello. Try to compile after adding this at begin of unit ( after: unit uMagic; ) Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$mode delphi} {$h+} [EDIT] You may also use the mode parameter for fpc: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i $ fpc -Mdelphi ./booot6.dpr [EDIT2] You may also try the excellent "pure fpc" chess engine from Roland: https://gitlab.com/rchastain/moustique ---------------------------------------------------------------------- tissatussa · 2022-08-28 13:46 indeed, the first line of 'uMagic.pas' is 'unit uMagic;' so i added '{$mode delphi} {$h+}' on the next line, as you suggest, but now i get this error : Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i $ fpc ./booot6.dprFree Pascal Compiler version 3.2.2+dfsg-9ubuntu1 [2022/04/11] for x86_64Copyright (c) 1993-2021 by Florian Klaempfl and othersTarget OS: Linux for x86-64Compiling ./booot6.dprCompiling uBitBoards.pasCompiling uMagic.pasuMagic.pas(405,6) Warning: Label not defined "l1"Compiling uBoard.pasCompiling uAttacks.pasuAttacks.pas(30,4) Error: Identifier not found "Result"uAttacks.pas(34,4) Error: Identifier not found "Result"uAttacks.pas(38,4) Error: Identifier not found "Result"uAttacks.pas(42,4) Error: Identifier not found "Result"uAttacks.pas(46,4) Error: Identifier not found "Result"uAttacks.pas(63,3) Error: Identifier not found "Result"uAttacks.pas(69,4) Error: Identifier not found "Result"uAttacks.pas(91,7) Error: Identifier not found "Result"uAttacks.pas(99,7) Error: Identifier not found "Result"uAttacks.pas(103,3) Error: Identifier not found "Result"uAttacks.pas(123,3) Error: Identifier not found "Result"uAttacks.pas(132,3) Error: Identifier not found "Result"uAttacks.pas(139,7) Error: Identifier not found "Result"uAttacks.pas(145,6) Error: Identifier not found "Result"uAttacks.pas(152,6) Error: Identifier not found "Result"uAttacks.pas(161,7) Error: Identifier not found "Result"uAttacks.pas(178,7) Error: Identifier not found "Result"uAttacks.pas(186,9) Error: Identifier not found "Result"uAttacks.pas(187,9) Error: Identifier not found "Result"uAttacks.pas(196,3) Error: Identifier not found "Result"uAttacks.pas(200,9) Error: Identifier not found "Result"uAttacks.pas(206,3) Error: Identifier not found "Result"uAttacks.pas(209,7) Error: Identifier not found "Result"uAttacks.pas(214,7) Error: Identifier not found "Result"uAttacks.pas(219,7) Error: Identifier not found "Result"uAttacks.pas(229,3) Error: Identifier not found "Result"uAttacks.pas(237,7) Error: Identifier not found "Result"uAttacks.pas(282,3) Error: Identifier not found "Result"uAttacks.pas(333,7) Error: Identifier not found "Result"uAttacks.pas(341,3) Error: Identifier not found "Result"uAttacks.pas(356,7) Error: Identifier not found "Result"uAttacks.pas(375,7) Error: Identifier not found "Result"uAttacks.pas(397,3) Error: Identifier not found "Result"uAttacks.pas(403,7) Error: Identifier not found "Result"uAttacks.pas(406,3) Error: Identifier not found "Result"uAttacks.pas(409) Fatal: There were 35 errors compiling module, stoppingFatal: Compilation abortedError: /usr/bin/ppcx64 returned an error exitcode your second option didn't succeed either : Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i $ fpc --Mdelphi ./booot6.dprError: Illegal parameter: --MdelphiError: /usr/bin/ppcx64 returned an error exitcode it failed .. i guess your '--' should be '-' so i did this, but it also failed : Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i $ fpc -Mdelphi ./booot6.dprFree Pascal Compiler version 3.2.2+dfsg-9ubuntu1 [2022/04/11] for x86_64Copyright (c) 1993-2021 by Florian Klaempfl and othersTarget OS: Linux for x86-64Compiling ./booot6.dprCompiling uBitBoards.pasCompiling uMagic.pasuMagic.pas(403,6) Warning: Label not defined "l1"Compiling uBoard.pasCompiling uAttacks.pasuAttacks.pas(406,11) Note: Call to subroutine "function SquareAttackedBB(sq:LongInt;AllPieses:Int64;var Board:TBoard):Int64;" marked as inline is not inlineduAttacks.pas(406,11) Note: Call to subroutine "function FindMinAttacker(Square:LongInt;MyAttackers:Int64;var Occupied:Int64;var Attackers:Int64;var Board:TBoard):LongInt;" marked as inline is not inlinedCompiling uHash.pasuHash.pas(4,40) Fatal: Can't find unit Ansistrings used by uHashFatal: Compilation abortedError: /usr/bin/ppcx64 returned an error exitcode ---------------------------------------------------------------------- Fred vS · 2022-08-28 13:51 Hum, difficult to give a diagnostic without seeing the source...  Maybe in uHash.pas, in uses section,  remove Ansistrings unit. Quoteit failed .. i guess your '--' should be '-' Ooops, yes, fixed in previous post. ---------------------------------------------------------------------- tissatussa · 2022-08-28 13:56 i can put a ZIP with the source here. your newest option (compile the Moustique chess engine) DID succeed according to the compilation line on that page : i get a working binary. ---------------------------------------------------------------------- MarkMLl · 2022-08-28 14:05 Quote from: tissatussa on August 28, 2022, 03:56:43 pmi can put a ZIP with the source here. your newest option (compile the Moustique chess engine) DID succeed according to the compilation line on that page : i get a working binary. Welcome to the forum, and congratulations on an exemplary first message: a clear statement of what you were trying to do, the compiler version etc. clearly shown in the message (rather than in the sig), and full error messages. MarkMLl ---------------------------------------------------------------------- hansotten · 2022-08-28 14:07 I had a look at the booot 6.5 sources. Looks like Windows is involved (handles). Doubt it will run as is n Linux. ---------------------------------------------------------------------- Fred vS · 2022-08-28 14:11 Quote from: tissatussa on August 28, 2022, 03:56:43 pmi can put a ZIP with the source here. Hum, it will not be "out-of-the-box" to compile this project for Linux because there are many call to the "Windows" unit, like GetStdHandle, STD_INPUT_HANDLE, etc... But, with some (many) cups coffee, and many {$ifndef mswindows} ... {$else} ... {$endif} it is doable. ---------------------------------------------------------------------- tissatussa · 2022-08-28 14:15 thanks for pointing this out .. i often find sources (of other chess engines, in C, C++, D, etc) which are typical for Windows and they also are hard to convert / adjust for Linux .. sometimes i succeed, but it's rare.  I leave it for now .. nevermind. ---------------------------------------------------------------------- Fred vS · 2022-08-28 14:51 If you are interested by Chess engine-program, here other excellent fpc projects compatible for Windows and Unix OS (all done by Roland Chastain): Chess engines: https://gitlab.com/rchastain/mater https://github.com/rchastain/alouette Chess programs: https://github.com/rchastain/nero5 https://github.com/rchastain/eschecs ---------------------------------------------------------------------- Roland57 · 2022-08-28 15:21 Thank you Fred! @tissatussa Some time ago I made a Linux-compatible version of Booot 4.15. If you are interested, you can find it here. I think it behaves the same as the original. I also tried with Booot 6 and succeeded to make a working version, but with wild modifications, so I prefer not to distribute it. P.-S. There is another very strong Pascal chess program that I ported to Linux: Open Critter. But there are still things to fix. It crashes sometimes. ---------------------------------------------------------------------- PascalDragon · 2022-08-28 15:30 Quote from: Fred vS on August 28, 2022, 03:10:38 pmTry to compile after adding this at begin of unit ( after: unit uMagic; ) Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$mode delphi} {$h+} Please note that {$H+} is not required for mode Delphi as that is enabled by default when that mode is selected (for a very long time already). ---------------------------------------------------------------------- Fred vS · 2022-08-28 15:51 Quote from: PascalDragon on August 28, 2022, 05:30:50 pmQuote from: Fred vS on August 28, 2022, 03:10:38 pmTry to compile after adding this at begin of unit ( after: unit uMagic; ) Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$mode delphi} {$h+} Please note that {$H+} is not required for mode Delphi as that is enabled by default when that mode is selected (for a very long time already). Ha, ok, thanks for the tip.  (Please note too that it is a very, very long time already that I did not use that mode.  )