Skip to content

compilerPath not taken from compile_commands.json #7388

Description

Bug type: Language Service

Describe the bug

  • OS and Version: Windows 10
  • VS Code Version: 1.55.2
  • C/C++ Extension Version: 1.3.0
  • Other extensions you installed (and if the issue persists after disabling them):
  • If using SSH remote, specify OS of remote machine: Linux
  • A clear and concise description of what the bug is, including information about the workspace (i.e. is the workspace a single project or multiple projects, size of the project, etc).

compilerPath is unset in .c_cpp_properties.json I configured a compileCommands, within the compileCommand the compiler is arm-linux-gcc but once I load a C file and run C/C++ Log diagnostic, I see /usr/bin/ccache/gcc

If I set the compilerPath to the arm-linux-gcc manually in c_cpp_properties.json then it works.

Steps to reproduce

Create a compilerCommands.json with a non-standard compiler
remove the compilerPath from c_cpp_properties.json file
run C/C++ Log diagnostic

Expected behavior

I would expect to see arm-linux-gcc as the compiler.

Code sample and logs

  • Code sample

  • Configurations in c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Linux",
            "cStandard": "c89",
            "cppStandard": "gnu++98",
            "intelliSenseMode": "linux-gcc-arm",
            "compileCommands": "${workspaceFolder}/compile_commands.json",
            "browse": {
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            }
        }
    ],
    "version": 4
}
  • Logs from running C/C++: Log Diagnostics from the VS Code command palette
[ /mypath/myfile.c ]:
    Process ID: 3541
    Memory Usage: 7 MB
    Compiler Path: /usr/lib64/ccache/gcc
    Includes:
        /usr/lib/gcc/x86_64-redhat-linux/4.8.2/include
        /usr/local/include
        /usr/include
    Standard Version: c89
    IntelliSense Mode: linux-gcc-x64
    Other Flags:
        --gcc
        --gnu_version=40805
Total Memory Usage: 18 MB

Screenshots

Additional context

Here is my compile_commands.json

[
 {
  "directory": "/myoath", 
  "arguments": [
   "arm-linux-gcc", 
   "-pipe", 
   "-Wall", 
   "-Werror", 
   "-Wno-unused", 
   "-fno-unit-at-a-time", 
   "-Wno-pointer-sign", 
   "-Wno-strict-aliasing", 
   "-Wno-unused-but-set-variable", 
   "-fgnu89-inline", 
   "-ggdb", 
   "-O2", 
   "-Werror-implicit-function-declaration", 
   "-O2", 
   "-g", 
   "-I.", 
   "-c", 
   "cfg.c", 
   "-o", 
   "myfile.o"
  ], 
  "file": "myfile.c"
 }
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature: ConfigurationAn issue related to configuring the extension or IntelliSenseLanguage ServicebugfixedCheck the Milestone for the release in which the fix is or will be available.quick fix

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions