Build fails when run with build-wrapper-linux-x86-64 v8.9

Hi,
We are facing build failures when executed build with build-wrapper-linux-x86-64 it fails with below,

terminate called after throwing an instance of 'std::out_of_range'
what():  vector::_M_range_check: __n (which is 7) >= this->size() (which is 7)
build-wrapper: read signature: Connection reset by peer
/var/jenkins/workspace/Sonar/Run_Sonar_DownStream@tmp/durable-ba75c405/script.sh: line 1:    46 Aborted                 (core dumped) build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir sq_build_output ./sonar_build.sh

where as without using the build-wrapper-linux-x86-64 build pass successfully.
Any idea on what is causing these failures ?

Environment:
build-wrapper-linux-x86-64, version 8.9
Build is running in Docker container of CentsOS 7.9.2009

Version of build-wrapper is v6.20

build-wrapper: read signature: Connection reset by peer
Aborted (core dumped)
[root@c0ecdde3a1c8 workspace]#
[root@c0ecdde3a1c8 workspace]# build-wrapper: connect to /tmp/build-wrapper-socket.ErVCC0: Connection refused
build-wrapper: connect to /tmp/build-wrapper-socket.ErVCC0: Connection refused
build-wrapper: connect to /tmp/build-wrapper-socket.ErVCC0: Connection refused
build-wrapper: connect to /tmp/build-wrapper-socket.ErVCC0: Connection refused

This part of the full exception

Hi @rgaduputi,

Can you share the build-wrapper .log file and the entire output of the script with and without build-wrapper? I can send you a private message to share them privately if they contain sensitive information.

Thanks,

Hi @Abbas_Sabra,
Sure. Please send me a private message, I will share the files.

Hi @rgaduputi,

Thanks for the log. It is the first time I see such an issue.

I see that it is failing on the zip stage. Can you try to wrap only the build command only (in your case the make commands) instead of the entire process?
Also, have you tried to run it on another OS?

Thanks,

Hi @Abbas_Sabra ,
The stage is the rpm creation one and not zip.
Also I am wrapping the make commands only (with in make we have the rpm creation logic).
No I have not tried running on different OS, I will try it out.

Thanks.

Hello @rgaduputi,

Can you also try to narrow the scope of what you are wrapping to exclude the rpm creation logic? It might be that the rpm creation logic is doing chroot which makes the sockets inaccessible for build-wrapper.

Thanks,

Hi @Abbas_Sabra ,
Yes, once rpm creation logic is excluded, build is succeeded. Now build only contains compilation.
But now we get build-wrapper-dump.json as empty because of that the sonar scanner fails.

Thanks.

Hi @Abbas_Sabra ,
Any suggestion on how to fix the empty dump json file?

Hi @rgaduputi,

Can you share the new logs(build-wrapper log, JSON, build command) privately after excluding the rpm logic?
Are you running build-wrapper in “sudo” mode?
What is your compiler?

Thanks,

Hi @Abbas_Sabra ,
I have shared the files in private message.

Build command is build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir sq_build_output ./sonar_build.sh
Content of sonr_build.sh is really simple, create some files required for build and run make all which is our target to build all but not rpm generation.

Please note I have tried to avoid usage of sonar_build.sh by directly running make all with build-wrapper command, but it was still same.

No I am not running with sudo mode, Build is running with user root.

Compiler: gcc 9.3.1 "g++ (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2)"

Thanks,

Hi @rgaduputi,
Thanks for the logs.
I noticed that your build process is using scl that cannot be tracked by build-wrapper.
You are suffering from the same problem as Sonar analysis fails with cmake ninja build - #9 by Abbas_Sabra. Two workarounds:

  • Move the build-wrapper to a lower level. As I suggested in the other post.
  • If you can generate a compilation database, update to the latest SQ, and use it instead of build-wrapper.

We created a ticket about this feel free to follow it.
Thanks,

Hi @Abbas_Sabra ,
I am exploring the option of executing scan with compilation database, Our build is generating more than 1 files compilation json, and when I provide all the json files with comma separation in properties file with property sonar.cfamily.compile-commands Sonar is treating everything as one file and fails. Any idea why ?

Caused by: java.nio.file.NoSuchFileException: /var/jenkins/workspace/NS/W_NS_Sonar/NS-Sonar/ASP/Libraries-build/Libraries64sc_dts.Meson/compile_commands.json,Libraries-build/Libraries64sc_dts.asan.Meson/compile_commands.json,Libraries-build/Libraries64sc_dts.ssl.Meson/compile_commands.json

Hello @rgaduputi,

sonar.cfamily.compile-commands doesn’t support multiple compilation databases.
If you need to, it is fairly easy to combine them into one JSON file and point to the result.
We don’t do that automatically because:

  • It is easier for the users to do it based on their project structure. they can choose what to do with the intersection of the two JSON.
  • In many cases, it is not the right thing to do. multiple compilation database means different independent builds and then the natural question is why aren’t you analyzing them as a separate projects?

Thanks,

Thanks @Abbas_Sabra , I see that merged json works just fine.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.