vscode-cmake-tools icon indicating copy to clipboard operation
vscode-cmake-tools copied to clipboard

Wrong compiler switch used to detect compiler version

Open jvanhamaki opened this issue 2 years ago • 2 comments

Brief Issue Summary

Looks like wrong versionSwitch is obtained and used when configuring project which is using "chesscc" as C compiler.

Probably because the name involves "cc" which then gets "-v" as versionSwitch. This will result like this [proc] The command: chesscc -v exited with code: 1

In this case correct versionSwitch would be "--version"

I could bypass the problem by renaming the compiler "chesscc" -> "chess"...

CMake Tools Diagnostics

{
  "os": "linux",
  "vscodeVersion": "1.81.1",
  "cmtVersion": "1.15.31",
  "configurations": [
    {
      "folder": "<project secret>",
      "cmakeVersion": "3.27.1",
      "configured": true,
      "generator": "Ninja",
      "usesPresets": false,
      "compilers": {
        "C": "/opt/asip/linux64/bin/LNa64bin/chesscc",
        "CXX": "chesscc"
      }
    }
  ],
  "cpptoolsIntegration": {
    "isReady": true,
    "hasCodeModel": true,
    "activeBuildType": "Release",
    "buildTypesSeen": [
      "Release"
    ],
    "requests": [],
    "responses": [],
    "partialMatches": [],
    "targetCount": 30,
    "executablesCount": 1,
    "librariesCount": 0,
    "targets": []
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "auto",
      "configureOnOpen": true
    }
  ]
}

Debug Log

[cmake] -- Build files have been written to: <project secret>
[cmakefileapi-parser] Read reply folder: <project secret>/.cmake/api/v1/reply
[cmakefileapi-parser] Found index files: ["cache-v2-8fc02c430e5c055045db.json","cmakeFiles-v1-41eb41e41146953d9018.json","codemodel-v2-e8ae9c87cb9734fef625.json","directory-.-Release-f5ebdc15457944623624.json","directory-src-Release-b6cf2213fc5053b67c22.json","directory-src.<project secret>-Release-2c34036f875e973b6591.json","directory-src.<project secret>-Release-cabcbad00bde26f11a90.json","directory-test-Release-451c0598f41488bb20b9.json","directory-test.system-Release-f6333b59567400b85ae3.json","directory-test.system.generic-Release-c20ad6767e790606682d.json","directory-test.unit-Release-95f19909738940399904.json","directory-tools-Release-f9645b0170a45a75eff2.json","index-2023-08-21T11-37-44-0361.json","target-<project secret>-<project secret>-Release-b011a111066007a8c2fa.json","target-<project secret>-<project secret>_auxilary-Release-31aa79525cbcc72f903a.json","target-Continuous-Release-dfaa6acba6f968305524.json","target-ContinuousBuild-Release-148e7081d565824d60ac.json","target-ContinuousConfigure-Release-97666e347bc3ad00e0c8.json","target-ContinuousCoverage-Release-9a2a39c9c7712215359e.json","target-ContinuousMemCheck-Release-aff92bc23cd22fcd3659.json","target-ContinuousStart-Release-82f531fbd48ad468642b.json","target-ContinuousSubmit-Release-efec7419624446f641c8.json","target-ContinuousTest-Release-16c9e5ee5d4ca82ce35c.json","target-ContinuousUpdate-Release-c9c851fc82de96ca8e5e.json","target-Experimental-Release-2a9b41fae011e31126ce.json","target-ExperimentalBuild-Release-b51a9e68213c6f02a2f8.json","target-ExperimentalConfigure-Release-0101ddc688093159ae87.json","target-ExperimentalCoverage-Release-d09d439b2dd13492104e.json","target-ExperimentalMemCheck-Release-36d52c1e2103d1ec74d3.json","target-ExperimentalStart-Release-97cb6833ec9a2888707f.json","target-ExperimentalSubmit-Release-eca639407365ebcdf018.json","target-ExperimentalTest-Release-688d94644fcc0712f20c.json","target-ExperimentalUpdate-Release-e97e23caee2c4339e5de.json","target-Nightly-Release-56563a19f15b9865e8fb.json","target-NightlyBuild-Release-4c660be672e1944fd11c.json","target-NightlyConfigure-Release-f1d7029a0e487e48df83.json","target-NightlyCoverage-Release-e1db94ae6f33350756bb.json","target-NightlyMemCheck-Release-f1b9af285fd39118b461.json","target-NightlyMemoryCheck-Release-41fb9fa9f297eebee21d.json","target-NightlyStart-Release-0f60efd85234dcc3af92.json","target-NightlySubmit-Release-16cf6ececd28bfb2a9ff.json","target-NightlyTest-Release-7d1a827eb1a9d8057c15.json","target-NightlyUpdate-Release-8eb12dae64ca427336f5.json","toolchains-v1-5bdcfd7cc890915fbdf6.json"]
[proc] The command: chesscc -v exited with code: 1
[proc] The command: chesscc -v exited with code: 1
[cache] Reading CMake cache file <project secret>/CMakeCache.txt
[cache] Parsing CMake cache string
[extension] [5078] cmake.setVariant finished (returned 0)

Additional Information

No response

jvanhamaki avatar Aug 21 '23 12:08 jvanhamaki

@jvanhamaki Thanks for notifying us of this! I have done a quick investigation of the code and I think you are correct, it is finding the cc compiler from the allow list and using -v accordingly.

It'd be very beneficial for us to have you contribute a fix for this! The fix, I believe, could be as simple as adding chesscc to the compiler allow list. Thanks!

gcampbell-msft avatar Aug 23 '23 13:08 gcampbell-msft

@jvanhamaki Could you provide some documentation on the chesscc compiler? I'm attempting to download it and I can't find it.

The specific information would be the versionSwitch (which I believe you said should be --version and also the versionOutputRegexp. Thanks!

gcampbell-msft avatar May 08 '24 15:05 gcampbell-msft

Closing due to merging of PR #3777

gcampbell-msft avatar Jun 24 '24 15:06 gcampbell-msft