Sonarqube-developer-7.4: build-wrapper exits unexpecedly with build-wrapper: SQ_WRAPPER_SOCKET is missing

Must-share information (formatted with Markdown):

  • Sonarqube Developer 7.4
  • CFamily Plugin 5.1.1 (build 10386)

We are trying to analyze a C/C++ Project with sonarqube.

The build takes place inside a docker container.
the process looks roughly like this:

  1. run a sonar-provider.sh before build
    1.1 fetch https://sonar-dev.internal.********.com/static/cpp/build-wrapper-linux-x86.zip
    1.2 unpack the file and copy content to /usr/bin
  2. run build
    2.1 execute the build wrapper’ed make command
    2.2 here it fails

see last line of the snippet below:

06-Dec-2018 14:32:12 	+ ls /usr/bin/libinterceptor-i686.so /usr/bin/libinterceptor-x86_64.so
06-Dec-2018 14:32:12 	/usr/bin/libinterceptor-i686.so
06-Dec-2018 14:32:12 	/usr/bin/libinterceptor-x86_64.so
06-Dec-2018 14:32:12 	+ ls /usr/bin/build-wrapper-linux-i686 /usr/bin/build-wrapper-linux-x86_64
06-Dec-2018 14:32:12 	/usr/bin/build-wrapper-linux-i686
06-Dec-2018 14:32:12 	/usr/bin/build-wrapper-linux-x86_64
06-Dec-2018 14:32:12 	+ ldconfig
06-Dec-2018 14:32:12 	++ which build-wrapper-linux-x86_64
06-Dec-2018 14:32:12 	+ test '!' -z /usr/bin/build-wrapper-linux-x86_64
06-Dec-2018 14:32:12 	++ which build-wrapper-linux-x86_64
06-Dec-2018 14:32:12 	+ ldd /usr/bin/build-wrapper-linux-x86_64
06-Dec-2018 14:32:12 	        linux-vdso.so.1 (0x00007ffc7f7c2000)
06-Dec-2018 14:32:12 	        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa619295000)
06-Dec-2018 14:32:12 	        /lib64/ld-linux-x86-64.so.2 (0x00007fa61945e000)
06-Dec-2018 14:32:12 	+++ nproc
06-Dec-2018 14:32:12 	++ expr 8 / 2
06-Dec-2018 14:32:12 	+ LD_PRELOAD=/usr/bin/libinterceptor-x86_64.so
06-Dec-2018 14:32:12 	+ /usr/bin/build-wrapper-linux-x86_64 --out-dir bw_output make -j 4
06-Dec-2018 14:32:12 	build-wrapper: SQ_WRAPPER_SOCKET is missing

There is no content on google or the official documentation which I could find. How should I proceed?

Hello @gve,

Could you please send us the build-wrapper.log file that is in your bw_output folder?

Thank you!

Hello,

I tried hard to find this Logfile, but I can confirm: It is not generated at all.

root@4c9c8230dc2f:/code/build_prod# ls
CMakeCache.txt	CMakeFiles  Makefile  cmake_install.cmake  wta
root@4c9c8230dc2f:/code/build_prod# LD_PRELOAD=/usr/bin/libinterceptor-x86_64.so /usr/bin/build-wrapper-linux-x86-64 --out-dir bw_output make -j $(expr $(nproc) / 2)    
build-wrapper: SQ_WRAPPER_SOCKET is missing
root@4c9c8230dc2f:/code/build_prod# find . -name "bw_output"
root@4c9c8230dc2f:/code/build_prod# ls -a
.  ..  CMakeCache.txt  CMakeFiles  Makefile  cmake_install.cmake  wta
root@4c9c8230dc2f:/code/build_prod# cd /
root@4c9c8230dc2f:/# find . -name "bw_output"
root@4c9c8230dc2f:/# find . -name "build-wrapper.log"
root@4c9c8230dc2f:/# 

Since build-wrapper is run inside docker, could this be related to a missing capability?

Hello @gve

We noticed that the way you launch the build wrapper is very strange, and is the source of the issue: Before launching it, you change the LD_PRELOAD environment variable to pre-load our libinterceptor libraries. You should not do that!

If you remove this strange LD_PRELOAD=/usr/bin/libinterceptor-x86_64.so from your command line, it should work better.

Best regards,

Helo again!

LD_PRELOAD is used to selectivly force ld.so to load a shared object like libinterceptor.so. So using LD_PRELOAD in the case of ld.so throwing an error is very common path for troubleshooting, which I went down since I got this huge amount of (misleading?) errors:

