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:
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
run build
2.1 execute the build wrapper’ed make command
2.2 here it fails
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.
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…
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.