Using in wsl2 (Windows Subsystem for Linux v2) lazarus / 61-Beginners ---------------------------------------------------------------------- sjb · 2023-09-04 09:41 Coming to wsl2 for the first time having previously used fpc a little on macOS and Linux, I stated with a small project that I know builds. However, on Linux (Ubuntu) in wsl2 it fails ... 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  $ fppcame$ makeMakefile:135: *** Compiler .exe not found.  Stop.  I wondered if it need the path setting so I tried the... 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 $ export FPCDIR=/usr/lib/x86_64-linux-gnu/fpc/3.0.4$ fppcame$ makeMakefile:135: *** Compiler /usr/bin/fpc.exe not found.  Stop.  Just to check I did this.. 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 $ $ which -a fpc/usr/bin/fpc/bin/fpc$ which -a fpc.exe[nothing]  Why is it looking for fpc.exe when running in Linux (wsl2)? Looking at the Makefile generated by fpcmake I see it seem to be checking for pwd.exe, presumably to check if it's in a Windows system and then presumes if pwd,exe exist then fpc is a fpc.exe (mostly guesswork I found the Makefile rather difficult to understand) Yes, pwd.exe is on my path. Seems the windows path is automatically prepended to the Linux path (which is useful as I can thus access Windows applications such as explorer.exe) 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 $ which pwd.exe/mnt/c/LatticeMico8/cygwin/bin/pwd.exe That needs to be in my Windows path as I use LatticeMico8 for development To confirm my guesswork I manually edited the Makefile and changed pwd.exe to xxpwd.exe so it would not be found, now I get.. 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  $ make /usr/bin/fpc -Fu/usr/lib/x86_64-linux- gnu/fpc/3.0.4/units/x86_64-linux/rtl -FE. -FUunits/x86_64-linux -Cg -dx86_64 magic.pas Free Pascal Compiler version 3.0.4+dfsg-23 [2019/11/25] for x86_64Copyright (c) 1993-2017 by Florian Klaempfl and othersTarget OS: Linux for x86-64Compiling magic.pasLinking ./magic/usr/bin/ld.bfd: warning: ./link.res contains output sections; did you forget -T?30 lines compiled, 0.2 sec  So, the question is.  What did I do wrong?  I assume manually editing the Makefile is not the the correct solution, especially for beginners. I found one forum post from five years ago that seemed to apply, titled  "wsl: convincing FPC that it is on Linux" (https://forum.lazar us.freepascal.org/index.php/topic,42267.msg294817.html#msg294817), but honestly I don't understand what the solution was (or much of what was being discussed).  I'm also assuming in five years things will have move on, or is using fpc on wsl/wsl2 really unusual? Version info... 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 -vFree Pascal Compiler version 3.0.4+dfsg-23 [2019/11/25] for x86_64...$ fpcmake -VFPCMake Version 2.0.0 [2017-02-13 rev 35434]$ uname -aLinux Duc101 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux ---------------------------------------------------------------------- marcov · 2023-09-04 14:36 From what I remembered, I simply had a simple shellscript that inited the PATH to some sane values, so that pwd.exe wasn't in the $PATH ---------------------------------------------------------------------- sjb · 2023-09-07 18:03 Quote from: marcov on September 04, 2023, 04:36:50 pmFrom what I remembered, I simply had a simple shellscript that inited the PATH to some sane values, so that pwd.exe wasn't in the $PATH Thank you.  I was worried I was missing something. Maybe I'm overthinking this. I've seen a suggestion that Makefile.fpc is not intended for that rank and file users and I should just do... 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 magic Which does work, but there no easy way to clean the directory. So maybe I should write my own Makefile.  To be honest, this is the most confusing part of doing anymore than a trivial example with fpc.  But maybe my brain is too engrained with how I would build a c program.  Sorry for the delayed thank you - this little heatwave here in the UK has kept away from doing the fun stuff ---------------------------------------------------------------------- PascalDragon · 2023-09-07 19:32 Quote from: marcov on September 04, 2023, 04:36:50 pmFrom what I remembered, I simply had a simple shellscript that inited the PATH to some sane values, so that pwd.exe wasn't in the $PATH Indeed. When I do builds of FPC in WSL I first do a echo $PATH and then a export PATH=... with all the paths that are not located on Windows.