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
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 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?
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.
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.
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.
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?
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)"
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 ?
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?