View Issue Details

IDProjectCategoryView StatusLast Update
0036261LazarusIDEpublic2019-11-08 19:19
ReporterMarkus Müller Assigned ToMattias Gaertner  
Status assignedResolutionreopened 
Product Version2.0.6 
Summary0036261: Build the IDE fails
DescriptionAfter installation from a new Lazarus 2.0.6 the command "Tools" > "Build Lazarus with profile..." fails with the error in the "Message:
Build IDE: Exit code 2, Errors: 1
Fatal: Unable to open file C:UsersmmAppDataLocallazarusidemake.cfg -dx86_64

I have find out the mistake why lazarus cannot build itself and a solution for you to implement/correction.
Steps To Reproduce1. Unzip the "" into a new folder (there are old make tools from an other program)
2. Add this folder to the system PATH variable
3. Logout and login again
4. Install Lazarus V2.0.6
5. Menu from Lazarus: "Tools" > "Build Lazarus with profile..."
Additional InformationLazarus do not use the self installed make tool at first rank, so the make use old files where do not work correct with lazarus. With this 2 changes the lazarus build process works right:

1) The file "sh.exe" is missing after the installation from lazarus:
This tool need make itself and older "sh.exe" do not work correctly with lazarus.
Hint: FpcUpDeluxe download itself a correct version from this tool an use it.

2) In the makefile is the search sequenze to find the files in a bad order and the file "sh.exe" is not searched.
I have correct this and change build from SEARCHPATH to fill first the from lazarus installed folder, then add the PATH.
At second search the correct "sh.exe" into MAKESHELL and if found set the SHELL variable

BUT: when I do this change manually in the makefile, the build process from lazarus do not work, I thing Lazarus use a other makefile or build a makefile for his self build process.

For testing which files the make system will use try this command in the command line:
C:\lazarus>.\fpc\3.0.4\bin\x86_64-win64\make fpc_baseinfo

For testing where do the system want find a file you can try this command:
C:\lazarus>WHERE sh.exe
Tagsmake, Makefile
Fixed in Revision62207.
Attached Files


Markus Müller

2019-11-04 18:17

reporter (28,813 bytes) (1,960,478 bytes)

Marco van de Voort

2019-11-04 23:42

manager   ~0119064

Last edited: 2019-11-04 23:43

View 2 revisions

1) sh.exe is not missing. FPC nor Lazarus afaik have ever distributed it. It is not needed.
2) is thus not necessary.

If you get errors about sh.exe missing you are probably mixing FPC distributed tools with other ones. Clean up your path.

Where returns:

c:\repo\fpc\compiler>where sh.exe
INFO: Could not find files for the given pattern(s).

Markus Müller

2019-11-05 07:55

reporter   ~0119067

Last edited: 2019-11-05 12:26

View 3 revisions

Thank you very much for answer.

Please, try the "Steps To Reproduce" 1..3, after them try the command "where sh.exe"

My PATH environment is OK, I must have it to comile older STM32 µC projects.

Here is the documentation from the make tool, it use "sh.exe" itself, and if the make tool find a old version in the PATH, the make with lazarus does not work. In this case helb only when lazarus install and use a newer version from sh.exe.
Here the doku for "Choosing a Shell in DOS and Windows":


2019-11-05 12:27

developer   ~0119069

There are two threads in forums about this:,45342.msg331384.html#msg331384


2019-11-05 16:17

developer   ~0119075

Last edited: 2019-11-06 16:25

View 2 revisions

I am not an expert here, but I would like to say that no FPC folder is found in my system path (Win 10). I have several versions of Delphi on my machine which heavily "contaminate" the path by Borland/Emabarcadero versions of Make. Of course, when I build Laz or FPC from the command line I do this in a batch file which sets the path to the FPC/bin directory first. Building Laz from the IDE does not require such a manipulation - I never saw the issue reported here. It is definitely not a bug of Laz or FPC make files in my opinion.

Mattias Gaertner

2019-11-06 17:03

manager   ~0119103

About: "Lazarus do not use the self installed make tool at first rank,"

