# com.sonar.cpp.analyzer.Analyzer$AnalyzerException: Exit code != 0

**URL:** <https://community.sonarsource.com/t/com-sonar-cpp-analyzer-analyzer-analyzerexception-exit-code-0/38419>\
**Category:** SonarQube Server / Community Build\
**Tags:** cfamily\
**Created:** [February 10, 2021, 11:53am UTC](https://community.sonarsource.com/t/com-sonar-cpp-analyzer-analyzer-analyzerexception-exit-code-0/38419 "2021-02-10T11:53:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kr.st.je](https://avatars.discourse-cdn.com/v4/letter/k/4bbf92/32.png) [@kr.st.je](https://community.sonarsource.com/u/kr.st.je)\
**Post date:** [February 10, 2021, 11:53am UTC](https://community.sonarsource.com/t/com-sonar-cpp-analyzer-analyzer-analyzerexception-exit-code-0/38419/1 "2021-02-10T11:53:14Z")

</div>

Must-share information (formatted with [Markdown](https://commonmark.org/help/)):

- which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

- what are you trying to achieve  
I am trying to scan a bigger C++ project with build-wrapper

- what have you tried so far to achieve this

```auto
call "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
cmake ...
build-wrapper-win-x86-64.exe --out-dir build_wrapper_output_directory msbuild project.sln /m:4 /nr:false /t:proj:Rebuild /p:Configuration="Release" /p:Platform="x64"

```

After these commands I am scanning the project with `sonar-scanner.bat`. During that scan I get this error message:

```auto
ERROR: Exception in thread pool-3-thread-1
com.sonar.cpp.analyzer.Analyzer$AnalyzerException: Exit code != 0: C:\path\to\file.cpp
	at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:81)
	at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:78)
	at com.sonar.cpp.plugin.CFamilySensor.lambda$process$8(CFamilySensor.java:643)
	at com.sonar.cpp.analyzer.AnalysisExecutor.lambda$submit$0(AnalysisExecutor.java:59)
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

ERROR: 
An error occurred while analyzing the following compilation unit: 
  C:\path\to\file.cpp
A file named "sonar-cfamily-reproducer.zip" has been generated to help the problem investigation.
Please contact SonarSource support providing the following file to help improving the analyzer:
  ...\sonar-cfamily-reproducer.zip

```

---

<div class="post-metadata">

**Author:** ![JolyLoic](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/jolyloic/32/199_2.png) [@JolyLoic](https://community.sonarsource.com/u/JolyLoic)\
**Post date:** [February 11, 2021, 11:24pm UTC](https://community.sonarsource.com/t/com-sonar-cpp-analyzer-analyzer-analyzerexception-exit-code-0/38419/2 "2021-02-11T23:24:12Z")

</div>

Hello @kr.st.je ,

On the messages you post, we can see the path `C:\path\to\file.cpp`. It is not clear to me if this strange path was really written in the displayed message, of if you replaced the original path by this one before publishing, in order to hide some internal data. Could you please clarify?

Assuming this is the second case, to investigate this issue, we would need the `sonar-cfamily-reproducer.zip` file that is mentioned in the message, as well as the analysis log. I’m sending you a private message if you’re willing to share it privately with us.

---

<div class="post-metadata">

**Author:** ![kr.st.je](https://avatars.discourse-cdn.com/v4/letter/k/4bbf92/32.png) [@kr.st.je](https://community.sonarsource.com/u/kr.st.je)\
**Post date:** [February 16, 2021, 3:56pm UTC](https://community.sonarsource.com/t/com-sonar-cpp-analyzer-analyzer-analyzerexception-exit-code-0/38419/3 "2021-02-16T15:56:58Z")

</div>

Hi @JolyLoic thank you for your answer. I replaced the original path to the file with `C:\path\to\file.cpp` to hide internal data.

---

<div class="post-metadata">

**Author:** ![JolyLoic](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/jolyloic/32/199_2.png) [@JolyLoic](https://community.sonarsource.com/u/JolyLoic)\
**Post date:** [February 17, 2021, 9:58am UTC](https://community.sonarsource.com/t/com-sonar-cpp-analyzer-analyzer-analyzerexception-exit-code-0/38419/5 "2021-02-17T09:58:55Z")

</div>

Hello @kr.st.je,

Thank to the reproducer you provided us, I’ve been able to reproduce the issue on my side. This is a know issue (see [CPP-2696](https://jira.sonarsource.com/browse/CPP-2696)) related to the fact we are using clang to analyze the code, and clang does not play well with boost on Windows. You can see in one of the boost headers:

```auto
  template <typename Executor>
  friend BOOST_ASIO_CONSTEXPR blocking_t query(
      const Executor& ex, convertible_from_blocking_t,
      typename enable_if<
        can_query<const Executor&, possibly_t>::value
      >::type* = 0)
#if !defined( __clang__ ) // Clang crashes if noexcept is used here.
#if defined(BOOST_ASIO_MSVC) // Visual C++ wants the type to be qualified.
    BOOST_ASIO_NOEXCEPT_IF((
      is_nothrow_query<const Executor&, blocking_t<>::possibly_t>::value))
#else // defined(BOOST_ASIO_MSVC)
    BOOST_ASIO_NOEXCEPT_IF((
      is_nothrow_query<const Executor&, possibly_t>::value))
#endif // defined(BOOST_ASIO_MSVC)
#endif // !defined( __clang__ )
  {
    return boost::asio::query(ex, possibly_t());
  }

```

Notice the comment `// Clang crashes if noexcept is used here.`… This is exactly where the analysis crashes in the reproducer.

The good news it that there is a workaround. If you add `-DBOOST_ASIO_DISABLE_NOEXCEPT` to your build, the analysis no longer crashes.

I hope this helps!

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/system/32/31083_2.png) [@system](https://community.sonarsource.com/u/system)\
**Post date:** [February 26, 2021, 10:28am UTC](https://community.sonarsource.com/t/com-sonar-cpp-analyzer-analyzer-analyzerexception-exit-code-0/38419/6 "2021-02-26T10:28:02Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
