Cc1plus.exe: error: target CPU does not support ARM mode

I am using a trial version (7.9) with support for C/C++. I have built our code through the build wrapper and can see that a json was generated. But when I try to run the scanner I get this error “cc1plus.exe: error: target CPU does not support ARM mode”. This is somewhat puzzling to me as we do build towards and ARM target (Cortex M4). Can someone please help me getting this solved?

Kind regards,

cc1plus.exe: error: target CPU does not support ARM mode

13:39:15.241 INFO: ------------------------------------------------------------------------
13:39:15.242 INFO: ------------------------------------------------------------------------
13:39:15.243 INFO: Total time: 1:58.288s
13:39:15.326 INFO: Final Memory: 22M/87M
13:39:15.326 INFO: ------------------------------------------------------------------------
13:39:15.326 ERROR: Error during SonarQube Scanner execution
at com.sonar.cpp.analyzer.StdFlags.fromCppMacros(
at com.sonar.cpp.analyzer.ClangDriver.onCapture(
at com.sonar.cpp.plugin.CFamilySensor.process(
at com.sonar.cpp.plugin.CFamilySensor.execute(
at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(

Hello @conscwit,

Could you please shared with us the build-wrapper-dump.json file?

Normally, we should ignore cc1plus, and instead focus on the parent gcc process to get the compilation options. So I’m not sure how you are seeing anything related to cc1plus

Thank you,

Hi Loïc,
Thank you for looking into this issue. I have uploaded the json file so please take a look. Hopefully it will shed some light on this.
I have replaced my computer name and user ID with XXX’s, which I assume is OK.

Kind regards,
build-wrapper-dump.json.txt (3.0 MB)

Hello @conscwit,

Unfortunately, I did not see anything fishy in the build-wrapper-dump.json file… To better understand the context of this error, I would need the full sonar-scanner log (with debug logs enabled). Can you send it to me?


Hi Loïc,
Is this what you are looking for?
sonarsource-debug.log.txt (1.2 MB)

Yes, this is it.

It shows that at some point, to detect what macros are define by default in your compiler, we try to run the following command line:

C:\Work\RemoteLink\extern\sdk_gnuarm\bin\arm-none-eabi-g++.exe -x c++ -mcpu=cortex-m4 -v -dM -E -

And this is this command that produces the message:

cc1plus.exe: error: target CPU does not support ARM mode

And because of this failure, we fail to retrieve the necessary configuration.

Since I don’t have arm-none-eabi-g++ on my computer, it’s hard for me to debug further… Can you try and manually run this command line on your build environment to see what you get? If it fails there too (as it should), maybe you can tune it and tell us what needs to be changed so that this command produces correct output (it should list in stdout all predefined macros)?

Hi Loïc,

This is help output from arm-none-eabi-g++.exe:

Usage: arm-none-eabi-g++.exe [options] file...
  -pass-exit-codes         Exit with highest error code from a phase
  --help                   Display this information
  --target-help            Display target specific command line options
                           Display specific types of command line options
  (Use '-v --help' to display command line options of sub-processes)
  --version                Display compiler version information
  -dumpspecs               Display all of the built in spec strings
  -dumpversion             Display the version of the compiler
  -dumpmachine             Display the compiler's target processor
  -print-search-dirs       Display the directories in the compiler's search path
  -print-libgcc-file-name  Display the name of the compiler's companion library
  -print-file-name=<lib>   Display the full path to library <lib>
  -print-prog-name=<prog>  Display the full path to compiler component <prog>
  -print-multiarch         Display the target's normalized GNU triplet, used as
                           a component in the library path
  -print-multi-directory   Display the root directory for versions of libgcc
  -print-multi-lib         Display the mapping between command line options and
                           multiple library search directories
  -print-multi-os-directory Display the relative path to OS libraries
  -print-sysroot           Display the target libraries directory
  -print-sysroot-headers-suffix Display the sysroot suffix used to find headers
  -Wa,<options>            Pass comma-separated <options> on to the assembler
  -Wp,<options>            Pass comma-separated <options> on to the preprocessor
  -Wl,<options>            Pass comma-separated <options> on to the linker
  -Xassembler <arg>        Pass <arg> on to the assembler
  -Xpreprocessor <arg>     Pass <arg> on to the preprocessor
  -Xlinker <arg>           Pass <arg> on to the linker
  -save-temps              Do not delete intermediate files
  -save-temps=<arg>        Do not delete intermediate files
  -no-canonical-prefixes   Do not canonicalize paths when building relative
                           prefixes to other gcc components
  -pipe                    Use pipes rather than intermediate files
  -time                    Time the execution of each subprocess
  -specs=<file>            Override built-in specs with the contents of <file>
  -std=<standard>          Assume that the input sources are for <standard>
  --sysroot=<directory>    Use <directory> as the root directory for headers
                           and libraries
  -B <directory>           Add <directory> to the compiler's search paths
  -v                       Display the programs invoked by the compiler
  -###                     Like -v but options quoted and commands not executed
  -E                       Preprocess only; do not compile, assemble or link
  -S                       Compile only; do not assemble or link
  -c                       Compile and assemble, but do not link
  -o <file>                Place the output into <file>
  -pie                     Create a position independent executable
  -shared                  Create a shared library
  -x <language>            Specify the language of the following input files
                           Permissible languages include: c c++ assembler none
                           'none' means revert to the default behavior of
                           guessing the language based on the file's extension

Options starting with -g, -f, -m, -O, -W, or --param are automatically
 passed on to the various sub-processes invoked by arm-none-eabi-g++.exe.  In order to pass
 other options on to these processes the -W<letter> options must be used.

For bug reporting instructions, please see:

Is this the command that you want to execute?:

arm-none-eabi-g++.exe -x c++ -mcpu=cortex-m4 -v -dM -E -dumpspecs

Hello again @conscwit,

It appears that this compiler only accepts the option -mcpu=cortex-m4 when the option -mthumb is set too, which is causing the failure.

Unfortunately, we don’t currently set this option when probing your compiler. I created a ticket to solve this issue.

Thank you for reporting it!

Hello @conscwit,

FYI SonarCFamily 6.4 containing the bug fix you reported is available on the marketplace.