Analysis of your C/C++/Objective-C project is by using the SonarSource build-wrapper

Can you please help me to Analysis of objective c project by using the sonarsource build-wrapper

Hi @Sachin-5121 and welcome to the community.

You have a detailed guide on how to setup this kind of analysis for Azure DevOps (Unfold the Analyzing a C/C++/Obj-C project), most of the steps are also configurable as standalone if needed.

HTH,
Mickaël

Hi,
where to execute following command and what is exact mean of output directory in above command

build-wrapper-macosx-x86/build-wrapper-macos-x86 --out-dir xcodebuild -project myproject.xcodeproj -configuration Release clean build

can you please give your contact detail to solving the issue ASAP.

thanks.

The output directory will be used by the further analysis to gather all data written by the wrapper.

These commands can be execute close to everywhere in the machine where you run the analysis, they obviously need to reference relevant folder for the analysis with the right paths.

Mickaël

Hi,
My current project present on following path
/Users/sacdumal/Downloads/LA_AL_Old_FLow_AL_10SEC_ISG_OTPTimer_OfferFlow

and my build wrapper present at following path
/Users/sacdumal/Downloads/build-wrapper-macosx-x86

so how can I execute above command

build-wrapper-macosx-x86/build-wrapper-macos-x86 --out-dir xcodebuild -project myproject.xcodeproj -configuration Release clean build

can you please tell me full command that I execute on terminal

Thanks.

Can you please help me to solve above issue?

Hi @Sachin-5121

Point your PS or commandline tool to the directory /Users/sacdumal/Downloads/LA_AL_Old_FLow_AL_10SEC_ISG_OTPTimer_OfferFlow

And then execute the command that you mentionned, it should work (by changing the name of the xcodeproj to match your indeed).

Does that help ?

I execute the command but it show following error

WKMIN1804460:LA_AL_Old_FLow_AL_10SEC_ISG_OTPTimer_OfferFlow sacdumal$ build-wrapper-macosx-x86/build-wrapper-macos-x86 --out-dir xcodebuild -project HDFCLoanApp.xcodeproj -configuration Release clean build

-bash: build-wrapper-macosx-x86/build-wrapper-macos-x86: No such file or directory

try with

../build-wrapper-macosx-x86/build-wrapper-macos-x86 --out-dir xcodebuild -project HDFCLoanApp.xcodeproj -configuration Release clean build

instead.

Hi,
the command show above the error WKMIN1804460:LA_AL_Old_FLow_AL_10SEC_ISG_OTPTimer_OfferFlow sacdumal$ …/build-wrapper-macosx-x86/build-wrapper-macos-x86 --out-dir bw_output xcodebuild -project HDFCLoanApp.xcodeproj -configuration Release clean build

-bash: …/build-wrapper-macosx-x86/build-wrapper-macos-x86: No such file or directory

can you please tell me what name give for output directory and what location?

can we do one Microsoft team call to sort the issue.

Please check the relative path of the build wrapper from where your are currently in your bash shell, i think the error is self explaining (or check inside the build wrapper that you have actually a file called build wrapper also).

in my build-wrapper-macos-x86 contain build-wrapper-macosx-x86 and libinterceptor.dylib file

can we do one Microsoft team call to sort the issue.

So make sure that this is accessible from where you are executing the script, and check the path also.

can we do one Microsoft team call? to fix the issue as soon as possible.

where to execute this command

build-wrapper-macosx-x86 --out-dir build_wrapper_output_directory xcodebuild clean build

and what is build_wrapper_output_directory in above command

INFO: Scanner configuration file: /usr/local/Cellar/sonar-scanner/4.5.0.2216/libexec/conf/sonar-scanner.properties

INFO: Project root configuration file: /Users/sacdumal/Downloads/LA_AL_Old_FLow_AL_10SEC_ISG_OTPTimer_OfferFlow/sonar-project.properties

INFO: SonarScanner 4.5.0.2216

INFO: Java 11.0.9 Oracle Corporation (64-bit)

INFO: Mac OS X 10.14.6 x86_64

INFO: User cache: /Users/sacdumal/.sonar/cache

INFO: Scanner configuration file: /usr/local/Cellar/sonar-scanner/4.5.0.2216/libexec/conf/sonar-scanner.properties

INFO: Project root configuration file: /Users/sacdumal/Downloads/LA_AL_Old_FLow_AL_10SEC_ISG_OTPTimer_OfferFlow/sonar-project.properties

INFO: Analyzing on SonarQube server 8.5.1

INFO: Default locale: “en_IN”, source code encoding: “UTF-8”

INFO: Load global settings

INFO: Load global settings (done) | time=46ms

INFO: Server id: BF41A1F2-AXYFLyO7zpDhchFp_uQh

INFO: User cache: /Users/sacdumal/.sonar/cache

INFO: Load/download plugins

INFO: Load plugins index

INFO: Load plugins index (done) | time=33ms

INFO: Load/download plugins (done) | time=152ms

INFO: Loaded core extensions: developer-scanner

INFO: JavaScript/TypeScript frontend is enabled

INFO: Process project properties

INFO: Process project properties (done) | time=7ms

INFO: Execute project builders

INFO: Execute project builders (done) | time=1ms

INFO: Project key: LoanAssist

INFO: Base dir: /Users/sacdumal/Downloads/LA_AL_Old_FLow_AL_10SEC_ISG_OTPTimer_OfferFlow

INFO: Working dir: /Users/sacdumal/Downloads/LA_AL_Old_FLow_AL_10SEC_ISG_OTPTimer_OfferFlow/.scannerwork

INFO: Load project settings for component key: ‘LoanAssist’

INFO: Load project settings for component key: ‘LoanAssist’ (done) | time=11ms

