Issue while arm compiler 6 probing

Hi,

we are using the following Sonarqube setup:

  • SonarQube Scanner 3.2.0.1227
  • SonarCFamily 6.0.0.10816 (cpp)

The SonarQube Scanner runs inside a docker linux-container.

  • Java 1.8.0_191 Oracle Corporation (64-bit)
  • Linux 4.15.0-43-generic amd64

This container is running on a jenkins job in our CI/CD toolchain.
Our C++ project is build with ninja and uses the arm compiler and it compiles successful.

  • ninja 1.8.2
  • Arm Compiler 6.10

We use the build-wrapper to catch the information of the compiler.

/opt/sonar-build/build-wrapper-linux-x86-64 --out-dir bw-outputsv6 ninja Target_1

The resulting log file looks good to me.

In a another step we use the sonar scanner with the cfamily plugin to analyze our code.

sonar-scanner -X -Dsonar.host.url=XXX -Dsonar.projectKey=YYY -Dsonar.language=cpp -Dsonar.sources=. -Dsonar.objc.file.suffixes=- -Dsonar.cfamily.build-wrapper-output=./bw-outputsv6/ -Dsonar.sourceEncoding=UTF-8

The file is found by the CFamily plugin.

15:44:24.849 INFO: Sensor CFamily [cpp]
15:44:24.850 INFO: Using build-wrapper output: /home/jenkins/workspace/Project/Sourcen/100_Arbeit/./bw-outputsv6/build-wrapper-dump.json
15:44:24.850 INFO: Available processors: 1
15:44:24.850 INFO: Using 1 thread for analysis according to value of “sonar.cfamily.threads” property.
15:44:24.850 DEBUG: Unpacking analyzer to: /home/jenkins/workspace/Project/Sourcen/100_Arbeit/.scannerwork/.sonartmp/743351237207951652
15:44:26.332 DEBUG: ‘main.cpp’ generated metadata with charset ‘windows-1252’
15:44:26.347 DEBUG: Not enough content in ‘main.cpp’ to have CPD blocks, it will not be part of the duplication detection
15:44:26.351 WARN: Metric ‘comment_lines_data’ is deprecated. Provided value is ignored.
15:44:26.387 DEBUG: ‘SystemCoreClock.cpp’ generated metadata with charset ‘UTF-8’

But while the probing the arm 6 compiler we got an error. We get the following message:

15:44:26.415 DEBUG: Probing compiler: [/usr/local/ARM_Compiler/bin/armclang, -x, c++, --std, c++11, -target, arm-arm-none-eabi, -v, -dM, -E, -]
15:44:26.511 DEBUG: stdout:

15:44:26.512 DEBUG: stderr:
Product: MDK-ARM Essential 5.26 (Flex)
Component: ARM Compiler 6.6
Tool: armclang [5c77f600]

Target: arm-arm-none-eabi
armclang: error: ARMv4 is not supported by this toolchain

The armclang cannot tested successfully. I think the problem is the last minus sign in compiler probe. If I the following command every thing works fine:

armclang -x c++ --std c++11 -target arm-arm-none-eabi -v -dM -E
output

root@44f11bdaf4b1:/# /usr/local/ARM_Compiler/bin/armclang -x c++ --std c++11 -target arm-arm-none-eabi -v -dM -E
Product: MDK-ARM Essential 5.26 (Flex)
Component: ARM Compiler 6.10
Tool: armclang [5d142f00]

But if I add the last minus, then I got the same output

armclang -x c++ --std c++11 -target arm-arm-none-eabi -v -dM -E -
output:
root@44f11bdaf4b1:/# /usr/local/ARM_Compiler/bin/armclang -x c++ --std c++11 -target arm-arm-none-eabi -v -dM -E -
Product: MDK-ARM Essential 5.26 (Flex)
Component: ARM Compiler 6.10
Tool: armclang [5d142f00]

Target: arm-arm-none-eabi
armclang: error: ARMv4 is not supported by this toolchain
Information about this error is available at: Arm Development Studio
General licensing information is available at: Arm Development Studio
If you need further help, provide this complete error report to your supplier or license.support@arm.com.

  • ARMLMD_LICENSE_FILE: ‘XXX@QQQQ’
  • LM_LICENSE_FILE: unset
  • ARM_TOOL_VARIANT: ‘mdk_cm_std_flex’
  • ARM_PRODUCT_PATH: unset
  • Product location: /usr/local/ARM_Compiler/sw/mappings
  • Toolchain location: /usr/local/ARM_Compiler/lib/tt_default/bin
  • Selected tool variant: mdk_cm_std_flex

