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.

We are seeing the same problem (or error message at least) after upgrading from sonar-scanner-5.0.1.3006-linux to sonar-scanner-7.1.0.4889-linux-x64, e.g.:

23:50:32.164 WARN  File '/actual/path/to/a/valid/symlink' is ignored. It is a symbolic link targeting a file that does not exist.

In this case, the symlink points several levels up (../../../../../../theActualFile) however it is a valid symlink (per ls -L). We are running on RHEL 8.10.

Hi there,

This error should have been resolved with SONAR-24784, which was included in the sqs-2025.3version.
Unfortunately, it has not been fixed in the current LTA.

Best,