INFO: Load project branches

INFO: Load project branches (done) | time=13ms

INFO: Load project pull requests

INFO: Load project pull requests (done) | time=8ms

INFO: Load branch configuration

INFO: Load branch configuration (done) | time=1ms

INFO: Load quality profiles

INFO: Load quality profiles (done) | time=43ms

INFO: Load active rules

INFO: Load active rules (done) | time=1174ms

WARN: SCM provider autodetection failed. Please use “sonar.scm.provider” to define SCM of your project, or disable the SCM Sensor in the project settings.

INFO: Indexing files…

INFO: Project configuration:

INFO: 2235 files indexed

INFO: Quality profile for objc: Sonar way

INFO: ------------- Run sensors on module LoanAssist

INFO: JavaScript/TypeScript frontend is enabled

INFO: Load metrics repository

INFO: Load metrics repository (done) | time=13ms

WARNING: An illegal reflective access operation has occurred

WARNING: Illegal reflective access by net.sf.cglib.core.ReflectUtils$1 (file:/Users/sacdumal/.sonar/cache/a89f1943fc75b65becd9fb4ecab8d913/sonar-tsql-plugin.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte,int,int,java.security.ProtectionDomain)

WARNING: Please consider reporting this to the maintainers of net.sf.cglib.core.ReflectUtils$1

WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations

WARNING: All illegal access operations will be denied in a future release

INFO: Sensor CSS Rules [cssfamily]

INFO: No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.

INFO: Sensor CSS Rules [cssfamily] (done) | time=3ms

INFO: Sensor C# Properties [csharp]

INFO: Sensor C# Properties [csharp] (done) | time=1ms

INFO: Sensor JavaXmlSensor [java]

INFO: Sensor JavaXmlSensor [java] (done) | time=14ms

INFO: Sensor HTML [web]

INFO: Sensor HTML [web] (done) | time=7ms

INFO: Sensor VB.NET Properties [vbnet]

INFO: Sensor VB.NET Properties [vbnet] (done) | time=1ms

INFO: Sensor JaCoCo XML Report Importer [jacoco]

INFO: ‘sonar.coverage.jacoco.xmlReportPaths’ is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml

INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer

INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=7ms

INFO: Sensor ThymeLeaf template sensor [securityjavafrontend]

INFO: Sensor ThymeLeaf template sensor [securityjavafrontend] (done) | time=9ms

INFO: Sensor CFamily [cpp]

INFO: CFamily plugin version: 6.13.0.22261

INFO: Using build-wrapper output: /Users/sacdumal/Downloads/LA_AL_Old_FLow_AL_10SEC_ISG_OTPTimer_OfferFlow/bw_output/build-wrapper-dump.json

INFO: Available processors: 4

WARN:

CFamily plugin supports multithreaded analysis:

  • to enable multithreaded analysis

please specify the number of threads to use

by setting the following property to your analysis:

sonar.cfamily.threads=number_of_threads

  • if you do not want to enable multithreading

please explicitly disable it

by setting the following property to your analysis:

sonar.cfamily.threads=1

  • visit the documentation page for more information

http://localhost:9000/documentation/analysis/languages/cfamily/

INFO: Using 1 thread for analysis according to value of “sonar.cfamily.threads” property.

INFO: Load project repositories

INFO: Load project repositories (done) | time=9ms

WARN:

CFamily plugin supports incremental analysis with the use of a cache:

  • if you do not want to enable cache

please explicitly disable it

by setting the following property to your analysis:

sonar.cfamily.cache.enabled=false

  • to enable cache please specify the following 2 options:

sonar.cfamily.cache.enabled=true

sonar.cfamily.cache.path=relative_or_absolute_path_to_cache_location

  • visit the documentation page for more information

http://localhost:9000/documentation/analysis/languages/cfamily/

INFO: ------------------------------------------------------------------------

INFO: EXECUTION FAILURE

INFO: ------------------------------------------------------------------------

INFO: Total time: 9.181s

INFO: Final Memory: 22M/77M

INFO: ------------------------------------------------------------------------

ERROR: Error during SonarScanner execution

java.lang.IllegalStateException: java.nio.file.NoSuchFileException: /Users/sacdumal/Downloads/LA_AL_Old_FLow_AL_10SEC_ISG_OTPTimer_OfferFlow/bw_output/build-wrapper-dump.json

at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:523)

at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:339)

at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)

at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)

at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:62)

at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)

at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)

at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)

at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:393)

at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:389)

at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:358)

at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)

at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)

at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:144)

at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)

at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)

at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)

at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)

at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:566)

at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)

at com.sun.proxy.$Proxy0.execute(Unknown Source)

at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)

at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)

at org.sonarsource.scanner.cli.Main.execute(Main.java:112)

at org.sonarsource.scanner.cli.Main.execute(Main.java:75)

at org.sonarsource.scanner.cli.Main.main(Main.java:61)

Caused by: java.nio.file.NoSuchFileException: /Users/sacdumal/Downloads/LA_AL_Old_FLow_AL_10SEC_ISG_OTPTimer_OfferFlow/bw_output/build-wrapper-dump.json

at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)

at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)

at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)

at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219)

at java.base/java.nio.file.Files.newByteChannel(Files.java:370)

at java.base/java.nio.file.Files.newByteChannel(Files.java:421)

at java.base/java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:420)

at java.base/java.nio.file.Files.newInputStream(Files.java:155)

at java.base/java.nio.file.Files.newBufferedReader(Files.java:2838)

at java.base/java.nio.file.Files.newBufferedReader(Files.java:2870)

at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:470)

… 29 more

ERROR:

ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

Do you see this folder created in your main folder once the build wrapper has been executed ?

Folder is not created