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 3.3.0.1492-linux
  • 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-3.3.0.1492-linux/bin/sonar-scanner: exec: line 59: /go/sonar-scanner-3.3.0.1492-linux/jre/bin/java: 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-3.3.0.1492-linux/jre/bin/java
/bin/sh: eval: line 82: /go/sonar-scanner-3.3.0.1492-linux/jre/bin/java: not found

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

$ ls -al /go/sonar-scanner-3.3.0.1492-linux/jre/bin/
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!

Cheers,
Karsten

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-3.3.0.1492-linux/jre/bin/java
	/lib64/ld-linux-x86-64.so.2 (0x7f34dded1000)
	libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7f34dded1000)
	libjli.so => /go/sonar-scanner-3.3.0.1492-linux/jre/bin/../lib/amd64/jli/libjli.so (0x7f34ddcbb000)
	libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7f34dded1000)
	libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f34dded1000)
Error relocating /go/sonar-scanner-3.3.0.1492-linux/jre/bin/../lib/amd64/jli/libjli.so: __rawmemchr: symbol not found
Error relocating /go/sonar-scanner-3.3.0.1492-linux/jre/bin/../lib/amd64/jli/libjli.so: __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.