Recent

Author Topic: Scripts with lazbuild  (Read 427 times)

devEric69

  • Full Member
  • ***
  • Posts: 137
Scripts with lazbuild
« on: October 08, 2019, 03:40:13 pm »
Hello,

I'm testing different Bash scripts calling lazbuild.exe, on a Win7 netbook, with msys32 (a Linux Bash emulator on Windows).

• Building a package:
Quote
LAZBUILD_CMD=$LAZ_FULL_DIR"/lazbuild.exe --pcp="$PRIMARY_CONFIG_PATH" --cpu="$CPU" --widgetset="$WIDGETSET" --verbose-pkgsearch dmath.lpk --build-mode="$PROJET_MODE
#Launch of the cmd...
$LAZBUILD_CMD
==> it works.


• Construction of a project:
Quote
LAZBUILD_CMD=$LAZ_FULL_DIR"/lazbuild.exe -B --pcp="$PRIMARY_CONFIG_PATH" --cpu="$CPU" --widgetset="$WIDGETSET" --verbose --verbose --build-mode="$PROJET_MODE" "$WORKING_DIR"\projRecompilAuto.lpi"
#Launch of the cmd...
$LAZBUILD_CMD
==> it works.

• Construction of the EDI:
Quote
LAZBUILD_CMD=$LAZ_FULL_DIR"/lazbuild.exe "$BUILD_OPTS" --pcp="$PRIMARY_CONFIG_PATH" --cpu="$CPU" --widgetset="$WIDGETSET" --build-ide="$EDI_MODE
#Launch of the cmd...
$LAZBUILD_CMD
==> It compiles, but it ends with the following error message:

