SonarScanner C++ Symbolic Links warning

System Information:

  • SonarQube Server Enterprise 2025.1 LTA (sonarqube-2025.1.2.108896)
  • Deployment by zip
  • SonarScanner 5.0.1.3006
  • Oracle Corporation (64-bit)
  • Linux 5.4.0-186-generic amd64
  • build-wrapper, version 6.62.2 (linux-x86_64)
  • CPP cfamily plugin used

There is an issue with symbolic links from a “src” folder of an external source code library to the “source” folder that we typically use in our sonar.sources property. For example, we see this warning in sonar scanner output on Jenkins job.

WARN: File ‘/VS/ICCP/V/mmslite/psi/mmslite/asn1/source/are_int.c’ is ignored. It is a symbolic link targeting a file that does not exist.

When we analyze the symbolic link on cmd line, then we see the target of the symlink is existing and accessible:

build-ubuntu:/VS -> ls -l /VS/ICCP/V/mmslite/psi/mmslite/asn1/source/are_int.c
lrwxrwxrwx 1 hudson psi 33 Jun  6 19:54 /VS/ICCP/V/mmslite/psi/mmslite/asn1/source/are_int.c -> ../../../../mmslite/src/are_int.c
build-ubuntu:/VS -> ls -l /VS/ICCP/V/mmslite/mmslite/src/are_int.c
-rw-rw-r-- 1 hudson psi 13484 Jun  6 19:54 /VS/ICCP/V/mmslite/mmslite/src/are_int.c

We guess the warning/problem for the scanner comes from the relative symbolic link “../../../../mmslite/src/are_int.c”; probably the scanner tries to look for target from root directory ($WORKSPACE in Jenkins) instead of using a “realpath” for the symbolic link which would give the real path name of the symlink target.

Could you please analyze it? It would really help us if this would work properly.
Thank you.