Sonar scanner error: exec: line 59: .../jre/bin/java: not found

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    I am using sonar scanner version
  • what are you trying to achieve
    Get sonar scanner to run on my gitlab runner for a go-project.

Whenever the runner is starting the sonar-scanner I get the following error:

$ sonar-scanner
/go/sonar-scanner- exec: line 59: /go/sonar-scanner- not found

I have a x86_64-architecture so I am a bit clueless why this happens…

$ uname -a
Linux runner-0ec3bc09-project-17-concurrent-1 4.15.0-52-generic #56-Ubuntu SMP Tue Jun 4 22:49:08 UTC 2019 x86_64 Linux

Also when I try to run the java-bin alone it says that it cannot be found.

$ /go/sonar-scanner-
/bin/sh: eval: line 82: /go/sonar-scanner- not found

I also checked if the java-bin is executable for all and it is…

$ ls -al /go/sonar-scanner-
total 16
drwxr-xr-x    2 root     root          4096 Jan  8 12:19 .
drwxr-xr-x    4 root     root          4096 Jan  8 12:19 ..
-rwxr-xr-x    1 root     root          7734 Dec 13  2016 java

Can somebody help me?
Thanks in advance!


Okay. I think I found the solution to the problem:
The problem was that some symbols in the libraries that the provided oracle java uses cannot be found when using Alpine-Linux:

$ ldd  /go/sonar-scanner-
	/lib64/ (0x7f34dded1000) => /lib64/ (0x7f34dded1000) => /go/sonar-scanner- (0x7f34ddcbb000) => /lib64/ (0x7f34dded1000) => /lib64/ (0x7f34dded1000)
Error relocating /go/sonar-scanner- __rawmemchr: symbol not found
Error relocating /go/sonar-scanner- __strdup: symbol not found

This issue can be found here in more detail.

For now, I am going to use Centos 7 for my runner. That works for me.