Quote
[...snip]
C:/msys32/usr/bin/rm.exe -f
make[1]: Leaving directory `D:/Program_Files/lazarus/ide'
make: Leaving directory `D:/Program_Files/lazarus'
make: *** No rule to make target `cleanide ide'.  Stop.
Error: (lazarus) EDI creation: stopped with exit code 2

nb: creating Lazarus, from the menu in Lazarus, with the IDE profile named "normal IDE", works perfectly. So I am neither blocked nor obliged to reinstall from FPCupDeluxe.

Are there "relatively easy" ways to understand what is blocked (ps: I don't have a lot of knowledge, neither of fpc.exe, nor of fpc.cfg)?

« Last Edit: October 08, 2019, 03:52:15 pm by devEric69 »
use: Ubuntu 18.04 + Laz. 1.8.5 + FPC 3.0.5 (64 bits).

Cyrax

  • Hero Member
  • *****
  • Posts: 754
Re: Scripts with lazbuild
« Reply #1 on: October 08, 2019, 04:35:06 pm »
It fails due to MSYS2 environment and its utilities. FPC have its own.

You need to convert Linux directory separator (/) to Windows one (\).
Also you need make sure that PATH environment variable contains only full path to FPC binaries which contains Linux utilities (built in MinGW environment) (rm, make etc) so FPC's make doesn't call MSYS2/Linux Bash Shell on Windows 10 equivalent ones.

Simplest and easiest method is to generate Windows command batch script (which includes modification to PATH environment variable and expansion of all Linux variables; namely paths to directories to Windows format)  and call it under Windows Command Shell (cmd.exe).

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7430
Re: Scripts with lazbuild
« Reply #2 on: October 08, 2019, 09:29:59 pm »
The main problem is afaik that the FPC (old mingw) utils change their behaviour and start executing stuff over the shell if they find pwd.exe or sh.exe.

So I keep mingw and FPC out of the path.

Then I use a batchfiles like this:

Code: [Select]
@echo off

Rem we save oldpath only once, so we can always revert to it.

if "%OLDPATH%" neq "" goto :nosave
set OLDPATH=%PATH%
:nosave
SET PATH=%OLDPATH%
PATH c:\pp32\bin\i386-win32;%PATH%

where c:\pp32 is where my 32-bit 3.3.1 compiler is. I also have one for 64-bit FPC, mingw, cygwin, release FPC versions and even (tex4live)latex.

devEric69

  • Full Member
  • ***
  • Posts: 137
Re: Scripts with lazbuild
« Reply #3 on: October 09, 2019, 11:45:41 am »
@Cyrax and @marcov: thank you for your answers.
Unfortunately, the construction of the IDE via a batch file does not go any further.

This is my batch:

Code: Bash  [Select]
  1. @echo off
  2. @color 1F
  3.  
  4. @echo on
  5. @echo.
  6.  
  7. @REM We save old PATH only once, so we can always revert to it.
  8. @REM if OLDPATH<>"" then...
  9. @if "%PATH%" neq "" (goto :save) else (goto :nosave)
  10. :save
  11. @SET OLDPATH=%PATH%
  12. :nosave
  13.  
  14. @REM Set new PATH towards ppc386.exe, fpc.exe and its fpc.cfg, make.exe,
  15. @REM ..., Win32-bits tools
  16. @PATH D:\Program_Files\lazarus\fpc\3.0.4\bin\i386-win32;
  17. @echo OLDPATH saved=%OLDPATH%
  18. @echo.
  19. @echo new PATH=%PATH%
  20. @pause
  21.  
  22. @REM Creation of the cmd... --build-ide
  23. @SET CPU=i386
  24. @SET WIDGETSET=win32
  25. @SET EDI_MODE="EDI normal"
  26. @SET LAZ_FULL_DIR=D:\Program_Files\lazarus
  27. @SET BUILD_OPTS= -B --quiet --quiet
  28. @SET WORKING_DIR=E:\Lazarus\Projets\copieW_test_recompile_auto
  29. @SET PRIMARY_CONFIG_PATH=%WORKING_DIR%\current_primary_config_file
  30.  
  31. @SET LAZBUILD_CMD=%LAZ_FULL_DIR%\lazbuild.exe %BUILD_OPTS% --pcp=%PRIMARY_CONFIG_PATH% --cpu=%CPU% --widgetset=%WIDGETSET% --build-ide=%EDI_MODE%
  32. @REM Launch the cmd...
  33. @echo This cmd will be launched: %LAZBUILD_CMD%
  34. @pause
  35. %LAZBUILD_CMD%
  36.  
  37. @REM Shall we restore the original PATH?
  38. @if "%OLDPATH%" neq "" (goto :restore_path) else (goto :norestore_path)
  39. :restore_path
  40. @set PATH=%OLDPATH%
  41. :norestore_path
  42.  
  43. @echo PATH restored=%PATH%
  44. @echo It's over!
  45. @pause

The cmd launched is...:
Quote
D:\Program_Files\lazarus\lazbuild.exe  -B --quiet --quiet --pcp=E:\Lazarus\Projets\copieW_test_recompile_auto\current_primary_config_file --cpu=i386 --widgetset=win32 --build-ide="EDI normal"
...and my Window's PATH has only one path: D:\Program_Files\lazarus\fpc\3.0.4\bin\i386-win32;


==> I started by renaming D:\Program_Files\lazarus\fpc\3.0.4\bin\i386-win32\pwd.exe to ...\_pwd.exe, and I get this message:
Quote
{...snip}
make: Entering directory `D:/Program_Files/lazarus'
make: Leaving directory `D:/Program_Files/lazarus'
Makefile:29: *** You need the GNU utils package to use this Makefile.  Stop.
Error: (lazarus) Nettoyer les codes sources de Lazarus: stopped with exit code 2

==> Then, I restarted it without renaming pwd.exe, and it ends like this:
Quote
{...snip}
make: Entering directory `D:/Program_Files/lazarus'
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/make -C ide
make[1]: Entering directory `D:/Program_Files/lazarus/ide'
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
make[1]: Leaving directory `D:/Program_Files/lazarus/ide'
make: Leaving directory `D:/Program_Files/lazarus'
make: Entering directory `D:/Program_Files/lazarus'
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/make -C ide
make[1]: Entering directory `D:/Program_Files/lazarus/ide'
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
make[1]: Leaving directory `D:/Program_Files/lazarus/ide'
make: Leaving directory `D:/Program_Files/lazarus'
make: *** No rule to make target `cleanide ide'.  Stop.
Error: (lazarus) Création de l'EDI: stopped with exit code 2