armclang: error: ARM Compiler does not support ‘-target=arm-arm-none-eabi’

I have already tested another version of the arm compiler (6.6) but there is the same issue.

Is it possible to change the compiler flags that are passed to the compiler?
Or does anyone have an other idea?

Thanks Thorsten

Hi @tguetle,

I am not able to reproduce the issue with armclang shipped as part of DS-5.
How are you installing armclang for MDK? I can only find windows installer for MDK-ARM Essential 5.26.

Hi @mpaladin,

I have the arm compiler installed independently. You can get the compiler from here: https://developer.arm.com/products/software-development-tools/compilers/arm-compiler/downloads/version-6.

After installation, you need to set some environment variables for licensing (we use FlexLM) and copy some files from the keil installation.(see this http://www.keil.com/support/docs/3912.htm.

After that I am able to compile my project.

I also tried out the arm compiler 5. This work’s. For this the compiler probing give back the following line:

Probing compiler: [/usr/local/ARM_Compiler/bin/armcc, --list-macros, --c99, --cpu=Cortex-M3]

The is no ‘-’ at the end.

Which compiler version do you have?
What kind of license do you have?
Can you paste your compiler probing line here?

/usr/local/DS-5_v5.29.1/sw/../sw/ARMCompiler6.10.1/bin/armclang --version:

armclang: warning: Your license for feature compiler5 will expire in 30 days [-Wlicense-management]
Product: DS-5 Professional 5.29.1
Component: ARM Compiler 6.10.1
Tool: armclang [5d143200]

and the following works ok for me, I get good output:

/usr/local/DS-5_v5.29.1/sw/../sw/ARMCompiler6.10.1/bin/armclang -x c++ --std c++11 -target arm-arm-none-eabi -v -dM -E - < /dev/null

Ok, that is strange. I have install version 6.10.1 but that doesn’t matter.

I have make another test. The -### gives you more output.

./armclang -xc++ -std=c++11 -target=arm-arm-none-eabi -v -dM -### -

This returns:

armclang: error: ARM Compiler does not support ‘-target=arm-arm-none-eabi’
“/usr/local/ARM_Compiler/lib/tt_default/bin/armclang” “-cc1” “-triple” “armv4t-arm-none-eabi” “-emit-obj” “-mrelax-all” “-disable-free” “-disable-llvm-verifier” “-discard-value-names” “-main-file-name" “-” “-Werror=return-type” “-mrelocation-model” “static” “-mthread-
del” “posix” “-menable-no-infs” “-menable-no-nans” “-fmath-errno” “-fno-signed-zeros” “-fno-trapping-math” “-fdenormal-fp-math=preserve-sign” “-ffinite-math-only” “-masm-verbose” “-mconstructor-aliases” “-target-cpu” “arm7tdmi” “-target-feature” “+soft-float-abi” “-tar
t-feature” “+strict-align” “-target-abi” “aapcs” “-mfloat-abi” “soft” “-fallow-half-arguments-and-returns” “-dwarf-column-info” “-debugger-tuning=gdb” “-v” “-ffunction-sections” “-fdata-sections” “-resource-dir” “/usr/local/ARM_Compiler/lib/tt_default/lib/clang/7.0.0”
D__ARMCOMPILER_LIBCXX=1” “-internal-isystem” “/usr/local/ARM_Compiler/bin/…/include/libcxx” “-internal-isystem” “/usr/local/ARM_Compiler/bin/…/include” “-nobuiltininc” “-std=c++11” “-fdeprecated-macro” “-fdebug-compilation-dir” “/” “-ferror-limit” “19” “-fmessage-len
h” “269” “-fvisibility” “hidden” “-fno-signed-char” “-fdeclspec” “-fobjc-runtime=gcc” “-fcxx-exceptions” “-fexceptions” “-fno-common” “-fdiagnostics-show-option” “-fsuppress-licensing” “-aggressive-jump-threading” “-dM” “-o” “/tmp/–9793d1.o” “-x” “c++” “-”
“/usr/local/ARM_Compiler/lib/tt_default/bin/armlink” “-o” “a.out” “–stdlib=libc++” “/tmp/–9793d1.o”

and this is very interesting:

  • the “-” is interpreted as input file
  • the target is assumed as armv4t-arm-none-eabi

armv4t-arm-none-eabi is not supported by the arm compiler 6.

If I add a cpu type then it work:

/armclang -xc++ -std=c++11 -target=arm-arm-none-eabi -v -dM -mcpu=Cortex-M3 -### -

Output:

“/usr/local/ARM_Compiler/lib/tt_default/bin/armclang” “-cc1” “-triple” "thumbv7m-arm-none-eabi" “-emit-obj” “-mrelax-all” “-disable-free” “-disable-llvm-verifier” “-discard-value-names” “-main-file-name” “-” “-Werror=return-type” “-mrelocation-model” “static” “-mthread-
model” “posix” “-menable-no-infs” “-menable-no-nans” “-fmath-errno” “-fno-signed-zeros” “-fno-trapping-math” “-fdenormal-fp-math=preserve-sign” “-ffinite-math-only” “-masm-verbose” “-mconstructor-aliases” “-target-cpu” “cortex-m3” “-target-feature” “+soft-float-abi” “-ta
rget-abi” “aapcs” “-mfloat-abi” “soft” “-fallow-half-arguments-and-returns” “-dwarf-column-info” “-debugger-tuning=gdb” “-v” “-ffunction-sections” “-fdata-sections” “-resource-dir” “/usr/local/ARM_Compiler/lib/tt_default/lib/clang/7.0.0” “-D__ARMCOMPILER_LIBCXX=1” “-inte
rnal-isystem” “/usr/local/ARM_Compiler/bin/…/include/libcxx” “-internal-isystem” “/usr/local/ARM_Compiler/bin/…/include” “-nobuiltininc” “-std=c++11” “-fdeprecated-macro” “-fdebug-compilation-dir” “/” “-ferror-limit” “19” “-fmessage-length” “269” “-fvisibility” "hidden
" “-fno-signed-char” “-fdeclspec” “-fobjc-runtime=gcc” “-fcxx-exceptions” “-fexceptions” “-fno-common” “-fdiagnostics-show-option” “-fsuppress-licensing” “-aggressive-jump-threading” “-dM” “-o” “/tmp/–d91432.o” “-x” “c++” “-”
“/usr/local/ARM_Compiler/lib/tt_default/bin/armlink” “-o” “a.out” “–stdlib=libc++” “/tmp/–d91432.o”

I think a valid CPU type must be set for the compiler probing.

Hi @tguetle,

could you please try the following?

armclang -x c++ --std c++11 -target arm-arm-none-eabi -v -dM -E - < /dev/null

I reviewed the output of Arm Compiler 5 again. There the probing line looks like this:

DEBUG: Probing compiler: [/usr/local/ARM_Compiler/bin/armcc, --list-macros, --c99, --cpu=Cortex-M3]

There the cpu type is added. Something like this we also need for the arm compiler 6.

armclang -x c++ --std c++11 -target arm-arm-none-eabi -mcpu=Cortex-M3 -v -dM -E

I think its an issue of the plugin, or can I influence the probing line?

Hi @tguetle,

could you please try to run as asked:

Could you also share the build-wrapper-dump.json file please?

Hi

here is the output:

root@98cbd2688f10:/# /usr/local/ARM_Compiler/bin/armclang -x c++ --std c++11 -target arm-arm-none-eabi -v -dM -E - < /dev/null
Product: MDK-ARM Essential 5.26 (Flex)
Component: ARM Compiler 6.10
Tool: armclang [5d142f00]

Target: arm-arm-none-eabi
armclang: error: ARMv4 is not supported by this toolchain
Information about this error is available at: Arm Development Studio
General licensing information is available at: Arm Development Studio
If you need further help, provide this complete error report to your supplier or license.support@arm.com.

  • ARMLMD_LICENSE_FILE: ‘xxx@YYY
  • LM_LICENSE_FILE: unset
  • ARM_TOOL_VARIANT: ‘mdk_cm_std_flex’
  • ARM_PRODUCT_PATH: unset
  • Product location: /usr/local/ARM_Compiler/sw/mappings
  • Toolchain location: /usr/local/ARM_Compiler/lib/tt_default/bin
  • Selected tool variant: mdk_cm_std_flex

armclang: error: ARM Compiler does not support ‘-target=arm-arm-none-eabi’
root@98cbd2688f10:/#

Is there a special part in the json file that you are interested in? I cannot give you the whole file :frowning:

According to http://www.keil.com/appnotes/files/apnt_298.pdf -mcpu is required with -E, at least with armclang distributed by Keil, I created a ticket on dev side: CPP-2100.