Headless build does not report errors

Discuss how to use the features of Atollic TrueSTUDIO, including the editor, assembler, C/C++ compiler, linker, debugger, static code analysis and team collaboration tools.

Moderators: Markus Girdland, Mattias Norlander

ocisg
Posts: 2
Joined: Tue Jan 15, 2019 8:25 am

Headless build does not report errors

Postby ocisg » Tue Jan 15, 2019 12:08 pm

Hello,

I set up a headless build for a TrueStudio project in our continuous integration system, it works fine for passing building, but failing builds are not caught. Our CI system relies on the exit code ( != 0) to detect failures, this works fine with all other build systems we use (CMake, Make, Ninja, Gradle...). But it seems the TrueStudio headless build doesn't set the exit code propertly.

For instance, in case of a linker failure:

Code: Select all

collect2.exe: error: ld returned 1 exit status
Info: Parallel threads used: 8

12:12:47 Build Finished (took 36s.569ms)

Invoking scanner config builder on project

C:\>echo %errorlevel%
0



Clearly the build failed, but the exit code is 0, and it also looks like something is still happening after the failure ("Invoking scanner config builder on project").

At first, I thought the problem was is in the "headless.bat" script that is mentioned in the documentation, e.g. that it is not propagating the exit code correctly. But even calling the executable directly doesn't help:

Code: Select all

"TrueSTUDIOc.exe" --launcher.suppressErrors -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -data C:\...\workspace -build all


The exit code is still 0 in case of failures.

The main reason to use headless builds is CI, so I don't understand why this is not working out of the box. Any hint?

Thanks,
Olivier

ocisg
Posts: 2
Joined: Tue Jan 15, 2019 8:25 am

Any Jenkins / Hudson / CI user out there?

Postby ocisg » Mon Jan 28, 2019 6:09 am

Hello,

is there any Jenkins, Hudson or CI user out there who could give me some feedback?
As a workaround, I am now checking after building if the expected ELF files exist, but this requires more code, and pretty fragile.

Thanks,
Olivier

davidcozens
Posts: 1
Joined: Tue May 07, 2019 7:10 am

Re: Headless build does not report errors

Postby davidcozens » Tue May 07, 2019 7:29 am

I'm seeing the same issue. compilation errors are correctly propagated, however errors from ld are not propagated.
With an ld error I see the following at the end of the build

Code: Select all

: undefined reference to `CalibrationMemory'
collect2.exe: error: ld returned 1 exit status

08:00:16 Build Finished (took 43s.374ms)

the return from TrueStudio is 0 so the error is not detected.

Using the same project, if I force a compilation error then the output is

Code: Select all

 error: expected '=', ',', ';', 'asm' or '__attribute__' before 'enum'
 enum
 ^~~~

08:07:10 Build Finished (took 32s.246ms)

Atollic TrueSTUDIO for STM32:
Java was started but returned exit code=1
-Xms40m
-Xmx1024m
-Dorg.eclipse.swt.internal.carbon.smallFonts
-Dosgi.instance.area.default=@user.home/Atollic/TrueSTUDIO/STM32_workspace_9.3
-Djava.class.path=C:\Program Files (x86)\Atollic\TrueSTUDIO for STM32 9.3.0\ide\\plugins/org.eclipse.equinox.launcher_1.3.200.v20160318-1642.jar
-os win32
-ws win32
-arch x86
-launcher C:\Program Files (x86)\Atollic\TrueSTUDIO for STM32 9.3.0\ide\TrueSTUDIOc.exe
-name Atollic TrueSTUDIO for STM32
--launcher.library C:\Program Files (x86)\Atollic\TrueSTUDIO for STM32 9.3.0\ide\\plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.400.v20160518-1444\eclipse_1617.dll
-startup C:\Program Files (x86)\Atollic\TrueSTUDIO for STM32 9.3.0\ide\\plugins/org.eclipse.equinox.launcher_1.3.200.v20160318-1642.jar
--launcher.overrideVmargs
-application org.eclipse.cdt.managedbuilder.core.headlessbuild
-data Workspace
-import Products\JellyfishSlave\JellyFishSlaveLithium
-build JellyfishSlaveLithium
-vm C:\Program Files (x86)\Atollic\TrueSTUDIO for STM32 9.3.0\ide\jre\bin\client\jvm.dll
-vmargs
-Xms40m
-Xmx1024m
-Dorg.eclipse.swt.internal.carbon.smallFonts
-Dosgi.instance.area.default=@user.home/Atollic/TrueSTUDIO/STM32_workspace_9.3
-Djava.class.path=C:\Program Files (x86)\Atollic\TrueSTUDIO for STM32 9.3.0\ide\\plugins/org.eclipse.equinox.launcher_1.3.200.v20160318-1642.jar

The error code is propagated and the build is correctly failed.

As a work around in jenkins the Text Finder plugin can be used. https://wiki.jenkins.io/display/JENKINS/Text-finder+Plugin. However I see this causing issue both on jenkins and on scripted builds done on developer machines.

This is fundamental behaviour, is there any plan to fix this?


Return to “Atollic TrueSTUDIO tool discussions”

Who is online

Users browsing this forum: No registered users and 6 guests