If you see other tests to do, or have other informations to check, they are welcome (but again, I'm not blocked).
« Last Edit: October 09, 2019, 11:50:48 am by devEric69 »
use: Ubuntu 18.04 + Laz. 1.8.5 + FPC 3.0.5 (64 bits).

devEric69

  • Full Member
  • ***
  • Posts: 137
Re: Scripts with lazbuild
« Reply #4 on: October 09, 2019, 01:43:39 pm »
I've new hints.

Well, actually, my tests broke something.
To be exhaustive, before testing my Bash or Batch script files, I first moved my original --pcp that was in...:
C:\Users\ParoleDeMainate\AppData\Local\lazarus
...to a subdirectory of my Subversion working directory, named copyW_test_recompile_auto. My new --pcp is now...:
E:\Lazarus\Projects\copyW_test_recompile_auto\current_primary_config_file .

I had too, renamed all the paths ad'hoc, in all the files of my new --pcp.
But, fpc.exe no longer sees its file fpc.cfg which is still placed in the same directory (I can't even trace anymore in step-by-step debugging)...

So, I'm now looking for how and where to tell fpc.exe that its fpc.cfg is still placed in D:\Program_Files\lazarus\fpc\3.0.4\bin\i386-win32.
« Last Edit: October 09, 2019, 01:47:45 pm by devEric69 »
use: Ubuntu 18.04 + Laz. 1.8.5 + FPC 3.0.5 (64 bits).

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7430
Re: Scripts with lazbuild
« Reply #5 on: October 09, 2019, 02:59:45 pm »
The binaries that come with FPC are good, just make sure he doesn't find other ones (mingw or cygwin).

IOW you should have a FPC release install dir in your path, and it can allow the pwd.exe that came with FPC.

Cyrax

  • Hero Member
  • *****
  • Posts: 754
Re: Scripts with lazbuild
« Reply #6 on: October 09, 2019, 03:31:39 pm »
I've new hints.

Well, actually, my tests broke something.
To be exhaustive, before testing my Bash or Batch script files, I first moved my original --pcp that was in...:
C:\Users\ParoleDeMainate\AppData\Local\lazarus
...to a subdirectory of my Subversion working directory, named copyW_test_recompile_auto. My new --pcp is now...:
E:\Lazarus\Projects\copyW_test_recompile_auto\current_primary_config_file .

I had too, renamed all the paths ad'hoc, in all the files of my new --pcp.
But, fpc.exe no longer sees its file fpc.cfg which is still placed in the same directory (I can't even trace anymore in step-by-step debugging)...

So, I'm now looking for how and where to tell fpc.exe that its fpc.cfg is still placed in D:\Program_Files\lazarus\fpc\3.0.4\bin\i386-win32.

Is directory D:\Program_Files created by you? Can you install whole package (FPC and Lazarus) under different directory with lowercase characters and without underscore?

Quote
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f

Are you running your batch script under MSYS2 or Windows Command Shell environment?

devEric69

  • Full Member
  • ***
  • Posts: 137
Re: Scripts with lazbuild
« Reply #7 on: October 10, 2019, 04:34:28 pm »
(Sorry for the French in the IDE; I installed too quickly; I prefer an interface in English for the homogeneity of the discussion)

Quote
@marcov: The binaries that come with FPC are good, just make sure he doesn't find other ones (mingw or cygwin).
IOW you should have a FPC release install dir in your path, and it can allow the pwd.exe that came with FPC.

I only have the directory D:\Program_Files\lazarus\mingw\i386-win32\bin in the MS-Windows environment variables (see environment_variables.png).

I run this batch script (with the "-vut" switch to get as much information as possible, and the output is written in a text file (you can see the big file build_EDI.bat.output.txt.zip - here: https://mon-partage.fr/f/aUBKvRWr/ - and [^^]:, below)...:
Code: Bash  [Select]
  1. @echo off
  2. @color 1F
  3.  
  4. @echo on
  5. @echo.
  6.  
  7. @REM We save old PATH only once, so we can always revert to it.
  8. @REM if OLDPATH<>"" then...
  9. @if "%PATH%" neq "" (goto :save) else (goto :nosave)
  10. :save
  11. @SET OLDPATH=%PATH%
  12. :nosave
  13.  
  14. @REM Set new PATH towards ppc386.exe, fpc.exe and its fpc.cfg, make.exe,
  15. @REM ..., Win32-bits tools
  16. @PATH D:\Program_Files\lazarus;D:\Program_Files\lazarus\ide;D:\Program_Files\lazarus\mingw\i386-win32\bin;D:\Program_Files\lazarus\fpc\3.0.4\bin\i386-win32;D:\Program_Files\lazarus\tools;E:\Lazarus\Projets\copieW_test_recompile_auto\current_primary_config_file;
  17. @REM PPC_CONFIG_PATH ==> Cf. https://www.freepascal.org/docs-html/user/usersu10.html
  18. @setx PPC_CONFIG_PATH D:\Program_Files\lazarus\fpc\3.0.4\bin\i386-win32
  19. @echo OLDPATH saved=%OLDPATH%
  20. @echo.
  21. @echo new PATH=%PATH%
  22. @pause
  23.  
  24. @REM Creation of the cmd... --build-ide
  25. @SET CPU=i386
  26. @SET WIDGETSET=win32
  27. @SET EDI_MODE_1=""
  28. @SET BUILD_MODE_1="EDI normal"
  29. @REM : le mode de compilation enregistré dans le projet Debug_Compilation_verbeuse
  30. @REM peut contenir plein d'options verbeuses: -vut -va -s etc, certes, mais ne peut pas être appliqué
  31. @REM à la compilation d'un profi de l'EDI-même, qui existe à un niveau supérieur. Les modes Debug_Compilation_verbeuse, Debug, Release, etc
  32. @REM ne semblent pouvoir être appliqués que pour la recompilation de paquets ou de projets.
  33. @SET EDI_MODE_2="-vut"
  34. @SET BUILD_MODE_2="EDI normal"
  35. @REM @SET BUILD_MODE_2="EDI optimise"
  36. @SET LAZ_FULL_DIR=D:\Program_Files\lazarus
  37. @SET BUILD_OPTS= -B --verbose --verbose
  38. @REM @SET BUILD_OPTS= -B --quiet --quiet
  39. @SET WORKING_DIR=E:\Lazarus\Projets\copieW_test_recompile_auto
  40. @SET PRIMARY_CONFIG_PATH=%WORKING_DIR%\current_primary_config_file
  41. @SET COMPILATEUR=D:\Program_Files\lazarus\fpc\3.0.4\bin\i386-win32\ppc386.exe
  42.  
  43. @REM --ok-- @SET LAZBUILD_CMD=%LAZ_FULL_DIR%\lazbuild.exe %BUILD_OPTS% --pcp=%PRIMARY_CONFIG_PATH% --cpu=%CPU% --widgetset=%WIDGETSET% --compiler=%COMPILATEUR% --build-mode=%BUILD_MODE_1% --build-ide=%EDI_MODE_1%
  44. @SET LAZBUILD_CMD=%LAZ_FULL_DIR%\lazbuild.exe %BUILD_OPTS% --pcp=%PRIMARY_CONFIG_PATH% --cpu=%CPU% --widgetset=%WIDGETSET% --compiler=%COMPILATEUR% --build-mode=%BUILD_MODE_2% --build-ide=%EDI_MODE_2%
  45. @REM Launch the cmd...
  46. @echo This cmd will be launched: %LAZBUILD_CMD%
  47. @pause
  48. %LAZBUILD_CMD% > E:\Lazarus\Projets\copieW_test_recompile_auto\$commun\build_EDI_seul.bat.output.txt | type E:\Lazarus\Projets\copieW_test_recompile_auto\$commun\build_EDI_seul.bat.output.txt
  49. @pause
  50.  
  51. @REM Shall we restore the original PATH?
  52. @if "%OLDPATH%" neq "" (goto :restore_path) else (goto :norestore_path)
  53. :restore_path
  54. @set PATH=%OLDPATH%
  55. :norestore_path
  56.  
  57. @echo PATH restored=%PATH%
  58. @echo It's over!
  59. @pause

...which affects PATH:=new PATH=D:\Program_Files\lazarus;D:\Program_Files\lazaruside;D:\Program_Files\lazarus\mingw\i386-win32\bin;D:\Program_Files\lazarus\fpc\3.0.4\bin\i386-win32;D:\Program_Files\lazarus\tools;E:\Lazarus
\Projects\copy\W_test_recompile_auto\current_primary_config_file;


This cmd launched is:
Code: Bash  [Select]
  1. D:\Program_Files\lazarus\lazbuild.exe  -B --quiet --quiet --pcp=E:\Lazarus\Projets\copieW_test_recompile_auto\current_primary_config_file --cpu=i386 --widgetset=win32 --comp
  2. iler=D:\Program_Files\lazarus\fpc\3.0.4\bin\i386-win32\ppc386.exe --build-mode="EDI normal" --build-ide="-vut"

The script always ends in error, due to the cmd...:
Quote
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/make -C ide cleanide
make[1]: Entering directory `D:/Program_Files/lazarus/ide''.
D:/Program_Files/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe -f
{...snip...}
make[1]: Leaving directory `D:/Program_Files/lazarus/ide'.
make: Leaving directory `D:/Program_Files/lazarus'
make: *** No rule to make target `cleanide ide'.  Stop.
Error: (lazarus) EDI creation: stopped with exit code 2
...I added D:\Program_Files\lazarus\ide to the PATH, since it's make -C ide cleanide that stops everything. But it didn't change anything for the better.



[^^]:
I've attached the batch execution output big file, build_EDI.bat.output.txt.zip, here: https://mon-partage.fr/f/aUBKvRWr/. I didn't see anything extraordinary in it, that could explain the erreor. The only notable things that are always coming back, are those:
- "several "*.pas not found, but not seemingly necessary files
- and this, when reading the fpc.cfg:
Quote
Configfile search: D:\Program_Files\lazarus\fpc\3.0.4\bin\i386-win32\fpc.cfg
(11026) Reading options from file D:\Program_Files\lazarus\fpc\3.0.4\bin\i386-win32\fpc.cfg
Path "C:\Users\ParoleDeMainate\AppData\Local\FreePascal\fppkg\units\i386-win32\*\" not found
Path "D:\Program_Files\lazarus\fpc\3.0.4\lib\i386-win32\" not found
Path "C:\Users\ParoleDeMainate\AppData\Local\FreePascal\fppkg\units\i386-win32\*\" not found
Path "D:\Program_Files\lazarus\fpc\3.0.4\lib\i386-win32\" not found
But, these paths have no equivalent in my --pcp or in D:\Program_Files\lazarus\...
- Warning like: {snip}...use an unsigned type instead.


==> One last point: in the Lazarus environment variables, I say that the compiler is the "real compiler", i. e. D:\Program_Files\lazarus\fpc\3.0.4\bin\i386-win32\ppc386.exe, instead of the path to the "proxy compiler" fpc.exe. Now, when I open Lazarus with its MS-shortcut-symlink, which is D:\Program_Files\lazarus\lazarus.exe --pcp="E:\Lazarus\Projects\copyW_test_recompile_auto\current_primary_config_file" --debug-log="E:\Lazarus\Projects\copyW_test_recompile_auto\current_primary_config_file\infos_debug\onStartLazarus.log", Lazarus IDE no longer "complains", now, about not finding the file fpc.cfg  :) .


Quote
@Cyrax wrote: Is directory D:\Program_Files created by you? Can you install whole package (FPC and Lazarus) under different directory with lowercase characters and without underscore?
Yes (C:\=Windows, D:\=\Program_Files and \Program Files, E:\=data, including the code and the PCP "Subversioned" in a Subversion "working directory").
Quote
Can you install whole package (FPC and Lazarus) under different directory with lowercase characters and without underscore?
Yes: I will do it. I'll post the result...
Quote
@Cyrax wrote: Are you running your batch script under MSYS2 or Windows Command Shell environment?
The batch runs now under MS-Windows Command Shell environment (msys32 has been disabled (its directory is called \_msys32, and it is no longer accessible from the MS-Windows environment variables. See attached MS-DOS_batch_execution.png).

« Last Edit: October 10, 2019, 04:39:05 pm by devEric69 »
use: Ubuntu 18.04 + Laz. 1.8.5 + FPC 3.0.5 (64 bits).

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7430
Re: Scripts with lazbuild
« Reply #8 on: October 10, 2019, 04:49:32 pm »
(Sorry for the French in the IDE; I installed too quickly; I prefer an interface in English for the homogeneity of the discussion)

Quote
@marcov: The binaries that come with FPC are good, just make sure he doesn't find other ones (mingw or cygwin).
IOW you should have a FPC release install dir in your path, and it can allow the pwd.exe that came with FPC.

I only have the directory D:\Program_Files\lazarus\mingw\i386-win32\bin in the MS-Windows environment variables (see environment_variables.png).

spaces in filenames, and mingw or cygwin utils that are not provided by FPC in the path are not supported. This makes bash as scripting langauge undesirable.

Make sure only the release directory of FPC is in the PATH and that no other tools that offer such binaries (sh.exe, pwd.exe, rm.exe make.exe etc etc) are in the path.

I mentioned sh.exe because that is the only case that hurts if mingw is anywhere in the path, even if the FPC dir is first (because fpc doesn't have it).
« Last Edit: October 10, 2019, 04:51:13 pm by marcov »

devEric69

  • Full Member
  • ***
  • Posts: 137
Re: Scripts with lazbuild
« Reply #9 on: October 10, 2019, 07:14:30 pm »
So, quickly:
- I've searched for sh.exe, pwd.exe, rm.exe, make.exe on my computer: I've found an old Git installation (but that wasn't \ no longer, in my PATH), that I've deleted;
- backup of my PCP (E:\Lazarus\Projects\copy\W_test_recompile_auto\current_primary_config_file), moved elsewhere;
- uninstalling Lazarus+FCP;
- reinstallation of Lazarus+FCP in D:\programs;
- I've checked to see, if it had created a PCP for me in C:\Users\Me\AppData\Local? No. I am happy;
- I put my PCP (E:\Lazarus\Projects\copy\W_test_recompile_auto\current_primary_config_file) back in its location;
- I recreate a shortcut to Lazarus.exe, on the MS-Windows desktop, with D:\programs\lazarus.exe --pcp="E:\Lazarus\Projects\copyW_test_recompile_auto\current_primary_config_file" --debug-log="E:\Lazarus\Projects\copyW_test_recompile_auto\current_primary_config_file\infos_debug\onStartLazarus.log";
- launch of Lazarus: a window tells me that it detects the PCP of an old installation (E:\Lazarus\Projects\copyW_test_recompile_auto\current_primary_config_file). It suggests me, to upgrade this information, to ignore it, or to abort the Lazarus's launch;
- I choose to "upgrade" (even if I've reinstalled the same versions, of Lazarus and FPC);
- Lazarus.exe starts: everything works, and it points well to my PCP=E:\Lazarus\Projects\copy\W_test_recompile_auto\current_primary_config_file. The compiler is again fpc.exe (it finds fpc.cfg), which runs well ppc386.exe. I can debug... <== nice functionality;
- I adjust my batch script, and I only have one PATH=D:\programs\fpc\3.0.4\bin;
==> I get the same result:
Quote
Note: (lazarus) renamed file "D:\programs\lazarus.exe" to "D:\programs\lazarus.old.exe"
make: Entering directory `D:/programs' `D:/programs'
D:/programs/fpc/3.0.4/bin/i386-win32/make -C ide cleanide
make[1]: Entering directory `D:/programs/ide''.
D:/programs/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/programs/fpc/3.0.4/bin/i386-win32/rm.exe -f
{...snip...}
D:/programs/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/programs/fpc/3.0.4/bin/i386-win32/rm.exe -f

make[1]: Leaving directory `D:/programs/ide' `D:/programs/ide
make: Leaving directory `D:/programs' `D:/programs'

make: Entering directory `D:/programs' `D:/programs'
D:/programs/fpc/3.0.4/bin/i386-win32/make -C ide cleanide

make[1]: Entering directory `D:/programs/ide''.
D:/programs/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/programs/fpc/3.0.4/bin/i386-win32/rm.exe -f
{...snip...}
D:/programs/fpc/3.0.4/bin/i386-win32/rm.exe -f
D:/programs/fpc/3.0.4/bin/i386-win32/rm.exe -f

make[1]: Leaving directory `D:/programs/ide' `D:/programs/ide
make: Leaving directory `D:/programs'

make: *** No rule to make target `cleanide ide'.  Stop.
Error: (lazarus) Creating the IDE: stopped with exit code 2


Okay, as I've said, I'm not stuck.
Now, I have no skills in make.exe and makefile. However, the thing that surprises me, is that it does the same thing twice (normal or not: a success then a failure, by doing the same thing)??!

If you want me to do more tests, I'm at your disposal...
« Last Edit: October 10, 2019, 07:27:41 pm by devEric69 »
use: Ubuntu 18.04 + Laz. 1.8.5 + FPC 3.0.5 (64 bits).