Skip to main content
unsigned_char_array
Lead III
April 23, 2024
Solved

headless-build.bat bug: Headless build freezes for 20 seconds after "Build Finished"

  • April 23, 2024
  • 1 reply
  • 1566 views

I have a .cmd script to do headless builds on Windows 11:

 

 

@Echo off
echo incrementally building...
set PROJECT_DIR=%cd%\..

set PROJECT_NAME=MY_PROJECT_NAME
set BUILD_TYPE=Debug

set workspace_folder=%temp%\%PROJECT_NAME%_workspace
mkdir %workspace_folder%

C:\ST\STM32CubeIDE_1.11.2\STM32CubeIDE\headless-build.bat -data %workspace_folder% -import %PROJECT_DIR% -build %PROJECT_NAME%/%BUILD_TYPE%

exit /b %ERRORLEVEL%

 

 

It builds perfectly:

 

 

13:31:22 Build Finished. 0 errors, 0 warnings. (took 3s.227ms)

 

 

After this the command prompt sometimes hangs for about 20 seconds. But not always.

First build after switching between TouchGFX, command prompt or STM32CubeIDE freezes 20 seconds (in TouchGFX or command prompt), subsequent builds don't freeze until I switch again. This is not a big deal as it's only the first build, but I still like to have it fixed. I tried many things:

  • starting it with START "" /WAIT /B
  • starting it with START "" /WAIT /B /HIGH
  • copying the contents of the headless-build.bat (so directly calling the executable instead of another bat file)
  • removing post build commands
  • disabling multithreaded build
  • closing project in STM32CubeIDE or closing STM32CubeIDE after building there

I've attached a simple project that replicates the issue. The project is simpler and the delay is only 5 seconds after build after switching. I've removed the Middlewares folder or else the archive would be 256MiB. It's just a project generated from TouchGFX for the STM32H735G-DK with slight modifications

 

This topic has been closed for replies.
Best answer by unsigned_char_array

I've solved it! It's a bug or a missing feature in STM32CubeIDE\headless-build.bat.

The culprit is the indexer which runs after the build (silently, except when running it verbose). The indexer is not needed for a headless build in my opinion. (I found it in an example here: https://stackoverflow.com/a/76571159/15307950)

By adding the parameter -no-indexer to headless-build.bat the problem goes away.

 

 

 

 off
echo incrementally building...
set PROJECT_DIR=%cd%\..

set PROJECT_NAME=MY_PROJECT_NAME
set BUILD_TYPE=Debug

set workspace_folder=%temp%\%PROJECT_NAME%_workspace
mkdir %workspace_folder%

C:\ST\STM32CubeIDE_1.11.2\STM32CubeIDE\headless-build.bat -no-indexer -data %workspace_folder% -import %PROJECT_DIR% -build %PROJECT_NAME%/%BUILD_TYPE%

exit /b %ERRORLEVEL%

 

 

Or modifying STM32CubeIDE\headless-build.bat to:

 

 

 OFF

set basedir=%~dp0
"%basedir%"stm32cubeidec.exe --launcher.suppressErrors -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -no-indexer %*

 

 


I'd like to hear from the ST team if they are going to fix this bug.

1 reply

unsigned_char_array
unsigned_char_arrayAuthorBest answer
Lead III
April 24, 2024

I've solved it! It's a bug or a missing feature in STM32CubeIDE\headless-build.bat.

The culprit is the indexer which runs after the build (silently, except when running it verbose). The indexer is not needed for a headless build in my opinion. (I found it in an example here: https://stackoverflow.com/a/76571159/15307950)

By adding the parameter -no-indexer to headless-build.bat the problem goes away.

 

 

 

 off
echo incrementally building...
set PROJECT_DIR=%cd%\..

set PROJECT_NAME=MY_PROJECT_NAME
set BUILD_TYPE=Debug

set workspace_folder=%temp%\%PROJECT_NAME%_workspace
mkdir %workspace_folder%

C:\ST\STM32CubeIDE_1.11.2\STM32CubeIDE\headless-build.bat -no-indexer -data %workspace_folder% -import %PROJECT_DIR% -build %PROJECT_NAME%/%BUILD_TYPE%

exit /b %ERRORLEVEL%

 

 

Or modifying STM32CubeIDE\headless-build.bat to:

 

 

 OFF

set basedir=%~dp0
"%basedir%"stm32cubeidec.exe --launcher.suppressErrors -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -no-indexer %*

 

 


I'd like to hear from the ST team if they are going to fix this bug.

"Kudo posts if you have the same problem and kudo replies if the solution works.Click ""Accept as Solution"" if a reply solved your problem. If no solution was posted please answer with your own."