It should and it does here. In my PATH the Delphi make.exe is found first, and building via the IDE still works, because in Tools / Options / Make executable the full path is set C:\lazarus\fpc\3.0.4\bin....
What value is your Make "executable"?

Mattias Gaertner

2019-11-06 17:14

manager   ~0119104

No quotes for idemake.cfg. Please test and close if ok.

Vasileios Vlachos

2019-11-07 15:16

reporter   ~0119137

Had the same issue. Tested with Lazarus 2.0.4 and 2.0.6. The problem was resolved after removing MiniGW from the PATH.

Markus Müller

2019-11-07 18:26

reporter   ~0119144

Thank you very much for the fast fix the file "buildlazdialog.pas:857". I have load the trunk with FPCUpDeluxe and test it.

Now the compile from lazarus works good.

But my hint to your change, I have do a second test:
I type the command for check the tools where want the build process use:

C:\fpcupdeluxe\lazarus>C:\fpcupdeluxe\fpc\bin\x86_64-win64\make fpc_baseinfo

The Answer:
: : :
Mv........ C:/fpcupdeluxe/fpc/bin/x86_64-win64/mv.exe
Cp........ D:/WinARM/make-tools/bin/cp.exe
Rm........ D:/WinARM/make-tools/bin/rm.exe
GInstall.. C:/fpcupdeluxe/fpc/bin/x86_64-win64/ginstall.exe
Echo...... C:/fpcupdeluxe/fpc/bin/x86_64-win64/gecho.exe
Shell..... D:/WinARM/make-tools/bin/sh.exe
Date...... C:/fpcupdeluxe/fpc/bin/x86_64-win64/gdate.exe
FPCMake... C:/fpcupdeluxe/fpc/bin/x86_64-win64/fpcmake.exe
PPUMove... C:/fpcupdeluxe/fpc/bin/x86_64-win64/ppumove.exe
Zip....... C:/fpcupdeluxe/fpc/bin/x86_64-win64/zip.exe
: : :

You can see, the makefile found some other GNU build tools on the harddisc where are in the PATH variable (D:\WinARM\make-tools\bin\...).

Currently it is not a problem, but if you have to make more profound changes to the make process it can become a problem. I close the ticket, because currently it is not a problem. ;-)

Markus Müller

2019-11-07 18:27

reporter   ~0119145

Good work, Thank you very much!

Markus Müller

2019-11-07 18:35

reporter   ~0119146

@Mattias Gärtner: About your question:
"What value is your Make "executable"? "

The "make" ist not the problem. The problem ist the file "sh.exe", lazarus do not install this file and if make found a other on the disk, the make use it.

Markus Müller

2019-11-07 18:37

reporter   ~0119147

