Install Sonar client with embedded JRE on alpine

Hello.
I am using alpine
When i install Sonar client Linux version during execution i am faced with:
/sonar-scanner-4.7.0.2747-linux/jre/bin/java: not found

I know it is possible to set sonar to use external JRE but i do not want to.
I do want to use the JRE that is coming with sonar itself, how can i make it work on alpine systems?

tnx

Alright, seems installing gcompat made it possible to use sonar-linux on alpine, something you should consider adding to documentation imho

1 Like

Hello @Denys_Andriyanov ,

Thank you for the feedback on the problem you encountered.

Could you please give us more information about your use case for running the sonar-scanner on Alpine Linux?
Is it the main OS of the machine you are working on or are you trying to run the sonar-scanner in a docker container? Did you consider using sonar-scanner-cli-docker ?

Thanks

Hi, I need to run the sonar client in the alpine image. I am running sonar client in gitlab ci
The Docker client solution is not fit for my case, but the workaround i mentioned works fine.
Just try it yourself, get sonar client and try to run it in an alpine image

Hi, I encountered the same problem and your suggestion does indeed help to make the embedded java work.
Unfortunately this error appears now:

RUN sonar-scanner -h:
#22 0.392 Error occurred during initialization of VM
#22 0.392 Unable to load native library: Error loading shared library libjvm.so: No such file or directory (needed by /sonar-scanner/jre/lib/libjava.so)

Did you have anything similar? Using the latest alpine image as well.

If anyone needs, this was fixed by adding symlinks such as:

ln -s /sonar-scanner/bin/sonar-scanner /bin/sonar-scanner
ln -s /sonar-scanner/jre/lib/server/libjvm.so /sonar-scanner/jre/lib
1 Like