Build wrapper output error: message 401 Unauthorized command not found

  • which versions are you using (build-wrapper-linux-x86-64 with and without SonarQube docker sonarsource/sonar-scanner-cli)
  • what are you trying to achieve - get build-wrapper-linux-x86-64 to work
  • what have you tried so far to achieve this:
    In docker images: sonarsource/sonar-scanner-cli and uppoints/docker-java-gcc I extract build-wrapper-linux-x86.zip and place all the files into a directory. I chmod +x build-wrapper-linux-x86-64

When I run build-wrapper-linux-x86-64 the following error output displays:
build-wrapper-linux-x86/build-wrapper-linux-x86-64: line 1: {message:401 Unauthorized}: command not found

What is Unauthorized? What is ‘not found’? There is no log file or any output. The build-wrapper-linux-x86-64 just fails with the above output. Help is appreciated.

Hi,

Welcome to the community!

Can you provide the job log at least from the build command?

Are any files output by the build-wrapper? I.e. the build-wrapper.log or the build-wrapper-dump.json?

 
Ann

Thank you for responding. There are no .log or .json files output. The ‘build-wrapper-linux-x86-64’ seems to just terminate with that cryptic message. I wish there was documentation on the build-wrapper-linux-x86-64 program itself? I only know of the --out-dir arg.

Hi,

Could you provide the job/console log, please?

 
Ann

I see no log files at all. Where would these job/console log be? I am calling build-wrapper-linux-x86-64 from a GitLab CI Pipeline script. I can send the output from that. Still hoping you can help me. Thanks.
buildwrapperfail.txt (3.1 KB)

Hi,

That’s what I was looking for.

The thing is, that a 401 is presumably a web server error. I wouldn’t expect the build-wrapper to be making any web calls. That’s why I wanted to see the build-wrapper command.

The ‘line 1’ in this error is a bit suspicious:

/builds/foofoo/foosea/build-wrapper-linux-x86/build-wrapper-linux-x86-64: line 1: {message:401 Unauthorized}: command not found

Since the build-wrapper is a compiled executable, I wouldn’t expect a line number to be reported. Are you sure there’s not a script in there that got named ‘build-wrapper’ that in turn calls the compiled build-wrapper downloaded from your server?

 
Ann

I am sure there is no script calling the executable, the executable is called directly: /builds/foofoo/foosea/build-wrapper-linux-x86/build-wrapper-linux-x86-64

And the files in that directory listed in the gitlab ci:
-rwxr-xr-x 1 100 101 30 Dec 1 18:46 build-wrapper-linux-x86-64
-rw-r–r-- 1 100 101 30 Dec 1 18:46 libinterceptor-haswell.so
-rw-r–r-- 1 100 101 30 Dec 1 18:46 libinterceptor-i686.so
-rw-r–r-- 1 100 101 30 Dec 1 18:46 libinterceptor-x86_64.so

But I understand what you are saying and I agree. I may try outside of a ci pipeline and see what happens. thanks for trying to help.

Hi,

Okay, one of the reasons I asked about a script is that the build-wrapper isn’t intended to be involved stand-alone.

It’s supposed to wrap your build command. So, e.g. (from the docs):

build-wrapper-linux-x86-64 --out-dir build_wrapper_output_directory make clean all

Notice that make clean all at the end. You’re supposed to simply stick the build-wrapper in front of your normal make/compile command.

 
Ann

The full command I wanted to get to work is

build-wrapper-linux-x86-64 --out-dir ${CI_PROJECT_DIR}/build_wrapper_output_directory g++ -o foo1.o -c foo1.cpp

currently not using ‘make’ but I could. the same error occurs with the above command. I kept stripping it down and got the same error and ended up with just the command.
the g++ by itself works fine.
Please keep thinking of what it could be thanks.

Hi,

To be clear, the command you just posted gets exactly the same error?

 
Ann

yes :crying_cat_face:

Hi,

Thanks for confirming. I’m going to flag this for more expert attention.

 
Ann

Hello @bahctr,

Unfortunately, the SonarScanner CLI Docker image does not support analysis of C++ projects.
(See the explanation in SonarQube documentation > Important Notes).

If you are willing to modify your configuration to use the “regular” SonarScanner and have still trouble with the build-wrapper, I will be happy to help.

In addition, here are some examples of C++ project analysis: SonarSource sample C and C++ projects that may help you.

Amélie

Hello, What do you mean by modify my configuration to use the “regular” SonarScanner? Do you mean running the sonarscanner command from a Linux terminal?

Is there anyway to call the “regular” SonarScanner from a GitLab CI pipeline script?

Hello @bahctr,

The SonarScanner Docker image is meant to be used in a Docker image. But we don’t support the analysis of C or C++ projects in Docker images.
So by “modify your configuration”, I meant not doing the build wrapper with the build nor the analysis in a Docker image.

The “regular” SonarScanner is for everything else: a Linux terminal, a Gitlab CI pipeline script etc…
You can find examples of analysis in GitLab in this repository: SonarSource sample C and C++ projects with SonarCloud or SonarQube analysis configured.

HTH,
Amélie

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