Now I will close, sorry I want write the answer from your question and I must reopen this ticket :-(
The information "sh.exe" is important.

Mattias Gaertner

2019-11-07 19:33

manager   ~0119148

So, the bug will reappear on systems, where mingw is installed in PATH and there is some path with spaces.

Is there some sh.exe, that we can ship to avoid this trouble?

Markus Müller

2019-11-07 22:42

reporter   ~0119149

Last edited: 2019-11-08 00:12

View 3 revisions

Before you fix the quoting, there was the trouble with old sh.exe, the old sh.exe has not work correctly with quoted strings.

FpcUpDeluxe download into "C:\fpcupdeluxe\fpcbootstrap\git\usr\bin" a newer version from sh.exe and do not use the PATH for search in the system.
This technik can be a solution for Lazarus, install the same sh.exe into "C:\lazarus\fpc\3.0.4\bin\x86_64-win64" and use not the system PATH in the makefile.

sh.exe is a command line interpreter, bash is a command line interpreter, cmd.exe, too. every interpreter has features.
make do not need sh.exe as command line interpreter, if it is not installed, then make use cmd.exe from windows, but make is automatically looking in PATH for sh.exe, and if there was found a old installation, then make do automatically use this and nothing else. This is a built in feature from make. you can only overwrite in the makefile the SHELL variable with a self installed sh.exe to fix this problem, but you can't clear the SHELL variable to a empty string.
A example for this fix I have write in the download in my first posting, look in my "makefile", the variable MAKESHELL.

I hope it help to understand how the make / makefile works in a windows system.


2019-11-08 08:46

reporter   ~0119153

This is a very interesting discussion.
However, your presumption about fpcupdeluxe using sh.exe from "C:\fpcupdeluxe\fpcbootstrap\git\usr\bin" is wrong.
Fpcupdeluxe isolates itself. The path is changed to prevent pickup of wrong tools.

During a run, fpc_baseinfo shows
Mv........ C:/fpclazbydeluxe/dummy/fpcbootstrap/mv.exe
Cp........ C:/fpclazbydeluxe/dummy/fpcbootstrap/cp.exe
Rm........ C:/fpclazbydeluxe/dummy/fpcbootstrap/rm.exe
GInstall.. C:/fpclazbydeluxe/dummy/fpcbootstrap/ginstall.exe
Echo...... C:/fpclazbydeluxe/dummy/fpcbootstrap/gecho.exe
Shell..... sh.exe
Date...... C:/fpclazbydeluxe/dummy/fpcbootstrap/gdate.exe
FPCMake... C: pclazbydeluxe\dummy \i386-win32 pcmake.exe
PPUMove... C: pclazbydeluxe\dummy \i386-win32\ppumove.exe
Zip....... C:/fpclazbydeluxe/dummy/fpcbootstrap/zip.exe

Look at the value of Shell ... its not found !!
However, I am now preparing an update of fpcupdeluxe to set shell on Windows to the value of COMSPEC.
In an effort to try to isolate even more !


2019-11-08 14:55

reporter   ~0119159

Last edited: 2019-11-08 14:56

View 2 revisions

Here are my infos:

Mv........ C:/fpcupdeluxe/fpc/bin/i386-win32/mv.exe
Cp........ C:/fpcupdeluxe/fpc/bin/i386-win32/cp.exe
Rm........ C:/fpcupdeluxe/fpc/bin/i386-win32/rm.exe
GInstall.. C:/fpcupdeluxe/fpc/bin/i386-win32/ginstall.exe
Echo...... C:/fpcupdeluxe/fpc/bin/i386-win32/gecho.exe
Shell..... sh.exe
Date...... C:/fpcupdeluxe/fpc/bin/i386-win32/gdate.exe
FPCMake... C:/fpcupdeluxe/fpc/bin/i386-win32/fpcmake.exe
PPUMove... C:/fpcupdeluxe/fpc/bin/i386-win32/ppumove.exe
Zip....... C:/Windows/zip.exe

Laz 2.0.6
Mv........ c:/lazarus/fpc/3.0.4/bin/i386-win32/mv.exe
Cp........ c:/lazarus/fpc/3.0.4/bin/i386-win32/cp.exe
Rm........ c:/lazarus/fpc/3.0.4/bin/i386-win32/rm.exe
GInstall.. c:/lazarus/fpc/3.0.4/bin/i386-win32/ginstall.exe
Echo...... c:/lazarus/fpc/3.0.4/bin/i386-win32/gecho.exe
Shell..... sh.exe
Date...... c:/lazarus/fpc/3.0.4/bin/i386-win32/gdate.exe
FPCMake... c:/lazarus/fpc/3.0.4/bin/i386-win32/fpcmake.exe
PPUMove... c:/lazarus/fpc/3.0.4/bin/i386-win32/ppumove.exe
Zip....... C:/Windows/zip.exe

Why it use zip.exe from windows folder?


2019-11-08 17:18

reporter   ~0119164

Especially for you, I have made a pre-release.

In the ExtraSheet, there are two additional buttons.
To check both then FPC as well as the Lazarus Makefile.

Please report back your findings.

Markus Müller

2019-11-08 17:59

reporter   ~0119167

Last edited: 2019-11-08 18:04

View 3 revisions

For a better unterstand the make system, open a Dos-Box "cmd" and do this steps:
- go into \Lazarus folder (from installation 2.0.6/Win64)
- Create a Folder C:\TestPath
- overwrite the PATH variable from the current session to C:\TestPath
- create dummy files: rm.exe, sh.exe, zip.exe
- show system whitch files will the make found

cd \Lazarus
mkdir C:\TestPath;
SET PATH=C:\TestPath
echo 1 > C:\TestPath\rm.exe
echo 1 > C:\TestPath\sh.exe
echo 1 > C:\TestPath\zip.exe
.\fpc\3.0.4\bin\x86_64-win64\make fpc_baseinfo

The make system found this files:
: : :
Mv........ C:/lazarus/fpc/3.0.4/bin/x86_64-win64/mv.exe
Cp........ C:/lazarus/fpc/3.0.4/bin/x86_64-win64/cp.exe
Rm........ C:/TestPath/rm.exe
GInstall.. C:/lazarus/fpc/3.0.4/bin/x86_64-win64/ginstall.exe
Echo...... C:/lazarus/fpc/3.0.4/bin/x86_64-win64/gecho.exe
Shell..... C:/TestPath/sh.exe
Date...... C:/lazarus/fpc/3.0.4/bin/x86_64-win64/gdate.exe
FPCMake... C:/lazarus/fpc/3.0.4/bin/x86_64-win64/fpcmake.exe
PPUMove... C:/lazarus/fpc/3.0.4/bin/x86_64-win64/ppumove.exe
Zip....... C:/TestPath/zip.exe
: : :

... please let the Dos-Box open for the next test ...

What is happen?
The make looks very limple in the PATH only to the file names, This 3 where are created are only small textfilse with a size of 4 byte.

How can I change that the make do first look in to installation folder from lazarus?
In the makefile from C:\Lazarus, the variable "SEARCHPATH" hold all path folders additional the make path itself. In the current version from Lazarus is first set the "SEARCHPATH" with PATH and in second order the Lazarus MAKE path.
It is very simple to change the order from this, set first in the SEARCHPATH the MAKE pathe, then add the other PATH to SEARCHPATH:
: :::
SEARCHPATH:=$(patsubst %/,%,$(subst \,/,$(dir $(MAKE))))
ifneq ($(findstring darwin,$(OSTYPE)),)
inUnix=1 #darwin
SEARCHPATH+=$(filter-out .,$(subst :, ,$(PATH)))
ifeq ($(findstring ;,$(PATH)),)
SEARCHPATH+=$(filter-out .,$(subst :, ,$(PATH)))
SEARCHPATH+=$(subst ;, ,$(PATH))
: :::

Please change this makefile to the makefile from my zip, there is the change done (my first posting)
After them go to the Dos-Box again and try the command again:

.\fpc\3.0.4\bin\x86_64-win64\make fpc_baseinfo

The make system found this files:
: : :
Mv........ C:/lazarus/fpc/3.0.4/bin/x86_64-win64/mv.exe
Cp........ C:/lazarus/fpc/3.0.4/bin/x86_64-win64/cp.exe
Rm........ C:/lazarus/fpc/3.0.4/bin/x86_64-win64/rm.exe
GInstall.. C:/lazarus/fpc/3.0.4/bin/x86_64-win64/ginstall.exe
Echo...... C:/lazarus/fpc/3.0.4/bin/x86_64-win64/gecho.exe
Shell..... C:/TestPath/sh.exe
Date...... C:/lazarus/fpc/3.0.4/bin/x86_64-win64/gdate.exe
FPCMake... C:/lazarus/fpc/3.0.4/bin/x86_64-win64/fpcmake.exe
PPUMove... C:/lazarus/fpc/3.0.4/bin/x86_64-win64/ppumove.exe
Zip....... C:/TestPath/zip.exe
: : :

Ok, it's a litte bit better, the file "rm.exe" is found in the Lazarus installation.

In second order, the files sh.exe and zip.exe are not installed by Lazarus, then the make build is using this 2 dummy files.

If you unterstand this tutorial for make, the I write the second tutorial for the right way in the makefile to find sh.exe.

Markus Müller

2019-11-08 19:08

reporter   ~0119168

Last edited: 2019-11-08 19:19

View 3 revisions

@ Alfred:
I have download the new EXE "fpcupdeluxe-x86_64-win64.exe" from your link and delete all files from "C:\fpcupdeluxe".
I report back the findings, see the screenshots...

If you want and it helps, you can looking with TeamViewer into my Computer and compile what you want.

But I have a question to you: Why do you want to use the "cmd.exe", "CMD.exe" works not the same like "SH.EXE".
You download the "SH.EXE" into the folder "C:\fpcupdeluxe\fpcbootstrap\git\usr\bin\", you have to try only set in the makefile the SHELL to "C:\fpcupdeluxe\fpcbootstrap\git\usr\bin\sh.exe" and all will be work right.

FpcUpDeluxe01.png (60,993 bytes)   
FpcUpDeluxe01.png (60,993 bytes)   
FpcUpDeluxe02.png (39,107 bytes)   
FpcUpDeluxe02.png (39,107 bytes)   
FpcUpDeluxe03.png (29,842 bytes)   
FpcUpDeluxe03.png (29,842 bytes)   

Issue History

Date Modified Username Field Change
2019-11-04 18:17 Markus Müller New Issue
2019-11-04 18:17 Markus Müller File Added:
2019-11-04 18:17 Markus Müller File Added:
2019-11-04 18:21 Markus Müller Tag Attached: Makefile
2019-11-04 18:22 Markus Müller Tag Attached: make
2019-11-04 23:42 Marco van de Voort Note Added: 0119064
2019-11-04 23:43 Marco van de Voort Note Edited: 0119064 View Revisions
2019-11-05 07:55 Markus Müller Note Added: 0119067
2019-11-05 12:25 Markus Müller Note Edited: 0119067 View Revisions
2019-11-05 12:26 Markus Müller Note Edited: 0119067 View Revisions
2019-11-05 12:27 Michl Note Added: 0119069
2019-11-05 16:17 wp Note Added: 0119075
2019-11-06 16:25 wp Note Edited: 0119075 View Revisions
2019-11-06 17:03 Mattias Gaertner Note Added: 0119103
2019-11-06 17:14 Mattias Gaertner Assigned To => Mattias Gaertner
2019-11-06 17:14 Mattias Gaertner Status new => resolved
2019-11-06 17:14 Mattias Gaertner Resolution open => fixed
2019-11-06 17:14 Mattias Gaertner Fixed in Revision => 62207.
2019-11-06 17:14 Mattias Gaertner LazTarget => -
2019-11-06 17:14 Mattias Gaertner Widgetset Win32/Win64 => Win32/Win64
2019-11-06 17:14 Mattias Gaertner Note Added: 0119104
2019-11-07 15:16 Vasileios Vlachos Note Added: 0119137
2019-11-07 18:26 Markus Müller Note Added: 0119144
2019-11-07 18:27 Markus Müller Status resolved => closed
2019-11-07 18:27 Markus Müller Note Added: 0119145
2019-11-07 18:35 Markus Müller Status closed => assigned
2019-11-07 18:35 Markus Müller Resolution fixed => reopened
2019-11-07 18:35 Markus Müller Note Added: 0119146
2019-11-07 18:37 Markus Müller Note Added: 0119147
2019-11-07 19:33 Mattias Gaertner Note Added: 0119148
2019-11-07 22:42 Markus Müller Note Added: 0119149
2019-11-07 22:54 Markus Müller Note Edited: 0119149 View Revisions
2019-11-08 00:12 Markus Müller Note Edited: 0119149 View Revisions
2019-11-08 08:46 Alfred Note Added: 0119153
2019-11-08 14:55 Maik Note Added: 0119159
2019-11-08 14:56 Maik Note Edited: 0119159 View Revisions
2019-11-08 17:18 Alfred Note Added: 0119164
2019-11-08 17:59 Markus Müller Note Added: 0119167
2019-11-08 18:02 Markus Müller Note Edited: 0119167 View Revisions
2019-11-08 18:04 Markus Müller Note Edited: 0119167 View Revisions
2019-11-08 19:08 Markus Müller File Added: FpcUpDeluxe01.png
2019-11-08 19:08 Markus Müller File Added: FpcUpDeluxe02.png
2019-11-08 19:08 Markus Müller File Added: FpcUpDeluxe03.png
2019-11-08 19:08 Markus Müller Note Added: 0119168
2019-11-08 19:15 Markus Müller Note Edited: 0119168 View Revisions
2019-11-08 19:19 Markus Müller Note Edited: 0119168 View Revisions