Build-wrapper make all command integrate with perl script

We have in house Perl script for building the project. We are trying to integrate the build wrapper command into it but getting errors.
SonarQube version: 8.9 LTS
CFamily plugin version: 6.20.1.32841
Build Wrapper : we are using latest one which downloaded from : http://URL/static/cpp/build-wrapper-linux-x86.zip
Build wrapper command: build-wrapper-linux-x86-64 --out-dir /home/cm/jenkins/workspace/RAISE-SonarQubeTrial/src/build_output make clean all

When i include this build wrapper command in Perl script , I was getting below error. Please let me know how to deal build wrapper command for perl script.

syntax error at /opt/tns/cm/scripts/buildscripts-Sonar/buildScript.pl line 401, near “–out”

Hi @kishore535 ,

Can you share the buildScript.pl file? Or at least share 20 lines above and below line 401 in buildScript.pl file? I’m not a Perl expert so I can only guess. I need to see how you are invoking build-wrapper in your script. Please share the entire error stack trace as well.

Attached the perl scriptProcessing: buildScript.pl…
buildScript.txt (15.2 KB)

Hi @kishore535 ,

:warning: I’m not a Perl programmer, so please find someone else more knowledgeable.

There seems to be an issue with the syntax on line 401 (also there is no semicolon at the end of the line):

build-wrapper-linux-x86-64 --out-dir /home/cm/jenkins/workspace/RAISE-SonarQubeTrial/src/build_output make clean all

The syntax looks incorrect, I think you need to call the executable in a different manner like so:

my $cmd="build-wrapper-linux-x86-64 --out-dir /home/cm/jenkins/workspace/RAISE-SonarQubeTrial/src/build_output make clean all";
system($cmd);

or

my cmd = `build-wrapper-linux-x86-64 --out-dir /home/cm/jenkins/workspace/RAISE-SonarQubeTrial/src/build_output make clean all`;

Here are more suggestions: How can I call a shell command in my Perl script? - Stack Overflow