Trying your suggestion leads to:

/usr/bin/build-wrapper-linux-x86-64 --out-dir bw_output make -j 4
ERROR: ld.so: object '/usr/bin/libinterceptor-${PLATFORM}.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/bin/libinterceptor-${PLATFORM}.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/bin/libinterceptor-${PLATFORM}.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/bin/libinterceptor-${PLATFORM}.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/bin/libinterceptor-${PLATFORM}.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/bin/libinterceptor-${PLATFORM}.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/bin/libinterceptor-${PLATFORM}.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/bin/libinterceptor-${PLATFORM}.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.

<many screens full of more of this lines>

However, the dir bw_output is created and contains files now:

build-wrapper-dump.json:

# (C) SonarSource SA, 2014-2017, info@sonarsource.com
# All SONARSOURCE programs and content are copyright protected.
# SONARSOURCE and SONARQUBE are trademarks of SonarSource SA. All rights are expressly reserved.
#
# This file is designed exclusively for use with the SONARSOURCE C / C++ / Objective-C Plugin.
# It may not be used in connection with any other software.
# Any other use is prohibited by law and may be grounds for immediate termination of your License.
{
"version":0,
"captures":[
]}

build-wrapper.log:

Tue Dec 11 10:29:57 2018: System name: Linux Nodename: 7f5179434c71 Release: 4.13.0-46-generic Version: #51-Ubuntu SMP Tue Jun 12 12:36:29 UTC 2018 Machine: x86_64
Tue Dec 11 10:29:57 2018: socket path: /tmp/build-wrapper-socket.CSTBsG
Tue Dec 11 10:29:57 2018: dynamic library found: /usr/bin/libinterceptor-i686.so
Tue Dec 11 10:29:57 2018: dynamic library found: /usr/bin/libinterceptor-x86_64.so
Tue Dec 11 10:29:57 2018: command executed as: <build-wrapper-linux-x86-64>
Tue Dec 11 10:29:57 2018: command line received: <make -j 4>
Tue Dec 11 10:29:57 2018: env 0: <HOSTNAME=7f5179434c71>
Tue Dec 11 10:29:57 2018: env 1: <OLDPWD=/root>
Tue Dec 11 10:29:57 2018: env 2: <PWD=/code/build_prod>
Tue Dec 11 10:29:57 2018: env 3: <OS_DEP=  build-essential   curl   ca-certificates   unzip   libboost-graph1.62-dev   libboost-program-options1.62-dev   libgmock-dev   libgmp-dev   libegl1-mesa-dev   libglu1-mesa-dev   libglew-dev   libtbb-dev   m4   cmake   git   strace >
Tue Dec 11 10:29:57 2018: env 4: <HOME=/root>
Tue Dec 11 10:29:57 2018: env 5: <TERM=xterm>
Tue Dec 11 10:29:57 2018: env 6: <PLATFORM=x86_64>
Tue Dec 11 10:29:57 2018: env 7: <SHLVL=1>
Tue Dec 11 10:29:57 2018: env 8: <PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin>
Tue Dec 11 10:29:57 2018: env 9: <_=/usr/bin/build-wrapper-linux-x86-64>
Tue Dec 11 10:29:57 2018: executing: <make -j 4>
Tue Dec 11 10:29:57 2018: initializing json file
Tue Dec 11 10:29:57 2018: finalizing json file
Tue Dec 11 10:29:57 2018: returned with code: 0

The same happens, when build-wrapper/libinterceptor-* are situated in the build root directory.

So it seems there is an empty result or build-wrapper not working the way I run it. I propose the latter… :slight_smile:

Hello again @gve,

You might be affected by the same issue that was reported in this thread: SonarQube - C++ - Ubuntu - build-wrapper LD_PRELOAD Error - #7 by choosyg

To check if this is the case, you can run the command:

strace -f -E LD_DEBUG=all ./build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output /bin/echo test >stdout.txt 2>stderr.txt

And search if the resulting output contains libinterceptor-haswell.so. If so, you are in the same situation, and you can work around it by using the same way that was proposed there:

If not, we don’t yet know what happens, and we might be interested in getting the files generated by this strace command to look at them more deeply.

Hope this helps…

1 Like

Hey,

Thanks for the tip about ubuntu! :slight_smile:
Copying to libinterceptor-haswell.so did the trick!

tyvm!